Hello I revised the question, so that you can better understand what I want to do.

My code consists of some steps that I have to do. On step 1 I am submitting a query and I am getting some results back. However those results have this form: http://dbpedia.org/resource/Peter etc etc etc

This means that if I want to pass those results and use them with the next step (next query) then I have to put each one of the results inside < > in order to avoid getting an Exception from Jena.

My question is, is it possibly with a function from Jena or something similar, that I am not obligated to always add <> and instead the http://dbpedia.org/resource/ part of the URI automatically be changed with its prefix before the new query that contains this URI is submitted?

I know that the complete URI and one possible prefix of this URI are the exact the same thing. I was thinking to find something more efficient than having to parse all my result set and add to each result the <> in order to be parsed as URI from the query.

Thank you for your time :)

EDIT:

I am seeing the problem when using the VALUES clause on my queries. There I have a list of elements, lets say:

VALUES ?subject { http://dbpedia.org/resource/John http://dbpedia.org/resource/Peter }

and even though the query contains the PREFIX for dbpedia, the URIS are not changed to their prefixes and the query is processed with the above values inside the VALUES clause, causing an exception from Jena since the URIs must be enclosed with < >

I hope this helps even more. Thanks again!

asked 08 Jan '13, 05:57

Christos's gravatar image

Christos
15417
accept rate: 33%

edited 08 Jan '13, 11:06


You need to show more code before your question is answerable, for example what does the ExecuteTheQuery() method do.

Btw dbpedia:Peter vs <http://dbpedia.org/resource/Peter> the former is simply a human friendly syntax compression, assuming the appropriate namespace the two are exactly equivalent.

There are ways that you can have Jena turn it's internal representation of RDF terms (which are always in the full URI form) back into the human friendly form for presentation purposes, if you show some code we can likely point you in the right direction for this..

link

answered 08 Jan '13, 06:05

Rob%20Vesse's gravatar image

Rob Vesse ♦
13.6k1715
accept rate: 29%

Using prefixes is just about representation - the data always has http://dbpedia.org/resource/Peter in it.

Some of the ResultSetFormatter operations take the query as argument and use the queries prefixes to present the results. In code, when you do .getXXXX("var") you get the real resource, with full URI. Your app then needs to use the prefixes to abbreviate it for presentation.

link

answered 08 Jan '13, 07:23

AndyS's gravatar image

AndyS ♦
13.0k37
accept rate: 32%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×578
×17

Asked: 08 Jan '13, 05:57

Seen: 730 times

Last updated: 08 Jan '13, 11:06