As Martynas says, prefixes are just surface syntax. In fact,
you can add some prefixes into the data retrieved (in the client, using
Java) if that makes the presentation better.
There is an additional reason (see JENA-309). Data loaded via the HTTP
operations gets parsed to a temporary graph then triples from the graph
are put into the database. This looses the namespace declarations.
It would be nice to manage namespaces a bit better but any systematic
approach needs to cope systematically with (1) two declarations for the
same URI (particularly likely if combining data from several places) and
(2) redefinition of a prefix to a different URI.
The operation to add one graph into another could be made to also merge
in namespaces.
TopQuadrant do some namespace-sensitive stuff. Maybe they would like to
comment.
Andy
On 02/11/12 15:37, Martynas Jusevičius wrote:
Hey Osma,
if I understand your question right: there are no "correct" namespace
prefixes since those are only syntactic shorthands for full
namespaces. The following are equivalent because they refer to the
same namespace:
xmlns:j.0="http://jena.hpl.hp.com/2005/11/Assembler#"
xmlns:asm="http://jena.hpl.hp.com/2005/11/Assembler#"
xmlns:xxx="http://jena.hpl.hp.com/2005/11/Assembler#"
or alternatively in Turtle syntax:
@prefix j.0: <http://jena.hpl.hp.com/2005/11/Assembler#>
@prefix asm: <http://jena.hpl.hp.com/2005/11/Assembler#>
@prefix xxx: <http://jena.hpl.hp.com/2005/11/Assembler#>
It follows from the above that the following are equivalent:
j.0:RDFDataset == asm:RDFDataset == xxx:RDFDataset
This applies to XML namespaces as well, but especially with RDF you
should be thinking in absolute URIs rather than prefixes/names.
So my guess is that the result you're getting is correct and
equivalent to your input -- even if the serialization differs.
Martynas
graphity.org
On Fri, Nov 2, 2012 at 3:08 PM, Osma Suominen <[email protected]> wrote:
Hi,
I'm trying to have Fuseki serve whole graphs with the SPARQL HTTP Graph
Store Protocol, i.e. it should respond to HTTP GETs using a URL such as
/ds/data?graph=http://example.org/my-graph
It does give me the data, but it will not give me the right namespace
prefixes. In previous correspondence about namespace prefixes on the list
[1] and elsewhere [2] it has been said that TDB will pick up prefixes from
the data, but I can't get that to work. Fuseki will only give me prefixes
such as j.0.
I'm using jena-fuseki-0.2.6-SNAPSHOT from a few days ago.
I've tried three different ways of setting up Fuseki and loading the data.
I'm using the Fuseki stock config.ttl file as a test data set, because it
contains several namespace prefixes such as fuseki: and tdb:.
A: In-memory model loaded directly from the file at startup:
./fuseki-server --file config.ttl /ds
B: In-memory model updated via HTTP PUT:
./fuseki-server --update --mem /ds
./s-put http://localhost:3030/ds/data default config.ttl
C: File-backed model updated via HTTP PUT:
mkdir DS
./fuseki-server --update --loc DS /ds
./s-put http://localhost:3030/ds/data default config.ttl
After each of these, I've tried accessing the graph at
http://localhost:3030/ds/data?graph=default
I get back the triples, but not the correct namespace prefixes, like this:
--snip--
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:j.0="http://jena.hpl.hp.com/2005/11/Assembler#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:j.1="http://jena.apache.org/fuseki#" >
<rdf:Description
rdf:about="http://localhost:3030/ds/data?default#emptyDataset">
<rdf:type
rdf:resource="http://jena.hpl.hp.com/2005/11/Assembler#RDFDataset"/>
</rdf:Description>
--snip-- (omitted the remaining data)
My question is, isn't Fuseki/TDB supposed to pick up the prefixes, store
them in the in-memory or TDB store, and then use them in the reply to the
HTTP GET request? Why isn't that happening?
-Osma
[1]
http://mail-archives.apache.org/mod_mbox/jena-users/201108.mbox/%[email protected]%3E
[2] http://tech.groups.yahoo.com/group/jena-dev/message/47330
--
Osma Suominen | [email protected] | +358 40 5255 882
Aalto University, Department of Media Technology, Semantic Computing
Research Group
Room 2541, Otaniementie 17, Espoo, Finland; P.O. Box 15500, FI-00076 Aalto,
Finland