How to call rule in graphDB?

84 Views Asked by At

I want to create an inference in my project, that the goal is to link when the rule is good the Subject V (Valeur) and the Object TM Type_Mesure. So I have done this rule in protege ontology editor (in SWRL):

modele:Modelisé_Avec(?MQ,?TM) ^ 
modele:Antecedent(?MS, ?MQ) ^
profil:A_Pour_Modèle_Système(?S, ?MS) ^
profil:A_Pour_Comportement(?MS, ?GC) ^ 
profil:A_Pour_Membre(?GC, ?C) ^ 
capt:A_Pour_Echantillon(?C, ?E) ^ 
capt:A_Pour_Valeur(?E,?V) ^ 
-> capt:Classifie_Metier(?V, ?TM)

I use tree ontologies in this case : Profil_V2,Modele_V2 and Capteur_V2

But graphDB don't accept this type of rule. So, i want to turn it to language who is accepted in grphDB.

I have already do this code :

PREFIX sys: <www.ontotext.com/owlim/system#>
PREFIX rdf: <www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX modele: <srv-rd-vm/ontology/Modele_V2#>
PREFIX profil: <srv-rd-vm/ontology/Profil_V2#>
PREFIX capt: <srv-rd-vm/ontology/Capteur_V2#>
INSERT DATA {
<_:profil_classification_Metier> sys:addRuleset
        '''Prefices { 
                    profil: <srv-rd-vm/ontology/Profil_V2#>
            modele: <srv-rd-vm/ontology/Modele_V2#>
            capt: <srv-rd-vm/ontology/Capteur_V2#>
            rdf: <www.w3.org/1999/02/22-rdf-syntax-ns#>
           }
           Axioms {}
           Rules
           {
            Id: profil_classification_Metier
                MQ <rdf:Type> <modele:MODELE_QUALIFICATION>
                MQ <modele:Modelisé_Avec> TM
                MS <modele:Antecedent> MQ
                S <profil:A_Pour_Modèle_Système> MS 
                MS <profil:A_Pour_Comportement> GC 
                GC <profil:A_Pour_Membre> C 
                C <capt:A_Pour_Echantillon> E 
                E <capt:A_Pour_Valeur> V 
                -------------------------------
                V <capt:Classifie_Metier> TM
           }'''
}

But I don't know how to call it when I create a new data. For the moment I call the rule like that :

PREFIX capt: <http://srv-rd-vm/ontology/Capteur_V2#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX profil: <http://srv-rd-vm/ontology/Profil_V2#>
INSERT {
    [] <http://www.ontotext.com/owlim/system#Test> [] .
    capt:test rdf:type capt:VALEUR .
 capt:test capt:Nom 'test'^^xsd:string .
 capt:test capt:Valeur '60.5042'^^xsd:float . 
 capt:echantillon capt:A_Pour_Valeur capt:test .
    
 capt:echantillon rdf:type capt:ECHANTILLON .
 capt:echantillon capt:Nom 'echantillon'^^xsd:string .
 capt:echantillon capt:Date '1695717396'^^xsd:dateTime .
 profil:comportement capt:A_Pour_Echantillon capt:echantillon.
    
 profil:comportement rdf:type profil:COMPORTEMENT .
 profil:comportement profil:Nom 'comportement'^^xsd:string .
 profil:9e7b483e_cec8_4ce7_8ae2_6e693859a043 profil:A_Pour_Membre  profil:comportement .
    
} 

WHERE {  };

When I use it like that the rule create a predicat with the same name as her and blank node.

query to show the result of rule called

But when I set like default rule she works.

Do you known how to call it ?

Thanks in advance!!

1

There are 1 best solutions below

0
Vladimir Alexiev On