On 19/12/2018 12:43, Stefano Mariani wrote:
Hi Andy,
Many thanks for your prompt reply.
Mine is below.
It's OpGraph for GRAPH.
Thanks. Any documentation reference?
To understand the algebra, I suggest looking at the code.
You don't need to manaipulate the algebra to build querys. Jena has both
a parameterized querystring (for templating) and a query builder
https://jena.apache.org/documentation/query/parameterized-sparql-strings.html
https://jena.apache.org/documentation/extras/querybuilder/index.html
I tried the code in updated gist (lines 37-41) but I get error
org.apache.jena.sparql.ARQInternalErrorException:
QueryIterGraphInner.buildIterator: Not a URI or blank node: {?b
@<http://purl.org/dc/elements/1.1/title> ?title}
Node_Graph is unrelated. It is a placeholder for "graphs within graphs"
(N3 formulae) not for named graphs.
As the javadoc says:
"""
* For experimentation.
* Otherwise, unsupported.
"""
For named graphs, the first argument is a graph name - usually a URI,
sometimes a blank node (JSON-LD). e.g.
<file:src/main/resources/dataset-named-graph-1.ttl>
The dc:date is in the default graph so will not match something inside
GRAPH.
Try this:
q = QueryFactory.create(
"SELECT * { { ?s ?p ?o } UNION { GRAPH ?g { ?s ?p ?o } } }");
to see the dataset structure and the values of ?g
I can't see where the dataset is loaded.
Sorry, I missed that line during copy/paste from my actual code, now the gist
is updated (line 14)
The code in the gist does not compile. There are several compile time
errors.
Please - a complete, minimal example, including the data.
Andy
You don't get a "title" because the BGP is "?g dc:date ?date". Just adding it
to project doesn't cause it to be set.
I imagine title will be set when I understand how to specify the GRAPH part of
the query.
Sorry for the many questions, but documentation is extremely lacking in ARQ
coverage :/
--------------------------------------------------------------------------------------------------------------------
Stefano Mariani, PhD
Fixed-term research assistant (post-doc)
@ Department of Sciences and Methods for Engineering – University of Modena and
Reggio Emilia
> [email protected]
> http://personale.unimore.it/AddressBook/Home/s.mariani
--------------------------------------------------------------------------------------------------------------------