You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Miika Alonen <mi...@csc.fi> on 2015/10/01 11:23:27 UTC

Fuseki 2.3.0 not returning prefix declarations from TextDataset using graph protocol

Hi, 

Fuseki 2.3.0 doesnt seem to return prefixes and namespaces from text:TextDataset with graph protocol. You would expect that these return the same result: 

GET /textDataset?default HTTP/1.1 
Host: localhost:3030 
Accept: text/turtle; charset=utf-8 
and 

CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o } 


but graph protocol from TextDataset returns expanded content (without prefixes and namespaces), while CONSTRUCT queries returns compact data with prefixes and namespaces. 

I'v tried couple of configurations with the same result and it doesnt seem to matter if the TDB dataset is called trough separate service. Am i missing something or is this a bug or a feature? :) 

My current "simplified" configuration is: 

@prefix : <#> . 
@prefix fuseki: <http://jena.apache.org/fuseki#> . 
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . 
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . 
@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> . 
@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . 
@prefix text: <http://jena.apache.org/text#> . 


[] rdf:type fuseki:Server ; 

fuseki:services ( 
<#TestService> 
) . 

# TDB 
[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" . 
tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset . 
tdb:GraphTDB rdfs:subClassOf ja:Model . 

# Text 
[] ja:loadClass "org.apache.jena.query.text.TextQuery" . 
text:TextDataset rdfs:subClassOf ja:RDFDataset . 
text:TextIndexLucene rdfs:subClassOf text:TextIndex . 

<#TestService> rdf:type fuseki:Service ; 
fuseki:name "search" ; 
fuseki:dataset <#text_dataset> ; 
fuseki:serviceQuery "sparql" ; 
fuseki:serviceUpdate "update" ; 
fuseki:serviceReadWriteGraphStore "data" ; 
fuseki:serviceUpload "upload" ; 
. 

<#text_dataset> rdf:type text:TextDataset ; 
text:dataset <#dataset> ; 
text:index <#indexLucene> ; 
. 

<#dataset> rdf:type tdb:DatasetTDB ; 
tdb:location "TEST_TDB" ; 
tdb:unionDefaultGraph true ; 
. 

<#indexLucene> a text:TextIndexLucene ; 
text:directory <file:Lucene> ; 
text:entityMap <#entityMap> ; 
. 

<#entityMap> a text:EntityMap ; 
text:entityField "uri" ; 
text:graphField "graph" ; ## enable graph-specific indexing 
text:defaultField "label" ; ## Must be defined in the text:map 
text:map ( 
# rdfs:label 
[ text:field "label" ; 
text:predicate rdfs:label ; 
text:analyzer [ a text:LowerCaseKeywordAnalyzer ] ] 
# rdfs:comment 
[ text:field "comment" ; 
text:predicate rdfs:comment ; 
text:analyzer [ a text:LowerCaseKeywordAnalyzer ] ] 
) . 


Best Regards, 
Miika Alonen 

CSC - IT Center for Science 
miika.alonen@csc.fi 

Re: Fuseki 2.3.0 not returning prefix declarations from TextDataset using graph protocol

Posted by Miika Alonen <mi...@csc.fi>.
Hi,

Thanks for your efforts! 

I have been happy with the graph specific prefix sets. I cant use TextDataset directly if there is no possibility to store individual prefix sets to the named graphs. I could of course copy the graphs to another service that is using TextDataset, or I could just keep the prefix sets in one service and data in another using TextDataset ... But I think ill settle to standard contains function until this is resolved. 

I dont use default graph that much, but I think you should be able to define what prefixes you want to use in the default union graph. By default there shouldnt be any prefix set defined in the default graph - even if there are some named graphs that have prefix sets.

Miika

----- Original Message -----
From: "Andy Seaborne" <an...@apache.org>
To: users@jena.apache.org
Sent: Tuesday, 6 October, 2015 21:33:31
Subject: Re: Fuseki 2.3.0 not returning prefix declarations from TextDataset using graph protocol

Hi Miika,

After some investigation, it seems that prefixes aren't working for text 
datasets - and if you restart, then the ones on the default graph will 
disappear.  I thought there was a quick fix for this but the quick fix 
breaks some tests (it looks like the tests are wrong/fragile with 
respect to transaction boundaries).

We have started a JIRA to discuss prefixes on datasets: JENA-1045.

Prefixes are just helpers - if necessary, you can add them client side.

	Andy

On 05/10/15 08:56, Miika Alonen wrote:
> Sorry about the numerous emails on the matter, but i just realized that:
>
> http://localhost:3030/search/data
> http://localhost:3030/search/data?graph=default
>
> doesnt mean the same thing, so removing the union graph from the dataset configuration works, but the earlier example is still not working if using named graphs:
>
> http://localhost:3030/search/data?graph=default (WORKS - returns prefixed content)
> http://localhost:3030/search/data?graph=http://example.org/ (NOT WORKING - returns expanded content)
>
> - Miika
>
> ----- Original Message -----
> From: "Miika Alonen" <mi...@csc.fi>
> To: users@jena.apache.org
> Sent: Monday, 5 October, 2015 10:27:44
> Subject: Re: Fuseki 2.3.0 not returning prefix declarations from TextDataset using graph protocol
>
> Hi,
>
> It seems it is sometimes working (for example with application/ld+json syntax) - but only when using default graph. Problem shows up the best when using named graphs.
>
> I also tried to set the default graph tdb:unionDefaultGraph false ; or # comment it out, but it seems that the <#dataset> default graph stays as union no matter what.
>
> - Miika
>
> ----- Original Message -----
> From: "Miika Alonen" <mi...@csc.fi>
> To: users@jena.apache.org
> Sent: Monday, 5 October, 2015 09:28:18
> Subject: Re: Fuseki 2.3.0 not returning prefix declarations from TextDataset using graph protocol
>
> Hi,
>
> Thanks for your reply. Sorry, there were some floppiness in my example. What i was doing was:
>
> PUT http://localhost:3030/search/data HTTP/1.1
> Host: localhost:3030
> Content-Type: text/turtle; charset=utf-8
> BODY:
> @prefix example: <http://example.org/> .
> example:foo  example:bar  example:foo .
>
> And then:
>
> GET http://localhost:3030/search/data HTTP/1.1
> Host: localhost:3030
> Accept: text/turtle; charset=utf-8
>
> And the result is:
>
> <http://example.org/foo> <http://example.org/bar> <http://example.org/foo> .
>
> ... so text/turtle or application/ld+json seems not to be working, but if you omit the Content-Type or use text/trig it returns:
>
> @prefix example: <http://example.org/> .
>
> { example:foo  example:bar  example:foo .
> }
>
> - Miika
>
> ----- Original Message -----
> From: "Andy Seaborne" <an...@apache.org>
> To: users@jena.apache.org
> Sent: Friday, 2 October, 2015 18:50:05
> Subject: Re: Fuseki 2.3.0 not returning prefix declarations from TextDataset using graph protocol
>
> On 01/10/15 10:23, Miika Alonen wrote:
>> Hi,
>>
>> Fuseki 2.3.0 doesnt seem to return prefixes and namespaces from text:TextDataset with graph protocol. You would expect that these return the same result:
>
> Hi Miika,
>
> I tried your example and it works for me.
>
> If you loaded from N-triples or with a bulk loader there aren't any
> prefixes (the bulk loaders do now, post the last releases, save the
> prefixes).
>
> IIRC CONSTRUCT gets its prefixes from the query.
>
>>
>> GET /textDataset?default HTTP/1.1
>
> which does not agree with the configuration below ...
>
> The form "/dataset?default", directly using the graph store protocol on
> the dataset, rather than "/dataset/data?default", got fixed recently
> (post the last releases).  That might accoutn for twhat you are seeing
> (if it worked at all).
>
> 	Andy
>
>> Host: localhost:3030
>> Accept: text/turtle; charset=utf-8
>> and
>>
>> CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o }
>>
>>
>> but graph protocol from TextDataset returns expanded content (without prefixes and namespaces), while CONSTRUCT queries returns compact data with prefixes and namespaces.
>>
>> I'v tried couple of configurations with the same result and it doesnt seem to matter if the TDB dataset is called trough separate service. Am i missing something or is this a bug or a feature? :)
>
> So directly on the TDB service, no text dataset, also does not have
> prefixes? See above - looks like there aren't any loaded.
>
>>
>> My current "simplified" configuration is:
>>
>> @prefix : <#> .
>> @prefix fuseki: <http://jena.apache.org/fuseki#> .
>> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
>> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
>> @prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
>> @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
>> @prefix text: <http://jena.apache.org/text#> .
>>
>>
>> [] rdf:type fuseki:Server ;
>>
>> fuseki:services (
>> <#TestService>
>> ) .
>>
>> # TDB
>> [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
>> tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
>> tdb:GraphTDB rdfs:subClassOf ja:Model .
>>
>> # Text
>> [] ja:loadClass "org.apache.jena.query.text.TextQuery" .
>> text:TextDataset rdfs:subClassOf ja:RDFDataset .
>> text:TextIndexLucene rdfs:subClassOf text:TextIndex .
>>
>> <#TestService> rdf:type fuseki:Service ;
>> fuseki:name "search" ;
>> fuseki:dataset <#text_dataset> ;
>> fuseki:serviceQuery "sparql" ;
>> fuseki:serviceUpdate "update" ;
>> fuseki:serviceReadWriteGraphStore "data" ;
>> fuseki:serviceUpload "upload" ;
>> .
>>
>> <#text_dataset> rdf:type text:TextDataset ;
>> text:dataset <#dataset> ;
>> text:index <#indexLucene> ;
>> .
>>
>> <#dataset> rdf:type tdb:DatasetTDB ;
>> tdb:location "TEST_TDB" ;
>> tdb:unionDefaultGraph true ;
>> .
>>
>> <#indexLucene> a text:TextIndexLucene ;
>> text:directory <file:Lucene> ;
>> text:entityMap <#entityMap> ;
>> .
>>
>> <#entityMap> a text:EntityMap ;
>> text:entityField "uri" ;
>> text:graphField "graph" ; ## enable graph-specific indexing
>> text:defaultField "label" ; ## Must be defined in the text:map
>> text:map (
>> # rdfs:label
>> [ text:field "label" ;
>> text:predicate rdfs:label ;
>> text:analyzer [ a text:LowerCaseKeywordAnalyzer ] ]
>> # rdfs:comment
>> [ text:field "comment" ;
>> text:predicate rdfs:comment ;
>> text:analyzer [ a text:LowerCaseKeywordAnalyzer ] ]
>> ) .
>>
>>
>> Best Regards,
>> Miika Alonen
>>
>> CSC - IT Center for Science
>> miika.alonen@csc.fi
>>

Re: Fuseki 2.3.0 not returning prefix declarations from TextDataset using graph protocol

Posted by Andy Seaborne <an...@apache.org>.
Hi Miika,

After some investigation, it seems that prefixes aren't working for text 
datasets - and if you restart, then the ones on the default graph will 
disappear.  I thought there was a quick fix for this but the quick fix 
breaks some tests (it looks like the tests are wrong/fragile with 
respect to transaction boundaries).

We have started a JIRA to discuss prefixes on datasets: JENA-1045.

Prefixes are just helpers - if necessary, you can add them client side.

	Andy

On 05/10/15 08:56, Miika Alonen wrote:
> Sorry about the numerous emails on the matter, but i just realized that:
>
> http://localhost:3030/search/data
> http://localhost:3030/search/data?graph=default
>
> doesnt mean the same thing, so removing the union graph from the dataset configuration works, but the earlier example is still not working if using named graphs:
>
> http://localhost:3030/search/data?graph=default (WORKS - returns prefixed content)
> http://localhost:3030/search/data?graph=http://example.org/ (NOT WORKING - returns expanded content)
>
> - Miika
>
> ----- Original Message -----
> From: "Miika Alonen" <mi...@csc.fi>
> To: users@jena.apache.org
> Sent: Monday, 5 October, 2015 10:27:44
> Subject: Re: Fuseki 2.3.0 not returning prefix declarations from TextDataset using graph protocol
>
> Hi,
>
> It seems it is sometimes working (for example with application/ld+json syntax) - but only when using default graph. Problem shows up the best when using named graphs.
>
> I also tried to set the default graph tdb:unionDefaultGraph false ; or # comment it out, but it seems that the <#dataset> default graph stays as union no matter what.
>
> - Miika
>
> ----- Original Message -----
> From: "Miika Alonen" <mi...@csc.fi>
> To: users@jena.apache.org
> Sent: Monday, 5 October, 2015 09:28:18
> Subject: Re: Fuseki 2.3.0 not returning prefix declarations from TextDataset using graph protocol
>
> Hi,
>
> Thanks for your reply. Sorry, there were some floppiness in my example. What i was doing was:
>
> PUT http://localhost:3030/search/data HTTP/1.1
> Host: localhost:3030
> Content-Type: text/turtle; charset=utf-8
> BODY:
> @prefix example: <http://example.org/> .
> example:foo  example:bar  example:foo .
>
> And then:
>
> GET http://localhost:3030/search/data HTTP/1.1
> Host: localhost:3030
> Accept: text/turtle; charset=utf-8
>
> And the result is:
>
> <http://example.org/foo> <http://example.org/bar> <http://example.org/foo> .
>
> ... so text/turtle or application/ld+json seems not to be working, but if you omit the Content-Type or use text/trig it returns:
>
> @prefix example: <http://example.org/> .
>
> { example:foo  example:bar  example:foo .
> }
>
> - Miika
>
> ----- Original Message -----
> From: "Andy Seaborne" <an...@apache.org>
> To: users@jena.apache.org
> Sent: Friday, 2 October, 2015 18:50:05
> Subject: Re: Fuseki 2.3.0 not returning prefix declarations from TextDataset using graph protocol
>
> On 01/10/15 10:23, Miika Alonen wrote:
>> Hi,
>>
>> Fuseki 2.3.0 doesnt seem to return prefixes and namespaces from text:TextDataset with graph protocol. You would expect that these return the same result:
>
> Hi Miika,
>
> I tried your example and it works for me.
>
> If you loaded from N-triples or with a bulk loader there aren't any
> prefixes (the bulk loaders do now, post the last releases, save the
> prefixes).
>
> IIRC CONSTRUCT gets its prefixes from the query.
>
>>
>> GET /textDataset?default HTTP/1.1
>
> which does not agree with the configuration below ...
>
> The form "/dataset?default", directly using the graph store protocol on
> the dataset, rather than "/dataset/data?default", got fixed recently
> (post the last releases).  That might accoutn for twhat you are seeing
> (if it worked at all).
>
> 	Andy
>
>> Host: localhost:3030
>> Accept: text/turtle; charset=utf-8
>> and
>>
>> CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o }
>>
>>
>> but graph protocol from TextDataset returns expanded content (without prefixes and namespaces), while CONSTRUCT queries returns compact data with prefixes and namespaces.
>>
>> I'v tried couple of configurations with the same result and it doesnt seem to matter if the TDB dataset is called trough separate service. Am i missing something or is this a bug or a feature? :)
>
> So directly on the TDB service, no text dataset, also does not have
> prefixes? See above - looks like there aren't any loaded.
>
>>
>> My current "simplified" configuration is:
>>
>> @prefix : <#> .
>> @prefix fuseki: <http://jena.apache.org/fuseki#> .
>> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
>> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
>> @prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
>> @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
>> @prefix text: <http://jena.apache.org/text#> .
>>
>>
>> [] rdf:type fuseki:Server ;
>>
>> fuseki:services (
>> <#TestService>
>> ) .
>>
>> # TDB
>> [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
>> tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
>> tdb:GraphTDB rdfs:subClassOf ja:Model .
>>
>> # Text
>> [] ja:loadClass "org.apache.jena.query.text.TextQuery" .
>> text:TextDataset rdfs:subClassOf ja:RDFDataset .
>> text:TextIndexLucene rdfs:subClassOf text:TextIndex .
>>
>> <#TestService> rdf:type fuseki:Service ;
>> fuseki:name "search" ;
>> fuseki:dataset <#text_dataset> ;
>> fuseki:serviceQuery "sparql" ;
>> fuseki:serviceUpdate "update" ;
>> fuseki:serviceReadWriteGraphStore "data" ;
>> fuseki:serviceUpload "upload" ;
>> .
>>
>> <#text_dataset> rdf:type text:TextDataset ;
>> text:dataset <#dataset> ;
>> text:index <#indexLucene> ;
>> .
>>
>> <#dataset> rdf:type tdb:DatasetTDB ;
>> tdb:location "TEST_TDB" ;
>> tdb:unionDefaultGraph true ;
>> .
>>
>> <#indexLucene> a text:TextIndexLucene ;
>> text:directory <file:Lucene> ;
>> text:entityMap <#entityMap> ;
>> .
>>
>> <#entityMap> a text:EntityMap ;
>> text:entityField "uri" ;
>> text:graphField "graph" ; ## enable graph-specific indexing
>> text:defaultField "label" ; ## Must be defined in the text:map
>> text:map (
>> # rdfs:label
>> [ text:field "label" ;
>> text:predicate rdfs:label ;
>> text:analyzer [ a text:LowerCaseKeywordAnalyzer ] ]
>> # rdfs:comment
>> [ text:field "comment" ;
>> text:predicate rdfs:comment ;
>> text:analyzer [ a text:LowerCaseKeywordAnalyzer ] ]
>> ) .
>>
>>
>> Best Regards,
>> Miika Alonen
>>
>> CSC - IT Center for Science
>> miika.alonen@csc.fi
>>


Re: Fuseki 2.3.0 not returning prefix declarations from TextDataset using graph protocol

Posted by Miika Alonen <mi...@csc.fi>.
Sorry about the numerous emails on the matter, but i just realized that:

http://localhost:3030/search/data
http://localhost:3030/search/data?graph=default

doesnt mean the same thing, so removing the union graph from the dataset configuration works, but the earlier example is still not working if using named graphs:  

http://localhost:3030/search/data?graph=default (WORKS - returns prefixed content)
http://localhost:3030/search/data?graph=http://example.org/ (NOT WORKING - returns expanded content)

- Miika

----- Original Message -----
From: "Miika Alonen" <mi...@csc.fi>
To: users@jena.apache.org
Sent: Monday, 5 October, 2015 10:27:44
Subject: Re: Fuseki 2.3.0 not returning prefix declarations from TextDataset using graph protocol

Hi,

It seems it is sometimes working (for example with application/ld+json syntax) - but only when using default graph. Problem shows up the best when using named graphs. 

I also tried to set the default graph tdb:unionDefaultGraph false ; or # comment it out, but it seems that the <#dataset> default graph stays as union no matter what.
 
- Miika

----- Original Message -----
From: "Miika Alonen" <mi...@csc.fi>
To: users@jena.apache.org
Sent: Monday, 5 October, 2015 09:28:18
Subject: Re: Fuseki 2.3.0 not returning prefix declarations from TextDataset using graph protocol

Hi, 

Thanks for your reply. Sorry, there were some floppiness in my example. What i was doing was:

PUT http://localhost:3030/search/data HTTP/1.1
Host: localhost:3030
Content-Type: text/turtle; charset=utf-8
BODY:
@prefix example: <http://example.org/> .
example:foo  example:bar  example:foo .

And then:

GET http://localhost:3030/search/data HTTP/1.1
Host: localhost:3030
Accept: text/turtle; charset=utf-8

And the result is: 

<http://example.org/foo> <http://example.org/bar> <http://example.org/foo> .

... so text/turtle or application/ld+json seems not to be working, but if you omit the Content-Type or use text/trig it returns:

@prefix example: <http://example.org/> .

{ example:foo  example:bar  example:foo .
}

- Miika

----- Original Message -----
From: "Andy Seaborne" <an...@apache.org>
To: users@jena.apache.org
Sent: Friday, 2 October, 2015 18:50:05
Subject: Re: Fuseki 2.3.0 not returning prefix declarations from TextDataset using graph protocol

On 01/10/15 10:23, Miika Alonen wrote:
> Hi,
>
> Fuseki 2.3.0 doesnt seem to return prefixes and namespaces from text:TextDataset with graph protocol. You would expect that these return the same result:

Hi Miika,

I tried your example and it works for me.

If you loaded from N-triples or with a bulk loader there aren't any 
prefixes (the bulk loaders do now, post the last releases, save the 
prefixes).

IIRC CONSTRUCT gets its prefixes from the query.

>
> GET /textDataset?default HTTP/1.1

which does not agree with the configuration below ...

The form "/dataset?default", directly using the graph store protocol on 
the dataset, rather than "/dataset/data?default", got fixed recently 
(post the last releases).  That might accoutn for twhat you are seeing 
(if it worked at all).

	Andy

> Host: localhost:3030
> Accept: text/turtle; charset=utf-8
> and
>
> CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o }
>
>
> but graph protocol from TextDataset returns expanded content (without prefixes and namespaces), while CONSTRUCT queries returns compact data with prefixes and namespaces.
>
> I'v tried couple of configurations with the same result and it doesnt seem to matter if the TDB dataset is called trough separate service. Am i missing something or is this a bug or a feature? :)

