The choice of prefixes in returned RDF is up to the server. IIRC the
prefixes are those in the storage with the ones from the query added.
Calculating which prefixes are actually used, given a large set of
prefixes needs a scan of the whole of the results before sending any
(RDF/XML, Turtle, TriG : JSON-LD @context is more complex).
Needing to buffer is not insignificant - keeping the option open for
streamed results (prefixes can be query or from the storage already) is
much more robust.
If the client side is parsing the RDF, it'll produce RDF triples and
only when displaying or saving do prefixes come into the picture. The
client can manage that.
If it's writing Fuseki results straight to disk, prefixes can be added
to the front of the file (easy for TTL and TriG).
Andy
On 27/02/18 12:08, Laura Morales wrote:
What I meant is that it can be a good idea to keep this feature on the client if
libraries can apply PREFIXes that I define on the client side. If I'm correct the results
that are returned by Fuseki contains only the same PREFIXes that were defined in the
input. But the results can have data with URLs whose prefixes could not have been
predicted when the query was submitted, so I could say "take this results (from
Fuseki) and apply all known prefixes (client side)". If this can be done client
side, then I think it's a good idea to keep it out of the server.
Sent: Tuesday, February 27, 2018 at 12:58 PM
From: "Martynas Jusevičius" <[email protected]>
To: jena-users-ml <[email protected]>
Subject: Re: Use PREFIXes by default
I don't think sending results without prefixes is possible, as it would
make them invalid in respect to their format. Sounds like a really bad idea
TBH.
On Tue, Feb 27, 2018 at 12:48 PM, Laura Morales <[email protected]> wrote:
Do these libraries also add PREFIXes for the output? For example I send a
query, get a XML or JSON-LD back, and the library automatically applies
known prefixes to the JSON-LD?
Sent: Tuesday, February 27, 2018 at 12:08 PM
From: "Osma Suominen" <[email protected]>
To: [email protected]
Subject: Re: Use PREFIXes by default
ajs6f kirjoitti 25.02.2018 klo 23:46:
If you are not concerned about performance, why not add those prefixes
client-side?
Some client-side libraries do this.
With EasyRdf (for PHP), you declare your prefixes once, and the library
knows about the common ones so you don't have to declare RDFS, OWL etc.
Then you write your SPARQL queries using qnames and EasyRdf prepends
PREFIX declarations transparently at query time (and only the ones you
actually used in the particular query).
YASGUI is a bit similar, when you use an unknown prefix it will try to
look it up from prefix.cc and add the PREFIX declaration if it finds one.
It's too bad SPARQLWrapper (for Python) doesn't do this, there you have
to declare PREFIXes for each query. Of course it's fairly trivial to
make a wrapper that takes care of adding prefixes to a query.
Like others in this thread have argued, I think it makes sense to do
prefix handling on the client side and keep the SPARQL protocol "simple
but stupid". Then everything needed to answer a query (well, except for
the RDF data set of course) will be contained in the HTTP request.
-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
[email protected]
http://www.nationallibrary.fi