Create iri nodes in Java - Values.iri

I'm having a problem - probably a misunderstanding, possibly a bug - using Values.statement and .iri to insert data into stardog. I created a short example to try to figure out what I was doing wrong. I think it also illustrates my problem nicely:

aConn.begin();	
				final Statement aStatement = Values.statement(
						Values.iri("http://purl.org/rail/simulator/Test#testting")
						,Values.iri("rdf:type")
						,Values.iri("http://purl.org/rail/simulator/Test")
						,(Resource) Values.iri(URIs.BraveDataModelBase));
				aConn.add().statement( aStatement);
				final Statement idStatement = Values.statement(
						Values.iri("http://purl.org/rail/simulator/Test#testting")
						,Values.iri("rdf:id")
						,Values.literal("uniqueID")
						,(Resource) Values.iri(URIs.BraveDataModelBase));
				aConn.add().statement(idStatement);
		
		aConn.commit();

This produces the following RDF (exported from stardog):

<http://purl.org/rail/simulator/Test#testting> <rdf:type> <http://purl.org/rail/simulator/Test> ;
  <rdf:id> "uniqueID" .

As you might assume I was hoping for rdf:type and rdf:id NOT having "<" and ">" as if they are uri's.
How should I be creating the triples?

You can get the rdf:type IRI directly from the com.stardog.stark.vocabs.RDF class. Otherwise, the prefix declaration isn't recognized in the string passed to Values.iri() so you must expand it and pass the full IRI.

Many thanks, how might I go about adding some prefixes (such as rdf)?

Prefixes are not recognized in these calls. You can do:

Values.iri("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "type");

Or

Values.iri(com.stardog.stark.vocabs.RDF.NAMESPACE, "type");

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.