You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Alexei Golovko <al...@gmail.com> on 2013/09/12 15:52:10 UTC

Skolemization in Fuseki

Is it possible to enable skolemization in Fuseki? I've found in mail
archive<http://mail-archives.apache.org/mod_mbox/jena-dev/201202.mbox/%3CCAPTxtVMBy8JpJkkuYH0-n2AwTiS-reN7Eur0w_01paRiu+A_SQ@mail.gmail.com%3E>that
«Bnodes can be handled by enabling bNode label output, and using
<_:...> on input.»

However, I couldn't find how to enable this blank node label output, or use
it with default settings:
if I run
INSERT { [<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
http://example.org/class>] . } WHERE {}
then SELECT-queries return inserted blank nodes as _:b0 or _:b2 (if query
result include or does not include other two blank nodes).

I have seen an open issue https://issues.apache.org/jira/browse/JENA-193,
but status of each item is not clear for me.

Re: Skolemization in Fuseki

Posted by Alexei Golovko <al...@gmail.com>.
Thank you very much, Andy.

This works.



2013/9/13 Andy Seaborne <an...@apache.org>

> On 12/09/13 14:52, Alexei Golovko wrote:
>
>> Is it possible to enable skolemization in Fuseki? I've found in mail
>> archive<http://mail-archives.**apache.org/mod_mbox/jena-dev/**
>> 201202.mbox/%**3CCAPTxtVMBy8JpJkkuYH0-**n2AwTiS-reN7Eur0w_01paRiu+A_**
>> SQ@mail.gmail.com%3E<http://mail-archives.apache.org/mod_mbox/jena-dev/201202.mbox/%3CCAPTxtVMBy8JpJkkuYH0-n2AwTiS-reN7Eur0w_01paRiu+A_SQ@mail.gmail.com%3E>
>> >that
>>
>> «Bnodes can be handled by enabling bNode label output, and using
>> <_:...> on input.»
>>
>> However, I couldn't find how to enable this blank node label output, or
>> use
>> it with default settings:
>> if I run
>> INSERT { [<http://www.w3.org/1999/02/**22-rdf-syntax-ns#type<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>>
>> <
>> http://example.org/class>] . } WHERE {}
>> then SELECT-queries return inserted blank nodes as _:b0 or _:b2 (if query
>> result include or does not include other two blank nodes).
>>
>> I have seen an open issue https://issues.apache.org/**
>> jira/browse/JENA-193 <https://issues.apache.org/jira/browse/JENA-193>,
>> but status of each item is not clear for me.
>>
>>
> Alexei,
>
> Good question - by trail-and-error, and looking at the code, if you start
> the server with
>
> --set "arq:outputGraphBNodeLabels=**true"
>
> or have
>
> [] rdf:type fuseki:Server ;
>    ja:context
>       [ ja:cxtName "arq:outputGraphBNodeLabels" ;
>         ja:cxtValue "true" ] ;
>    ...
>
> it seems to partially works.  The bnode labels returned (XML, JSON, TSV
> formats) are the internal ids but they are not in <_:...> form and so code
> needs to text mangle them.  So there isn't consistent handling.
>
> It's server-wide, not per request.
>
> Seems like this needs cleaning up.
>
>         Andy
>
> I updated JENA-193 in passing.
>
>

Re: Skolemization in Fuseki

Posted by Alexei Golovko <al...@gmail.com>.
Thanks, Andy!

Probably, I've messed with hardlinks and commit reverts. It works as
expected.

Sorry for false reports.

2013/10/11 Andy Seaborne <an...@apache.org>

> On 10/10/13 07:34, Alexei Golovko wrote:
>
>> By the way, only --set "arq:outputGraphBNodeLabels=**true" works;
>> after insert
>> ... ja:context
>>        [ ja:cxtName "arq:outputGraphBNodeLabels" ;
>>          ja:cxtValue "true" ] ;
>> to config file and restarting fuseki (1.0.0) outputs blank nodes as _:b0,
>> not as <_: ...>
>>
>
> Strange - it works for me (JSON output, not text).
>
> What happens for you if you remove the inference layer and use memory
> storage or TDB storage directly?
>
> (and which version of teh code is this?)
>
> I tried this config with the datbase have a bnode in it:
>
> --------------------------------------
>

Re: Skolemization in Fuseki

Posted by Andy Seaborne <an...@apache.org>.
On 10/10/13 07:34, Alexei Golovko wrote:
> By the way, only --set "arq:outputGraphBNodeLabels=true" works;
> after insert
> ... ja:context
>        [ ja:cxtName "arq:outputGraphBNodeLabels" ;
>          ja:cxtValue "true" ] ;
> to config file and restarting fuseki (1.0.0) outputs blank nodes as _:b0,
> not as <_: ...>

Strange - it works for me (JSON output, not text).

What happens for you if you remove the inference layer and use memory 
storage or TDB storage directly?

(and which version of teh code is this?)

I tried this config with the datbase have a bnode in it:

--------------------------------------

# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0

## Example of a TDB dataset published using Fuseki: persistent storage.

@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#> .

[] rdf:type fuseki:Server ;
    ja:context [ ja:cxtName "arq:outputGraphBNodeLabels" ; ja:cxtValue 
"true" ] ;
    fuseki:services (
      <#service_tdb_all>
    ) .

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

## Updatable TDB dataset with all services enabled.

<#service_tdb_all> rdf:type fuseki:Service ;
     rdfs:label                      "TDB Service (RW)" ;
     fuseki:name                     "data" ;
     fuseki:serviceQuery             "query" ;
     fuseki:serviceQuery             "sparql" ;
     fuseki:serviceUpdate            "update" ;
     fuseki:serviceUpload            "upload" ;
     fuseki:serviceReadWriteGraphStore      "data" ;
     # A separate read-only graph store endpoint:
     fuseki:serviceReadGraphStore       "get" ;
     fuseki:dataset           <#tdb_dataset_readwrite> ;
     .

<#tdb_dataset_readwrite> rdf:type      tdb:DatasetTDB ;
     tdb:location "DB" ;
     .



Re: Skolemization in Fuseki

Posted by Alexei Golovko <al...@gmail.com>.
By the way, only --set "arq:outputGraphBNodeLabels=true" works;
after insert
... ja:context
      [ ja:cxtName "arq:outputGraphBNodeLabels" ;
        ja:cxtValue "true" ] ;
to config file and restarting fuseki (1.0.0) outputs blank nodes as _:b0,
not as <_: ...>

Moreover, if I run fuseki-server with --config=config-inf-tdb.ttl --set
"arq:outputGraphBNodeLabels=true, it also ouputs as _:b0.

May be, this should be in other place?

Full config file in the end of letter.

2013/9/13 Andy Seaborne <an...@apache.org>

> On 12/09/13 14:52, Alexei Golovko wrote:
>
>> Is it possible to enable skolemization in Fuseki? I've found in mail
>> archive<http://mail-archives.**apache.org/mod_mbox/jena-dev/**
>> 201202.mbox/%**3CCAPTxtVMBy8JpJkkuYH0-**n2AwTiS-reN7Eur0w_01paRiu+A_**
>> SQ@mail.gmail.com%3E<http://mail-archives.apache.org/mod_mbox/jena-dev/201202.mbox/%3CCAPTxtVMBy8JpJkkuYH0-n2AwTiS-reN7Eur0w_01paRiu+A_SQ@mail.gmail.com%3E>
>> >that
>>
>> «Bnodes can be handled by enabling bNode label output, and using
>> <_:...> on input.»
>>
>> However, I couldn't find how to enable this blank node label output, or
>> use
>> it with default settings:
>> if I run
>> INSERT { [<http://www.w3.org/1999/02/**22-rdf-syntax-ns#type<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>>
>> <
>> http://example.org/class>] . } WHERE {}
>> then SELECT-queries return inserted blank nodes as _:b0 or _:b2 (if query
>> result include or does not include other two blank nodes).
>>
>> I have seen an open issue https://issues.apache.org/**
>> jira/browse/JENA-193 <https://issues.apache.org/jira/browse/JENA-193>,
>> but status of each item is not clear for me.
>>
>>
> Alexei,
>
> Good question - by trail-and-error, and looking at the code, if you start
> the server with
>
> --set "arq:outputGraphBNodeLabels=**true"
>
> or have
>
> [] rdf:type fuseki:Server ;
>    ja:context
>       [ ja:cxtName "arq:outputGraphBNodeLabels" ;
>         ja:cxtValue "true" ] ;
>    ...
>
> it seems to partially works.  The bnode labels returned (XML, JSON, TSV
> formats) are the internal ids but they are not in <_:...> form and so code
> needs to text mangle them.  So there isn't consistent handling.
>
> It's server-wide, not per request.
>
> Seems like this needs cleaning up.
>
>         Andy
>
> I updated JENA-193 in passing.
>
>


Modified config-inf-tdb.ttl:

# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0

@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#> .

[] rdf:type fuseki:Server ;
   ja:context [ ja:cxtName "arq:outputGraphBNodeLabels" ; ja:cxtValue
"true" ] ;
   fuseki:services (
     <#service1>
   ) .

# Custom code.
[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .

# TDB
tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
tdb:GraphTDB    rdfs:subClassOf  ja:Model .

## ---------------------------------------------------------------
## Service with only SPARQL query on an inference model.
## Inference model bbase data in TDB.

<#service1>  rdf:type fuseki:Service ;
    fuseki:name              "inf" ;             # http://host/inf
    fuseki:serviceQuery      "sparql" ;          # SPARQL query service
    fuseki:serviceUpdate     "update" ;
    fuseki:dataset           <#dataset> ;
    .

<#dataset> rdf:type       ja:RDFDataset ;
    ja:defaultGraph       <#model_inf> ;
     .

<#model_inf> a ja:InfModel ;
     ja:baseModel <#tdbGraph> ;
     ja:reasoner [
         #ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>
         ja:reasoner [ja:reasonerClass
"org.mindswap.pellet.jena.PelletReasonerFactory"]
     ] .

<#tdbDataset> rdf:type tdb:DatasetTDB ;
    tdb:location "DB" ;
    # If the unionDefaultGraph is used, then the "update" service should be
removed.
    # The unionDefaultGraph is read only.
    # tdb:unionDefaultGraph true ;
    .

<#tdbGraph> rdf:type tdb:GraphTDB ;
    tdb:dataset <#tdbDataset> .

Re: Skolemization in Fuseki

Posted by Andy Seaborne <an...@apache.org>.
On 12/09/13 14:52, Alexei Golovko wrote:
> Is it possible to enable skolemization in Fuseki? I've found in mail
> archive<http://mail-archives.apache.org/mod_mbox/jena-dev/201202.mbox/%3CCAPTxtVMBy8JpJkkuYH0-n2AwTiS-reN7Eur0w_01paRiu+A_SQ@mail.gmail.com%3E>that
> «Bnodes can be handled by enabling bNode label output, and using
> <_:...> on input.»
>
> However, I couldn't find how to enable this blank node label output, or use
> it with default settings:
> if I run
> INSERT { [<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
> http://example.org/class>] . } WHERE {}
> then SELECT-queries return inserted blank nodes as _:b0 or _:b2 (if query
> result include or does not include other two blank nodes).
>
> I have seen an open issue https://issues.apache.org/jira/browse/JENA-193,
> but status of each item is not clear for me.
>

Alexei,

Good question - by trail-and-error, and looking at the code, if you 
start the server with

--set "arq:outputGraphBNodeLabels=true"

or have

[] rdf:type fuseki:Server ;
    ja:context
       [ ja:cxtName "arq:outputGraphBNodeLabels" ;
         ja:cxtValue "true" ] ;
    ...

it seems to partially works.  The bnode labels returned (XML, JSON, TSV 
formats) are the internal ids but they are not in <_:...> form and so 
code needs to text mangle them.  So there isn't consistent handling.

It's server-wide, not per request.

Seems like this needs cleaning up.

	Andy

I updated JENA-193 in passing.