Thanks Ian. Really kind of you to take the time to illustrate this. Mona -----Original Message----- From: Ian Dickinson [mailto:[email protected]] Sent: Monday, September 16, 2013 3:49 PM To: [email protected] Subject: Re: blank node question
Hi Mona, On Mon, Sep 16, 2013 at 10:15 PM, Mona Salem <[email protected]> wrote: > Resource johnSmith > = model.createResource(personURI > .addProperty(VCARD.FN, fullName) > .addProperty(VCARD.N, > model.createResource() > .addProperty(VCARD.Given, bNode0) > .addProperty(VCARD.Family, bNode1)); > > > Regarding the VCARD.N: does the N need to be defined somewhere? Yes. Jena has a few built-in vocabulary classes, and (a rather old) version of vcard is one of them. See: http://jena.apache.org/documentation/javadoc/jena/com/hp/hpl/jena/vocabulary /VCARD.html There's no particular reason why vcard is a built-in vocabulary (unlike, say, RDF and RDFS which are very helpful to application writers). I suspect it was initially added to Jena to make it easier to write the tutorials! vcard:N is an RDF property denoting the name of a thing. See the definition here: http://www.w3.org/TR/vcard-rdf/#Identification_Properties so the code: .addProperty(VCARD.N, <thing> ) is adding a triple with the given subject resource, predicate vcard:N and object a blank node resource created by the createResource() call. I think that, as a tutorial, this code isn't as clear as it could be. Rewriting it step-by-step, what's really happening is this: Resource bNode3 = model.createResource(); bNode3.addProperty(VCARD.Given, bNode0); bNode3.addProperty(VCARD.Family, bNode1)); Resource johnSmith = model.createResource( personURI ); johnSmith.addProperty(VCARD.FN, fullName); johnSmith.addProperty(VCARD.N, bNode3 ); As originally written, it's perhaps more idiomatic Java, but it's also harder for beginners to understand. Anyway, I hope it's clearer now. > Is this the correct way to ask questions, by sending to the users > email address? Yes. Welcome to jena-users! You don't need to quote an old question, unless your comment is a response to that previous thread. Ian
