I have an ontology with a lot of individuals and use the Jena reasoner to get information about them. My goal is to create new individuals based on the given information inside of that rules and assign properties to them. The individuals don't have to be named, but they need a type and have to be part of a few properties. At the moment I can create anonymous individuals (with the help of a mailing list post), but I can only give them one type, or one property.
Here's a little example of my problem; my rule looks like this (the ontology and inferred result can be found at the bottom):
[test2: (?X rdf:type NS:Test1) ->
[(?Y rdf:type NS:Test2) <- makeSkolem(?Y, ?X)]]
It means when a Test1 individual is found, then a new blank node is created and then the type Test2 is given to that node. It works fine, but i want to give this new individuals a classification and a pointer(property) to ?X (the Test1 individuals).
Something like the following doesn't work, since "backward rules only allow one head clause". Every clause for its one works perfectly fine though.
[test2: (?X rdf:type NS:Test1) ->
[(?Y rdf:type NS:Test2), (?Y NS:hasClassification 'test'), <- makeSkolem(?Y, ?X)]]
This is my ontology:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns="file:/Test#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" >
<rdf:Description rdf:about="file:/Test#hasClassification">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test#TestProp">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test#testInd">
<rdf:type rdf:resource="file:/Test#Test1"/>
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test#testInd2">
<rdf:type rdf:resource="file:/Test#Test1"/>
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test#Test1">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test#Test2">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Ontology"/>
</rdf:Description>
</rdf:RDF>
This is the result with the first rule (blank nodes with IDs A0
and A1
are the new individuals):
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns="file:/Test#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" >
<rdf:Description rdf:about="file:/Test#hasClassification">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/>
</rdf:Description>
<rdf:Description rdf:nodeID="A0">
<rdf:type rdf:resource="file:/Test#Test2"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test#TestProp">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test#testInd">
<rdf:type rdf:resource="file:/Test#Test1"/>
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test#testInd2">
<rdf:type rdf:resource="file:/Test#Test1"/>
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test#Test1">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test#Test2">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
</rdf:Description>
<rdf:Description rdf:nodeID="A1">
<rdf:type rdf:resource="file:/Test#Test2"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Ontology"/>
</rdf:Description>
</rdf:RDF>