So directly on the TDB service, no text dataset, also does not have 
prefixes? See above - looks like there aren't any loaded.

>
> My current "simplified" configuration is:
>
> @prefix : <#> .
> @prefix fuseki: <http://jena.apache.org/fuseki#> .
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
> @prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
> @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
> @prefix text: <http://jena.apache.org/text#> .
>
>
> [] rdf:type fuseki:Server ;
>
> fuseki:services (
> <#TestService>
> ) .
>
> # TDB
> [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
> tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
> tdb:GraphTDB rdfs:subClassOf ja:Model .
>
> # Text
> [] ja:loadClass "org.apache.jena.query.text.TextQuery" .
> text:TextDataset rdfs:subClassOf ja:RDFDataset .
> text:TextIndexLucene rdfs:subClassOf text:TextIndex .
>
> <#TestService> rdf:type fuseki:Service ;
> fuseki:name "search" ;
> fuseki:dataset <#text_dataset> ;
> fuseki:serviceQuery "sparql" ;
> fuseki:serviceUpdate "update" ;
> fuseki:serviceReadWriteGraphStore "data" ;
> fuseki:serviceUpload "upload" ;
> .
>
> <#text_dataset> rdf:type text:TextDataset ;
> text:dataset <#dataset> ;
> text:index <#indexLucene> ;
> .
>
> <#dataset> rdf:type tdb:DatasetTDB ;
> tdb:location "TEST_TDB" ;
> tdb:unionDefaultGraph true ;
> .
>
> <#indexLucene> a text:TextIndexLucene ;
> text:directory <file:Lucene> ;
> text:entityMap <#entityMap> ;
> .
>
> <#entityMap> a text:EntityMap ;
> text:entityField "uri" ;
> text:graphField "graph" ; ## enable graph-specific indexing
> text:defaultField "label" ; ## Must be defined in the text:map
> text:map (
> # rdfs:label
> [ text:field "label" ;
> text:predicate rdfs:label ;
> text:analyzer [ a text:LowerCaseKeywordAnalyzer ] ]
> # rdfs:comment
> [ text:field "comment" ;
> text:predicate rdfs:comment ;
> text:analyzer [ a text:LowerCaseKeywordAnalyzer ] ]
> ) .
>
>
> Best Regards,
> Miika Alonen
>
> CSC - IT Center for Science
> miika.alonen@csc.fi
>

Re: Fuseki 2.3.0 not returning prefix declarations from TextDataset using graph protocol

Posted by Miika Alonen <mi...@csc.fi>.
Hi,

It seems it is sometimes working (for example with application/ld+json syntax) - but only when using default graph. Problem shows up the best when using named graphs. 

I also tried to set the default graph tdb:unionDefaultGraph false ; or # comment it out, but it seems that the <#dataset> default graph stays as union no matter what.
 
- Miika

----- Original Message -----
From: "Miika Alonen" <mi...@csc.fi>
To: users@jena.apache.org
Sent: Monday, 5 October, 2015 09:28:18
Subject: Re: Fuseki 2.3.0 not returning prefix declarations from TextDataset using graph protocol

Hi, 

Thanks for your reply. Sorry, there were some floppiness in my example. What i was doing was:

PUT http://localhost:3030/search/data HTTP/1.1
Host: localhost:3030
Content-Type: text/turtle; charset=utf-8
BODY:
@prefix example: <http://example.org/> .
example:foo  example:bar  example:foo .

And then:

GET http://localhost:3030/search/data HTTP/1.1
Host: localhost:3030
Accept: text/turtle; charset=utf-8

And the result is: 

<http://example.org/foo> <http://example.org/bar> <http://example.org/foo> .

... so text/turtle or application/ld+json seems not to be working, but if you omit the Content-Type or use text/trig it returns:

@prefix example: <http://example.org/> .

{ example:foo  example:bar  example:foo .
}

- Miika

----- Original Message -----
From: "Andy Seaborne" <an...@apache.org>
To: users@jena.apache.org
Sent: Friday, 2 October, 2015 18:50:05
Subject: Re: Fuseki 2.3.0 not returning prefix declarations from TextDataset using graph protocol

On 01/10/15 10:23, Miika Alonen wrote:
> Hi,
>
> Fuseki 2.3.0 doesnt seem to return prefixes and namespaces from text:TextDataset with graph protocol. You would expect that these return the same result:

Hi Miika,

I tried your example and it works for me.

If you loaded from N-triples or with a bulk loader there aren't any 
prefixes (the bulk loaders do now, post the last releases, save the 
prefixes).

IIRC CONSTRUCT gets its prefixes from the query.

>
> GET /textDataset?default HTTP/1.1

which does not agree with the configuration below ...

The form "/dataset?default", directly using the graph store protocol on 
the dataset, rather than "/dataset/data?default", got fixed recently 
(post the last releases).  That might accoutn for twhat you are seeing 
(if it worked at all).

	Andy

> Host: localhost:3030
> Accept: text/turtle; charset=utf-8
> and
>
> CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o }
>
>
> but graph protocol from TextDataset returns expanded content (without prefixes and namespaces), while CONSTRUCT queries returns compact data with prefixes and namespaces.
>
> I'v tried couple of configurations with the same result and it doesnt seem to matter if the TDB dataset is called trough separate service. Am i missing something or is this a bug or a feature? :)

