Hi kamil, It appears that you asked this exact question a day or two ago, and I replied [1] to that posting. Did that approach work for you? If not, can you say what didn't work for you? Perhaps the issues can be addressed.
//JT [1] http://mail-archives.apache.org/mod_mbox/jena-users/201308.mbox/%3CCA%2BQ4Jnn7hE8EQDZFbbSP73bzFQ0ACSJdBVY%3DrQUV_Q5g-BoMWA%40mail.gmail.com%3E On Fri, Aug 16, 2013 at 6:45 PM, kamil <[email protected]> wrote: > Dear Jena experts, > > our team is developing a game where the game status is represented by an > ontology and the game logic is represented by rules. > We want to use the Jena reasoning in the first place and maybe switch to > a reasoner later on. > > Currently I am looking for a rule that creates new NAMED individuals. > > my 1st try was: > @prefix pre: <http://anarxim.net/world/test.owl#>. > [growTree:(?a rdf:type pre:AppleSeed) (?b rdf:type pre:Soil) (?c > rdf:type pre:Water)(?b pre:contains ?a) (?b pre:contains ?c) (?s > rdf:type pre:Sun) (?s pre:shinesOn ?b) makeTemp(?tree) -> print ('tree > name: ' + ?tree) (?tree rdf:type pre:AppleTree) (?tree rdf:about pre:tree1)] > > Although i get same cryptic string from the print statement: > > 'tree name: ' + -7c9954a7:1406f1f250f:-7ffc > 'tree name: ' + -7c9954a7:1406f1f250f:-7ffb > > Jena throws an exception when I try to use rdf:about in a triple. > Exception in thread "main" > com.hp.hpl.jena.shared.InvalidPropertyURIException: rdf:about > > My 2nd try was to use makeInstance in a backward rule. > > @prefix pre: <http://anarxim.net/world/test.owl#>. > [growTree: makeInstance(?b, pre:hasOntop, ?tree) <- (?a rdf:type > pre:AppleSeed) (?b rdf:type pre:Soil) (?c rdf:type pre:Water)(?b > pre:contains ?a) (?b pre:contains ?c) (?s rdf:type pre:Sun) (?s > pre:shinesOn ?b) ] > > > This is syntacticly correct but does not result in a named Individual in > the Ontology > > My 3rd try was to write a hybrid rule: > > @prefix pre: <http://anarxim.net/world/test.owl#>. > [growTree: (?a rdf:type pre:AppleSeed) (?b rdf:type pre:Soil) (?c > rdf:type pre:Water)(?b pre:contains ?a) (?b pre:contains ?c) (?s > rdf:type pre:Sun) (?s pre:shinesOn ?b) -> [(?tree rdf:type > pre:AppleTree) <- makeInstance(?b, pre:hasOntop, pre:Soil ?tree) ]] > > This resultst a least in a > > <j.0:AppleTree/> > > in the ontology but it has neither an rdf:about-attribute nor is it > bound to something. > > I would be very grateful if someone gives me a hint. > > Thanks in advance. > > > Kamil -- Joshua Taylor, http://www.cs.rpi.edu/~tayloj/
