Is it possible to add a rule in Jena which defines the type of an individual?
For example
String r;
r = "[rule1: (?a example:drives ?b), (?b rdf:type example:Truck) ->
(?a rdf:type example:TruckDriver)]";
//then parse and send to reasoner...etc
All of the examples and documentation I found online uses custom rules to assign relationships between individuals (object properties) as opposed to this rule which is used to assign an individual to a class.
All of the examples and documentation I found online uses custom rules to assign relationships between individuals (object properties) as opposed to this rule which is used to assign an individual to a class.
Actually, the documentation Reasoners and rule engines: Jena inference support gives examples of some rules that introduce triples whose property is rdf:type
. Eg (from that document), there's a rule for RDFS reasoning that says, "when ?x
is related to ?y
by a property ?p
with domain ?c
, then ?X
has type ?c
:"
[rdfs2: (?x ?p ?y), (?p rdfs:domain ?c) -> (?x rdf:type ?c)]
In that same example block, there two more rules whose heads have triples using rdf:type
:
[rdfs3: (?x ?p ?y), (?p rdfs:range ?c) -> (?y rdf:type ?c)]
[rdfs9: (?x rdfs:subClassOf ?y), (?a rdf:type ?x) -> (?a rdf:type ?y)]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.