Hi there,
On 13/03/18 16:14, Nicky van Oorschot wrote:
Hi All,
I have been working on a application in which we would like to find
triples based on a uri (which could be a subject or a blanknode).
Subjects have been working fine, blanknodes have been causing issues.
We work with stardog as graphstore behind the application. In stardog
requesting a blanknode using a Describe and a construct query works
fine. I understand that the implementation of describe varies among
implementations and JENA does not accept a blanknode in a describe query:
DESCRIBE _:b0 and DESCRIBE <_:b0>
Cause:
HTTP 400 error making the query: Bad Request
Where is that error coming from?
It parses in Jena but <_:label> is Jena-specific syntax for Jena blank
nodes. It is not portable to arbitrary other systems.
Also - the _:b0 is not the Jena blank node label anyway. It is a
file-scoped label and not the one used internally.
Internally, labels look like:
7910f8c9-10ce-49d3-8771-8cb3eaa7237b
and sometimes appear encoded with leading B and X2D for "-".
_:B7910f8c9X2D10ceX2D49d3X2D8771X2D8cb3eaa7237b
No standard SPARQL or RDF syntax supports blank identity.
This isn't specific to SPARQL.
The correct, standard, portable, way is to re-find the blank node or not
use blank nodes and use UUID URIs instead or skolemize the data
https://www.w3.org/TR/rdf11-concepts/#section-skolemization
You may also be interested in:
https://issues.apache.org/jira/browse/JENA-1490
which it work towards blank node round-tripping for Fuseki. If there is
a way to extend to other systems, then the project would welcome a
contribution but without knowing how to send blank nodes over the
network, it's a bit tricky. The ideal way is the other system provide an
RDFConnection to manage the internal details of their system and as it
evolves.
See also:
https://groups.google.com/a/stardog.com/forum/#!topic/stardog/gBHSew7YUYs
which is not right on the point about ":" in blank node labels (that
changed in Jena the past 6 years!) but suggests <_:> was supported.
Andy
Using a construct query another issue ruins my idea.
It does not matter how I create the query as a string or using a
ParameterizedSparqlString.
The query which gives the results which I need are given to me by
Stardog using:
CONSTRUCT {<_:b0> ?p ?o} WHERE {<_:b0> ?p ?o}
However I am not able to get this query to the graphstore through JENA.
JENA always parse the query to:
CONSTRUCT
{
_:c0 ?p ?o .
}
WHERE
{ _:b0 ?p ?o }
Which of course gives total different results. How would I be able to
get the right query to the graphstore through JENA?
Met Vriendelijke Groet / With Kind Regards
Nicky van Oorschot
Twitter: @nickyvoorschot
Netage
_http://netage.nl_ <http://netage.nl/>
M.A. Reinaldaweg 79
3461AJ Linschoten
tel. +31(0)6-20335266