So directly on the TDB service, no text dataset, also does not have 
prefixes? See above - looks like there aren't any loaded.

>
> My current "simplified" configuration is:
>
> @prefix : <#> .
> @prefix fuseki: <http://jena.apache.org/fuseki#> .
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
> @prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
> @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
> @prefix text: <http://jena.apache.org/text#> .
>
>
> [] rdf:type fuseki:Server ;
>
> fuseki:services (
> <#TestService>
> ) .
>
> # TDB
> [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
> tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
> tdb:GraphTDB rdfs:subClassOf ja:Model .
>
> # Text
> [] ja:loadClass "org.apache.jena.query.text.TextQuery" .
> text:TextDataset rdfs:subClassOf ja:RDFDataset .
> text:TextIndexLucene rdfs:subClassOf text:TextIndex .
>
> <#TestService> rdf:type fuseki:Service ;
> fuseki:name "search" ;
> fuseki:dataset <#text_dataset> ;
> fuseki:serviceQuery "sparql" ;
> fuseki:serviceUpdate "update" ;
> fuseki:serviceReadWriteGraphStore "data" ;
> fuseki:serviceUpload "upload" ;
> .
>
> <#text_dataset> rdf:type text:TextDataset ;
> text:dataset <#dataset> ;
> text:index <#indexLucene> ;
> .
>
> <#dataset> rdf:type tdb:DatasetTDB ;
> tdb:location "TEST_TDB" ;
> tdb:unionDefaultGraph true ;
> .
>
> <#indexLucene> a text:TextIndexLucene ;
> text:directory <file:Lucene> ;
> text:entityMap <#entityMap> ;
> .
>
> <#entityMap> a text:EntityMap ;
> text:entityField "uri" ;
> text:graphField "graph" ; ## enable graph-specific indexing
> text:defaultField "label" ; ## Must be defined in the text:map
> text:map (
> # rdfs:label
> [ text:field "label" ;
> text:predicate rdfs:label ;
> text:analyzer [ a text:LowerCaseKeywordAnalyzer ] ]
> # rdfs:comment
> [ text:field "comment" ;
> text:predicate rdfs:comment ;
> text:analyzer [ a text:LowerCaseKeywordAnalyzer ] ]
> ) .
>
>
> Best Regards,
> Miika Alonen
>
> CSC - IT Center for Science
> miika.alonen@csc.fi
>

Re: Fuseki 2.3.0 not returning prefix declarations from TextDataset using graph protocol

Posted by Miika Alonen <mi...@csc.fi>.
Hi, 

Thanks for your reply. Sorry, there were some floppiness in my example. What i was doing was:

PUT http://localhost:3030/search/data HTTP/1.1
Host: localhost:3030
Content-Type: text/turtle; charset=utf-8
BODY:
@prefix example: <http://example.org/> .
example:foo  example:bar  example:foo .

And then:

GET http://localhost:3030/search/data HTTP/1.1
Host: localhost:3030
Accept: text/turtle; charset=utf-8

And the result is: 

<http://example.org/foo> <http://example.org/bar> <http://example.org/foo> .

... so text/turtle or application/ld+json seems not to be working, but if you omit the Content-Type or use text/trig it returns:

@prefix example: <http://example.org/> .

{ example:foo  example:bar  example:foo .
}

- Miika

----- Original Message -----
From: "Andy Seaborne" <an...@apache.org>
To: users@jena.apache.org
Sent: Friday, 2 October, 2015 18:50:05
Subject: Re: Fuseki 2.3.0 not returning prefix declarations from TextDataset using graph protocol

On 01/10/15 10:23, Miika Alonen wrote:
> Hi,
>
> Fuseki 2.3.0 doesnt seem to return prefixes and namespaces from text:TextDataset with graph protocol. You would expect that these return the same result:

Hi Miika,

I tried your example and it works for me.

If you loaded from N-triples or with a bulk loader there aren't any 
prefixes (the bulk loaders do now, post the last releases, save the 
prefixes).

IIRC CONSTRUCT gets its prefixes from the query.

>
> GET /textDataset?default HTTP/1.1

which does not agree with the configuration below ...

The form "/dataset?default", directly using the graph store protocol on 
the dataset, rather than "/dataset/data?default", got fixed recently 
(post the last releases).  That might accoutn for twhat you are seeing 
(if it worked at all).

	Andy

> Host: localhost:3030
> Accept: text/turtle; charset=utf-8
> and
>
> CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o }
>
>
> but graph protocol from TextDataset returns expanded content (without prefixes and namespaces), while CONSTRUCT queries returns compact data with prefixes and namespaces.
>
> I'v tried couple of configurations with the same result and it doesnt seem to matter if the TDB dataset is called trough separate service. Am i missing something or is this a bug or a feature? :)

