OWL2 has the notion of NamedIndividuals, meaning individuals
identified by IRIs, though I'm not sure that's what you're talking
about here.  For those named individuals, you need to create the same
RDF triples that are used to serialize named individuals in OWL.
According to 2.6 Declarations [1] of the OWL 2 Web Ontology Language
Quick Reference Guide, this means adding a triple "aN rdf:type
owl:NamedIndividual".

It sounds like you're just trying to create a non-anonymous resource,
which is a bit simpler.  Your first case successfully creates an
anonymous individual, which is good. In the second case, the rule will
never fire, because backwards chaining rules are selected based on
their head, and there nothing to select for in your case.  In your
third case, you should note that rdf:about is not a property that
should be used in a triple in an RDF model, but it is rather used in
the RDF/XML serialization of RDF to indicate the URL of a resource
that an XML element corresponds to. You mention that

  <j.0:AppleTree/>

appears in the (RDF/XML serialization of your) ontology which means
that there's a blank node that has the type AppleTree, which is good,
but it's still a blank node, which is not what you want.  According to
the builtin documentation [2], both makeTemp and makeInstance return
blank nodes. In your case, what you'll want is either to use the URI
directly (if you know it) in which case you're not really creating
anything, or uriConcat to construct a URI node.  For instance, to
concatenate http://example.org  and "ATree", you can use uriConcat and
bind the result to ?tree, and then assert triples about ?tree in the
head.

[uriConcat(http://www.example.org/, "ATree",?tree)
 -> (?tree growsIn Brooklyn)]

//JT

[1] http://www.w3.org/TR/owl2-quick-reference/#Declarations
[2] http://jena.apache.org/documentation/inference/#RULEbuiltins

On Sat, Aug 17, 2013 at 6:48 AM, kamil <donkamillo1...@gmx.de> 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/

Reply via email to