Hi, I think the rule would be basically
[r1: (?x rdf:type ex:RosterEntry), (?x ex:hasSignature ?sig), regex(?sig, '(.*) (.*)', ?first, ?last) -> (?x ex:hasFirstName ?first), (?x ex:hasLastName ?last), (?x rdf:type ex:Person) ) ] Note, it's untested and you have to define your prefix ex: in the rules file. You might also have to adapt the regex pattern to cover different white space chars. On 12.05.20 00:56, Kenneth Keefe wrote: > I am pretty new to using Jena and OWL. I have read many great tutorials > regarding RDF and OWL. The focus of those tutorials has largely been how to > structure the ontology and define restrictions on properties and such. > However, I have not been able to find good tutorials that explain how > inference is done and how I can define my own inference rules. I'm > wondering if I am simply not searching for the right thing. > > Regardless, here is a significant example that I think will really help me > get started with inference using Jena. I created a minimal example to > enable discussion. Here is a pastebin: https://pastebin.com/ScTGcbcZ > > The ontology has two classes, RosterEntry and Person and three data > properties, Signature (associated with RosterEntry), and FirstName and > LastName (both associated with Person). The example also has two > RosterEntry individuals with signatures of "Bob Smith" and "Sally Jones." > > I would like to write a rule that causes Jena to infer the following new > facts: > > <owl:Individual> >> <rdf:type >> rdf:resource="http://example.com/ont/roster/Person" /> >> <hasFirstName>Bob</hasFirstName> > <hasLastName>Smith</hasLastName> > > </owl:Individual> > > > <owl:Individual> >> <rdf:type >> rdf:resource="http://example.com/ont/roster/Person" /> >> <hasFirstName>Sally</hasFirstName> > <hasLastName>Jones</hasLastName> > > </owl:Individual> > > > How do I do that? Full answers or nudges in the right direction are both > very welcome. Thank you! > > Ken >