So directly on the TDB service, no text dataset, also does not have 
prefixes? See above - looks like there aren't any loaded.

>
> My current "simplified" configuration is:
>
> @prefix : <#> .
> @prefix fuseki: <http://jena.apache.org/fuseki#> .
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
> @prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
> @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
> @prefix text: <http://jena.apache.org/text#> .
>
>
> [] rdf:type fuseki:Server ;
>
> fuseki:services (
> <#TestService>
> ) .
>
> # TDB
> [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
> tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
> tdb:GraphTDB rdfs:subClassOf ja:Model .
>
> # Text
> [] ja:loadClass "org.apache.jena.query.text.TextQuery" .
> text:TextDataset rdfs:subClassOf ja:RDFDataset .
> text:TextIndexLucene rdfs:subClassOf text:TextIndex .
>
> <#TestService> rdf:type fuseki:Service ;
> fuseki:name "search" ;
> fuseki:dataset <#text_dataset> ;
> fuseki:serviceQuery "sparql" ;
> fuseki:serviceUpdate "update" ;
> fuseki:serviceReadWriteGraphStore "data" ;
> fuseki:serviceUpload "upload" ;
> .
>
> <#text_dataset> rdf:type text:TextDataset ;
> text:dataset <#dataset> ;
> text:index <#indexLucene> ;
> .
>
> <#dataset> rdf:type tdb:DatasetTDB ;
> tdb:location "TEST_TDB" ;
> tdb:unionDefaultGraph true ;
> .
>
> <#indexLucene> a text:TextIndexLucene ;
> text:directory <file:Lucene> ;
> text:entityMap <#entityMap> ;
> .
>
> <#entityMap> a text:EntityMap ;
> text:entityField "uri" ;
> text:graphField "graph" ; ## enable graph-specific indexing
> text:defaultField "label" ; ## Must be defined in the text:map
> text:map (
> # rdfs:label
> [ text:field "label" ;
> text:predicate rdfs:label ;
> text:analyzer [ a text:LowerCaseKeywordAnalyzer ] ]
> # rdfs:comment
> [ text:field "comment" ;
> text:predicate rdfs:comment ;
> text:analyzer [ a text:LowerCaseKeywordAnalyzer ] ]
> ) .
>
>
> Best Regards,
> Miika Alonen
>
> CSC - IT Center for Science
> miika.alonen@csc.fi
>

Re: Fuseki 2.3.0 not returning prefix declarations from TextDataset using graph protocol

Posted by Andy Seaborne <an...@apache.org>.
On 01/10/15 10:23, Miika Alonen wrote:
> Hi,
>
> Fuseki 2.3.0 doesnt seem to return prefixes and namespaces from text:TextDataset with graph protocol. You would expect that these return the same result:

Hi Miika,

I tried your example and it works for me.

If you loaded from N-triples or with a bulk loader there aren't any 
prefixes (the bulk loaders do now, post the last releases, save the 
prefixes).

IIRC CONSTRUCT gets its prefixes from the query.

>
> GET /textDataset?default HTTP/1.1

which does not agree with the configuration below ...

The form "/dataset?default", directly using the graph store protocol on 
the dataset, rather than "/dataset/data?default", got fixed recently 
(post the last releases).  That might accoutn for twhat you are seeing 
(if it worked at all).

	Andy

> Host: localhost:3030
> Accept: text/turtle; charset=utf-8
> and
>
> CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o }
>
>
> but graph protocol from TextDataset returns expanded content (without prefixes and namespaces), while CONSTRUCT queries returns compact data with prefixes and namespaces.
>
> I'v tried couple of configurations with the same result and it doesnt seem to matter if the TDB dataset is called trough separate service. Am i missing something or is this a bug or a feature? :)

