推断OWL中的A B C关系

时间:2018-06-11 08:20:34

标签: rdf owl protege rdfs

让我们说我们有3个人

A = John (Father -> Man -> Thing) 
B = Bob (Child -> Thing)
C = Mary (Mother -> Woman -> Thing)

Child
Father -> Man
Mother -> Woman

对象属性

hasSpouse (symmetric)
isFatherOf (in range of child)

然后我只断言A

John hasSpouse Mary
John isFatherOf Bob

是否有可能推断玛丽是鲍勃的另一个?

下面的代码只能推断"玛丽是母亲"通过告诉"母亲有一些父亲和#34;

enter image description here

enter image description here

enter image description here

但是我怎么能在bob的Object属性断言中推断出断言呢?

通过添加新的对象属性,然后对它们应用一些条件?

enter image description here



@prefix : <http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-4#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-4> .

<http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-4> rdf:type owl:Ontology .

#################################################################
#    Object Properties
#################################################################

###  http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-4#hasSpouse
:hasSpouse rdf:type owl:ObjectProperty ,
                    owl:SymmetricProperty .


###  http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-4#isFatherOf
:isFatherOf rdf:type owl:ObjectProperty ;
            rdfs:range :Child .


#################################################################
#    Classes
#################################################################

###  http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-4#Child
:Child rdf:type owl:Class .


###  http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-4#Father
:Father rdf:type owl:Class ;
        owl:equivalentClass [ rdf:type owl:Restriction ;
                              owl:onProperty :isFatherOf ;
                              owl:someValuesFrom :Child
                            ] ;
        rdfs:subClassOf :Man .


###  http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-4#Man
:Man rdf:type owl:Class .


###  http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-4#Mother
:Mother rdf:type owl:Class ;
        owl:equivalentClass [ rdf:type owl:Restriction ;
                              owl:onProperty :hasSpouse ;
                              owl:someValuesFrom :Father
                            ] ;
        rdfs:subClassOf :Woman .


###  http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-4#Woman
:Woman rdf:type owl:Class .


#################################################################
#    Individuals
#################################################################

###  http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-4#Bob
:Bob rdf:type owl:NamedIndividual .


###  http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-4#John
:John rdf:type owl:NamedIndividual ;
      :hasSpouse :Mary ;
      :isFatherOf :Bob .


###  http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-4#Mary
:Mary rdf:type owl:NamedIndividual .


###  Generated by the OWL API (version 4.2.8.20170104-2310) https://github.com/owlcs/owlapi
&#13;
&#13;
&#13;

OWL / XML

&#13;
&#13;
<?xml version="1.0"?>
<Ontology xmlns="http://www.w3.org/2002/07/owl#"
     xml:base="http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-4"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:xml="http://www.w3.org/XML/1998/namespace"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
     ontologyIRI="http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-4">
    <Prefix name="" IRI="http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-4#"/>
    <Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/>
    <Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
    <Prefix name="xml" IRI="http://www.w3.org/XML/1998/namespace"/>
    <Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/>
    <Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/>
    <Declaration>
        <Class IRI="#Father"/>
    </Declaration>
    <Declaration>
        <ObjectProperty IRI="#hasSpouse"/>
    </Declaration>
    <Declaration>
        <NamedIndividual IRI="#John"/>
    </Declaration>
    <Declaration>
        <Class IRI="#Man"/>
    </Declaration>
    <Declaration>
        <NamedIndividual IRI="#Mary"/>
    </Declaration>
    <Declaration>
        <Class IRI="#Mother"/>
    </Declaration>
    <Declaration>
        <NamedIndividual IRI="#Bob"/>
    </Declaration>
    <Declaration>
        <Class IRI="#Woman"/>
    </Declaration>
    <Declaration>
        <Class IRI="#Child"/>
    </Declaration>
    <Declaration>
        <ObjectProperty IRI="#isFatherOf"/>
    </Declaration>
    <EquivalentClasses>
        <Class IRI="#Father"/>
        <ObjectSomeValuesFrom>
            <ObjectProperty IRI="#isFatherOf"/>
            <Class IRI="#Child"/>
        </ObjectSomeValuesFrom>
    </EquivalentClasses>
    <EquivalentClasses>
        <Class IRI="#Mother"/>
        <ObjectSomeValuesFrom>
            <ObjectProperty IRI="#hasSpouse"/>
            <Class IRI="#Father"/>
        </ObjectSomeValuesFrom>
    </EquivalentClasses>
    <SubClassOf>
        <Class IRI="#Father"/>
        <Class IRI="#Man"/>
    </SubClassOf>
    <SubClassOf>
        <Class IRI="#Mother"/>
        <Class IRI="#Woman"/>
    </SubClassOf>
    <ObjectPropertyAssertion>
        <ObjectProperty IRI="#hasSpouse"/>
        <NamedIndividual IRI="#John"/>
        <NamedIndividual IRI="#Mary"/>
    </ObjectPropertyAssertion>
    <ObjectPropertyAssertion>
        <ObjectProperty IRI="#isFatherOf"/>
        <NamedIndividual IRI="#John"/>
        <NamedIndividual IRI="#Bob"/>
    </ObjectPropertyAssertion>
    <SymmetricObjectProperty>
        <ObjectProperty IRI="#hasSpouse"/>
    </SymmetricObjectProperty>
    <ObjectPropertyRange>
        <ObjectProperty IRI="#isFatherOf"/>
        <Class IRI="#Child"/>
    </ObjectPropertyRange>
</Ontology>



<!-- Generated by the OWL API (version 4.2.8.20170104-2310) https://github.com/owlcs/owlapi -->
&#13;
&#13;
&#13;

0 个答案:

没有答案