# Create iri nodes in Java - Values.iri

**URL:** <https://community.stardog.com/t/create-iri-nodes-in-java-values-iri/1996>\
**Category:** Support\
**Created:** [October 9, 2019, 3:17pm UTC](https://community.stardog.com/t/create-iri-nodes-in-java-values-iri/1996 "2019-10-09T15:17:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisBham](https://avatars.discourse-cdn.com/v4/letter/c/41988e/32.png) [@ChrisBham](https://community.stardog.com/u/ChrisBham)\
**Post date:** [October 9, 2019, 3:17pm UTC](https://community.stardog.com/t/create-iri-nodes-in-java-values-iri/1996/1 "2019-10-09T15:17:27Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jess](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/jess/32/10_2.png) [@jess](https://community.stardog.com/u/jess)\
**Post date:** [October 9, 2019, 3:19pm UTC](https://community.stardog.com/t/create-iri-nodes-in-java-values-iri/1996/2 "2019-10-09T15:19:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ChrisBham](https://avatars.discourse-cdn.com/v4/letter/c/41988e/32.png) [@ChrisBham](https://community.stardog.com/u/ChrisBham)\
**Post date:** [October 9, 2019, 3:25pm UTC](https://community.stardog.com/t/create-iri-nodes-in-java-values-iri/1996/3 "2019-10-09T15:25:33Z")

</div>

> [@jess](#):
>
> Otherwise, the prefix declaration isn't recognized in the string passed to `Values.iri()`

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

---

<div class="post-metadata">

**Author:** ![jess](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/jess/32/10_2.png) [@jess](https://community.stardog.com/u/jess)\
**Post date:** [October 9, 2019, 3:35pm UTC](https://community.stardog.com/t/create-iri-nodes-in-java-values-iri/1996/4 "2019-10-09T15:35:23Z")

</div>

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

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

```

Or

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

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [October 23, 2019, 3:35pm UTC](https://community.stardog.com/t/create-iri-nodes-in-java-values-iri/1996/5 "2019-10-23T15:35:37Z")

</div>

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