Discussion:
command line sparql: --namedGraph clobbers --data?
Osma Suominen
2016-11-14 11:12:44 UTC
Permalink
Hi,

I noticed a behavior change in the Jena 3.1.1 sparql command line tool.
I wonder if this is intentional?

With 3.1.0 I could combine --data and --namedGraph like this:
sparql --data example.nt --namedGraph namedgraph.nt --query query.rq

Here are the contents of the files:

example.nt:
<http://example.org/subj> <http://example.org/prop>
<http://example.org/obj>

namedgraph.nt:
<http://example.org/graph> <http://example.org/prop>
<http://example.org/obj> .

query.rq:
SELECT * { ?s ?p ?o }


The result using Jena 3.1.0:
------------------------------------------------------------------------------------
| s | p | o
|
====================================================================================
| <http://example.org/subj> | <http://example.org/prop> |
<http://example.org/obj> |
------------------------------------------------------------------------------------


Result with Jena 3.1.1:
-------------
| s | p | o |
=============
-------------


I get the intended result (the triple from example.nt) with this command
which uses --graph instead of --data:

sparql --graph example.nt --namedGraph namedgraph.nt --query query.rq


So it seems that when combined with a --namedGraph option, the data
specified using --data no longer ends up in the default graph with Jena
3.1.1. If I remove the --namedGraph option, then the problem disappears
and the file specified by --data does end up in the default graph.

I can easily work around this by not using this combination of options
(after all, --graph is the more explicit way of loading data into the
default graph), I was just surprised when a script broke because of this
change.

-Osma
--
Osma Suominen
D.Sc. (Tech), Information Systems Specialist
National Library of Finland
P.O. Box 26 (Kaikukatu 4)
00014 HELSINGIN YLIOPISTO
Tel. +358 50 3199529
***@helsinki.fi
http://www.nationallibrary.fi
Andy Seaborne
2016-11-14 17:28:49 UTC
Permalink
Osma,

Could you raise a JIRA so this does not get overlooked?

Thanks

Andy
Post by Osma Suominen
Hi,
I noticed a behavior change in the Jena 3.1.1 sparql command line tool.
I wonder if this is intentional?
sparql --data example.nt --namedGraph namedgraph.nt --query query.rq
<http://example.org/subj> <http://example.org/prop>
<http://example.org/obj>
<http://example.org/graph> <http://example.org/prop>
<http://example.org/obj> .
SELECT * { ?s ?p ?o }
------------------------------------------------------------------------------------
| s | p | o |
====================================================================================
| <http://example.org/subj> | <http://example.org/prop> |
<http://example.org/obj> |
------------------------------------------------------------------------------------
-------------
| s | p | o |
=============
-------------
I get the intended result (the triple from example.nt) with this command
sparql --graph example.nt --namedGraph namedgraph.nt --query query.rq
So it seems that when combined with a --namedGraph option, the data
specified using --data no longer ends up in the default graph with Jena
3.1.1. If I remove the --namedGraph option, then the problem disappears
and the file specified by --data does end up in the default graph.
I can easily work around this by not using this combination of options
(after all, --graph is the more explicit way of loading data into the
default graph), I was just surprised when a script broke because of this
change.
-Osma
Osma Suominen
2016-11-15 07:08:05 UTC
Permalink
Hi Andy,

Sure thing! https://issues.apache.org/jira/browse/JENA-1261

-Osma
Post by Andy Seaborne
Osma,
Could you raise a JIRA so this does not get overlooked?
Thanks
Andy
Post by Osma Suominen
Hi,
I noticed a behavior change in the Jena 3.1.1 sparql command line tool.
I wonder if this is intentional?
sparql --data example.nt --namedGraph namedgraph.nt --query query.rq
<http://example.org/subj> <http://example.org/prop>
<http://example.org/obj>
<http://example.org/graph> <http://example.org/prop>
<http://example.org/obj> .
SELECT * { ?s ?p ?o }
------------------------------------------------------------------------------------
| s | p | o |
====================================================================================
| <http://example.org/subj> | <http://example.org/prop> |
<http://example.org/obj> |
------------------------------------------------------------------------------------
-------------
| s | p | o |
=============
-------------
I get the intended result (the triple from example.nt) with this command
sparql --graph example.nt --namedGraph namedgraph.nt --query query.rq
So it seems that when combined with a --namedGraph option, the data
specified using --data no longer ends up in the default graph with Jena
3.1.1. If I remove the --namedGraph option, then the problem disappears
and the file specified by --data does end up in the default graph.
I can easily work around this by not using this combination of options
(after all, --graph is the more explicit way of loading data into the
default graph), I was just surprised when a script broke because of this
change.
-Osma
--
Osma Suominen
D.Sc. (Tech), Information Systems Specialist
National Library of Finland
P.O. Box 26 (Kaikukatu 4)
00014 HELSINGIN YLIOPISTO
Tel. +358 50 3199529
***@helsinki.fi
http://www.nationallibrary.fi
Loading...