SWRL rules don't infer new Object and Data Property Assertions

后端 未结 2 511
-上瘾入骨i
-上瘾入骨i 2020-12-06 08:34

I have created this ontology which contains two classes: Blood-Sugar and Services. Blood-Sugar has two data properties: hasValu with rang

相关标签:
2条回答
  • 2020-12-06 09:24

    Based on your comment, perhaps an example of SWRL rules being used to infer a new object property assertion will get you on track. Some OWL 2 reasoners support SWRL rules, so I'm using Protégé 4.x and Pellet. SWRL rules can be used to infer new object property assertions. For instance, in the following ontology, there is a class Person with individuals Alice, Bill, Carl, and Raymond, an object property likes, and a rule:

    Person(?x) → likes(?x,Raymond)

    After enabling the Pellet reasoner (Reasoner > Pellet, then Reasoner > Start Reasoner), we get the expected results. E.g., Bill likes Raymond:

    bill likes raymond

    Here's the ontology:

    @prefix :      <http://example.org/swrl-example#> .
    @prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
    @prefix swrl:  <http://www.w3.org/2003/11/swrl#> .
    @prefix owl:   <http://www.w3.org/2002/07/owl#> .
    @prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
    @prefix swrlb: <http://www.w3.org/2003/11/swrlb#> .
    @prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    
    <http://example.org/swrl-example>
            a       owl:Ontology .
    
    :Person  a      owl:Class .
    
    :Raymond  a     owl:NamedIndividual , :Person .
    
    :Alice  a       owl:NamedIndividual , :Person .
    
    [ a          swrl:Imp ;
      swrl:body  [ a          swrl:AtomList ;
                   rdf:first  [ a                    swrl:ClassAtom ;
                                swrl:argument1       <urn:swrl#x> ;
                                swrl:classPredicate  :Person
                              ] ;
                   rdf:rest   ()
    
                 ] ;
      swrl:head  [ a          swrl:AtomList ;
                   rdf:first  [ a                       swrl:IndividualPropertyAtom ;
                                swrl:argument1          <urn:swrl#x> ;
                                swrl:argument2          :Raymond ;
                                swrl:propertyPredicate  :likes
                              ] ;
                   rdf:rest   ()
    
                 ]
    ] .
    
    :Bill   a       owl:NamedIndividual , :Person .
    
    :likes  a       owl:ObjectProperty .
    
    :Carl   a       owl:NamedIndividual , :Person .
    
    <urn:swrl#x>  a  swrl:Variable .
    
    0 讨论(0)
  • 2020-12-06 09:38

    But the reasonner does not give me the result that i want when I creat instances !!!

    A bit more detail would be helpful here. How do you know that the reasoner (and which reasoner are you using, by the way?) isn't inferring the desired properties? Did you enable the reasoner? Did you run a query to check whether the inferences were present? Did you set the configuration in Protégé to show all the appropriate inferences?

    At any rate, thank you for providing an ontology to reproduce your results. I was able to load it into Protégé, run the Pellet reasoner, and I can get the following inferences:

    Blood_Sugar_1 triggerService Service_1
    Blood_Sugar_1 hasStatut "High"^^string
    Blood_Sugar_1 hasStatut "150"^^int
    

    blood sugar results

    While Pellet is able to compute all of these inferences, Protégé only shows inferences for object properties by default; you have to go into the Reasoner > Configure… menu and makes sure that under the "Displayed Individual Inferences" section the "Data Property Assertions" option is checked. Turning on the Pellet reasoner and setting this option is described in more detail in my answer to Ontology property definition in Protégé-OWL / SWRL.

    reasoner configuration option

    0 讨论(0)
提交回复
热议问题