On 09/07/18 22:51, Michal Rohacek wrote:
Hi there,
thank you for your quick support!

I changed all the URIs to absolute URIs (full file path in format
"file:///C:/path/to/file/ds-ng-1.ttl") and now it works - in windows cmd,
as well as in Java code.

My question is, is this the only way for me to execute this kind of
queries,

JENA-1575
https://issues.apache.org/jira/browse/JENA-1575

This restores the old (from some time ago) behaviour whereby the URIs on the command line are resolved (turned into absolute URIs).

RDF never has relative URIs - it's serialisation might but when parsed/read-in the URios are tuened into absolute URIs

    Andy

or is there a solution which makes me able to use the "relative"
URIs in cases like this one? Is there any fix to force the program to
expand the URI or whatever - simply, for me, to be able to use these
features like it is being used in the tutorial?

Just because this :
sparql.bat --graph dft.ttl --namedgraph 1.ttl --namedgraph 2.ttl --query
q.rq

is much more compact and tidy like this one:
sparql.bat --graph dft.ttl --namedgraph
file:///C:/very/long/and/awful/path/to/file/1.ttl --namedgraph
file:///C:/very/long/and/awful/path/to/file/2.ttl --query q.rq

Thank you in advance.
Michal

2018-07-09 22:42 GMT+02:00 Andy Seaborne <[email protected]>:

Michal,

It looks like the use of "--namedgraph" isn't expanding the URI

In "--namedgraph ds-ng-1.ttl", "ds-ng-1.ttl" isn't an absolute URI and it
isn't being expanded. If it had, it would be file:///whatever/ds-ng-1.ttl
and because <.> is really <file:///whatever/> it would be abbreviated.

A work aroung is to use file://$PWD/ds-ng-1.ttl (Linux, MacOS) or the
Windows equivalent.

When a query is parsed,  GRAPH :ds-ng-1.ttl is expanded.

You might find it helpful to try the queries without "PREFIX  : <.>" so
the full URIs are printed.

If you get FILE in the --namedgraph FILE to be the absolute URI (same
characters) then the abbreviation should work.

     Andy


On 08/07/18 22:57, michal.r.256 wrote:

Good evening,
I am trying to get through the tutorial (I am beginner) and I am
experiencing unexpected behavior of these queries (even if Im copypasting
the tutorials):
Here is the link to referenced tutorial page:
https://jena.apache.org/tutorials/sparql_datasets.html

First attempt, this query works fine:

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX : <.>

SELECT *
{ ?s ?p ?o }

Results:

----------------------------------------------------------------------
| s            | p       | o                                         |
======================================================================
| :ds-ng-2.ttl | dc:date | "2005-09-22T05:53:05+01:00"^^xsd:dateTime |
| :ds-ng-1.ttl | dc:date | "2005-07-14T03:18:56+01:00"^^xsd:dateTime |
----------------------------------------------------------------------

Second, this works pretty good too:

PREFIX  xsd:    <http://www.w3.org/2001/XMLSchema#>
PREFIX  dc:     <http://purl.org/dc/elements/1.1/>
PREFIX  :       <.>

SELECT *
{
      { ?s ?p ?o } UNION { GRAPH ?g { ?s ?p ?o } }
}

Results not absolutely the same (the referenced named graph names are not
exactly the same in the first and the third column (the colon missing and
the <> instead), and I was not able to change this, although I was trying
pretty hard as I thought that there could be the cause of my issue)

------------------------------------------------------------
---------------------------------
| s            | p        | o                                         |
g                   |
============================================================
=================================
| :ds-ng-2.ttl | dc:date  | "2005-09-22T05:53:05+01:00"^^xsd:dateTime |
                    |
| :ds-ng-1.ttl | dc:date  | "2005-07-14T03:18:56+01:00"^^xsd:dateTime |
                    |
| _:b0         | dc:title | "Harry Potter and the Chamber of Secrets" |
<ds-ng-1.ttl> |
| _:b1         | dc:title | "Harry Potter and the Philospher's Stone" |
<ds-ng-1.ttl> |
| _:b2         | dc:title | "Harry Potter and the Sorcerer's Stone"   |
<ds-ng-2.ttl> |
| _:b3         | dc:title | "Harry Potter and the Chamber of Secrets" |
<ds-ng-2.ttl> |
------------------------------------------------------------
---------------------------------

Now, this query is the first that doesnt work at all:

PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX : <.>

SELECT ?title
{
    GRAPH :ds-ng-2.ttl
      { ?b dc:title ?title }
}

Results are blank all the time:
---------
| title |
=========
---------

Same result with this query:

PREFIX  xsd:    <http://www.w3.org/2001/XMLSchema#>
PREFIX  dc:     <http://purl.org/dc/elements/1.1/>
PREFIX  :       <.>

SELECT ?date ?title
{
    ?g dc:date ?date . FILTER (?date > "2005-08-01T00:00:00Z"^^xsd:dateTime
)
    GRAPH ?g
        { ?b dc:title ?title }
}

I have tried many things I googled out (but no exact solution for this
problem) and nothing worked, I have no idea what could be wrong.

Thanks for every support.



Reply via email to