Я получил совет от предыдущего вопроса и изменил источник. Тем не менее, источник по-прежнему не работает должным образом.
Я использую GraphDB (RuleSet: OWL2-RL) и SPARQL.
У меня есть онтология с классами Person и Animal_Lover. Люди Animal_Lover, если у них более 2 питомцев.
Как я могу сделать это в моей онтологии?
<?xml version="1.0"?> <rdf:RDF xmlns="http://www.example.com/test" xmlns:test="http://www.example.com/test#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:owl="http://www.w3.org/2002/07/owl#" 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#"> <owl:Ontology rdf:about="http://www.example.com/test"/> <owl:ObjectProperty rdf:about="http://www.example.com/test#hasOwner"> <owl:inverseOf rdf:resource="http://www.example.com/test#hasPet"/> </owl:ObjectProperty> <owl:ObjectProperty rdf:about="http://www.example.com/test#hasPet"> <owl:inverseOf rdf:resource="http://www.example.com/test#hasOwner"/> </owl:ObjectProperty> <owl:Class rdf:about="http://www.example.com/test#Animal_Lover"> <owl:equivalentClass> <owl:Restriction> <owl:onProperty rdf:resource="http://www.example.com/test#hasPet"/> <owl:minQualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">2</owl:minQualifiedCardinality> <owl:onClass rdf:resource="http://www.example.com/test#Mammal"/> </owl:Restriction> </owl:equivalentClass> <rdfs:subClassOf rdf:resource="http://www.example.com/test#Person"/> </owl:Class> <owl:Class rdf:about="http://www.example.com/test#Mammal"/> <owl:Class rdf:about="http://www.example.com/test#Dog"> <rdfs:subClassOf rdf:resource="http://www.example.com/test#Mammal"/> <owl:disjointWith rdf:resource="http://www.example.com/test#Person"/> </owl:Class> <owl:Class rdf:about="http://www.example.com/test#Person"> <rdfs:subClassOf rdf:resource="http://www.example.com/test#Mammal"/> <owl:disjointWith rdf:resource="http://www.example.com/test#Dog"/> </owl:Class> <owl:NamedIndividual rdf:about="http://www.example.com/test#Lulu"> <rdf:type rdf:resource="http://www.example.com/test#Dog"/> <test:hasOwner rdf:resource="http://www.example.com/test#Smith"/> </owl:NamedIndividual> <owl:NamedIndividual rdf:about="http://www.example.com/test#Tank"> <rdf:type rdf:resource="http://www.example.com/test#Dog"/> <test:hasOwner rdf:resource="http://www.example.com/test#Smith"/> </owl:NamedIndividual> <owl:NamedIndividual rdf:about="http://www.example.com/test#Nala"> <rdf:type rdf:resource="http://www.example.com/test#Dog"/> <test:hasOwner rdf:resource="http://www.example.com/test#Smith"/> </owl:NamedIndividual> <owl:NamedIndividual rdf:about="http://www.example.com/test#Smith"> <rdf:type rdf:resource="http://www.example.com/test#Person"/> <test:hasPet rdf:resource="http://www.example.com/test#Lulu"/> <test:hasPet rdf:resource="http://www.example.com/test#Nala"/> <test:hasPet rdf:resource="http://www.example.com/test#Tank"/> </owl:NamedIndividual> <rdf:Description> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#AllDifferent"/> <owl:distinctMembers rdf:parseType="Collection"> <rdf:Description rdf:about="http://www.example.com/test#Lulu"/> <rdf:Description rdf:about="http://www.example.com/test#Nala"/> <rdf:Description rdf:about="http://www.example.com/test#Smith"/> <rdf:Description rdf:about="http://www.example.com/test#Tank"/> </owl:distinctMembers> </rdf:Description> </rdf:RDF>
Я хочу, чтобы Смит был выведен и стал Animal_Lover. Но этот код не работает в OWL (или GraphDB). В чем проблема?