stardog-groovy insert and query question

3 views
Skip to first unread message

Daniel Stieglitz

unread,
Jun 19, 2013, 12:00:48 PM6/19/13
to sta...@clarkparsia.com
Hi folks, and specifically Al,

I'm trying to do a simple insert/query using Stardog groovy and I can't seem to get the data specified correctly. For example:


followed by

stardog.query("PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

select ?x WHERE { ?x a rdfbb:Team. }", { println it })

returns nothing.

Am I data-typing something incorrectly here? Do I need to use ValueFactoryImpl to create the object reference?

Dan

Stephen Nowell

unread,
Jun 19, 2013, 12:11:14 PM6/19/13
to sta...@clarkparsia.com
Hi Dan,

When performing an insert with Stardog Groovy, the < > characters are
not needed to denote a URI. In fact, for the subject and predicate, it
is assumed that the string being passed in represents a URI. In the
case of the object, it will assume it it being given a literal unless
you denote a URI by passing in a java.net.URI. The following insert
should give you the results you want:

stardog.insert(["http://www.stainlesscode.com/rdfbb#Washington_Nationals",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type", new
java.net.URI("http://www.stainlesscode.com/rdfbb#Team")])

Hope this helps!
-Stephen
> --
> -- --
> You received this message because you are subscribed to the C&P
> "Stardog" group.
> To post to this group, send email to sta...@clarkparsia.com
> To unsubscribe from this group, send email to
> stardog+u...@clarkparsia.com
> For more options, visit this group at
> http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en
>
>

Daniel Stieglitz

unread,
Jun 19, 2013, 12:15:21 PM6/19/13
to sta...@clarkparsia.com, ste...@clarkparsia.com
Yes, that helped a lot, thanks Stephen.

As an aside, you can convert Strings to URIs using the shortcut

Reply all
Reply to author
Forward
0 new messages