So directly on the TDB service, no text dataset, also does not have 
prefixes? See above - looks like there aren't any loaded.

>
> My current "simplified" configuration is:
>
> @prefix : <#> .
> @prefix fuseki: <http://jena.apache.org/fuseki#> .
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
> @prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
> @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
> @prefix text: <http://jena.apache.org/text#> .
>
>
> [] rdf:type fuseki:Server ;
>
> fuseki:services (
> <#TestService>
> ) .
>
> # TDB
> [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
> tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
> tdb:GraphTDB rdfs:subClassOf ja:Model .
>
> # Text
> [] ja:loadClass "org.apache.jena.query.text.TextQuery" .
> text:TextDataset rdfs:subClassOf ja:RDFDataset .
> text:TextIndexLucene rdfs:subClassOf text:TextIndex .
>
> <#TestService> rdf:type fuseki:Service ;
> fuseki:name "search" ;
> fuseki:dataset <#text_dataset> ;
> fuseki:serviceQuery "sparql" ;
> fuseki:serviceUpdate "update" ;
> fuseki:serviceReadWriteGraphStore "data" ;
> fuseki:serviceUpload "upload" ;
> .
>
> <#text_dataset> rdf:type text:TextDataset ;
> text:dataset <#dataset> ;
> text:index <#indexLucene> ;
> .
>
> <#dataset> rdf:type tdb:DatasetTDB ;
> tdb:location "TEST_TDB" ;
> tdb:unionDefaultGraph true ;
> .
>
> <#indexLucene> a text:TextIndexLucene ;
> text:directory <file:Lucene> ;
> text:entityMap <#entityMap> ;
> .
>
> <#entityMap> a text:EntityMap ;
> text:entityField "uri" ;
> text:graphField "graph" ; ## enable graph-specific indexing
> text:defaultField "label" ; ## Must be defined in the text:map
> text:map (
> # rdfs:label
> [ text:field "label" ;
> text:predicate rdfs:label ;
> text:analyzer [ a text:LowerCaseKeywordAnalyzer ] ]
> # rdfs:comment
> [ text:field "comment" ;
> text:predicate rdfs:comment ;
> text:analyzer [ a text:LowerCaseKeywordAnalyzer ] ]
> ) .
>
>
> Best Regards,
> Miika Alonen
>
> CSC - IT Center for Science
> miika.alonen@csc.fi
>