On 25/03/13 17:19, Pastrana, Rodrigo (RIS-BCT) wrote:
In order to use Jena's API to navigate RDF graphs, I need to know how
this particular node is represented. If the node were a literal,  its
literallexicalform would be sufficient. Since the node is represented
as an instance of "Resource" the node's label is the namespace + the
localname. However, "http://www.govtrack.us/data/photos/410069."; Is
clearly not a NS, and "jpeg" is not its local name.

Using Jena's API how can one determine if the given "Resource" node
can represented by its literallexicalform, or by its
namespace+localname. Thanks.

The full URI should be what you use to determine if two Resources are the same. Namespace/localpart are just syntactic convenience - the code keeps and indexes URIs only.

For literals, you need to test the language or datatype as well.

"123" is not the integer 123.

You can use .equals (of RDFNode, the supertype of Resource and Literal)

A Resource is a URI or a blank node.

RDFNode has isLiteral()/isURIResource()/isResource()/isAnon() for testing what kind of thing an RDFNode is.

By XML, ("http://www.govtrack.us/data/photos/410069.","jpeg";) is a qname - in fact the one with the longest local part.

This is a qname ("http://www.govtrack.us/data/photos/410069.jp";, "eg") for the same URI.

Because "410069.jpeg" is illegal as an XML qname local part, it is not returned by Jena.

Roll on Turtle ...

        Andy

Reply via email to