You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by "Theodore.Hills@morganstanley.com" <Th...@morganstanley.com> on 2022/10/14 14:09:48 UTC

TDB2 Data Doesn't Persist

Hello,

I have Apache Jena Fuseki running on my localhost with TDB2 configured with inferencing. See entire config file below. I am running Fuseki server under Windows 10 with the following command line issued from a CMD prompt.

C:\Users\hillsthe\apache-jena-fuseki-4.6.1\fuseki-server.bat --conf C:\Users\hillsthe\config.ttl

I can do updates and queries and everything works as expected. However, if I stop the Fuseki server with a Control-C, and restart it with the above command, my graphs are empty. Any insights?

Theodore Hills
Consultant | Research
Phone: +1 212 296-1833
Theodore.Hills@morganstanley.com<ma...@morganstanley.com>

## Fuseki Server configuration file.

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 tdb1:    http://jena.hpl.hp.com/2008/tdb#
PREFIX tdb2:    http://jena.apache.org/2016/tdb#
PREFIX ja:      http://jena.hpl.hp.com/2005/11/Assembler#
PREFIX :        <#>


<#service1> rdf:type fuseki:Service ;
    fuseki:name   "msro" ;       # http://host:port/msro
    fuseki:endpoint [     # http://host:port/msro/sparql?query=
        fuseki:operation fuseki:query ;
        fuseki:name "sparql"
    ] ;
    fuseki:endpoint [     # http://host:port/msro/query?query=
         # SPARQL query service (alt name)
        fuseki:operation fuseki:query ;
        fuseki:name "query"
    ] ;

    fuseki:endpoint [     # http://host:port/msro/update?query=
         # SPARQL update service
        fuseki:operation fuseki:update ;
        fuseki:name "update"
    ] ;

    fuseki:endpoint [
         # SPARQL Graph Store Protocol (read)
        fuseki:operation fuseki:gsp_r ;
        fuseki:name "get"
    ] ;
    fuseki:endpoint [
        # SPARQL Graph Store Protcol (read and write)
        # http://host:port/msro/data?default or http://host:port/msro/data?graph=<URL<http://host:port/msro/data?graph=%3cURL>>
        fuseki:operation fuseki:gsp_rw ;
        fuseki:name "data"
    ] ;

    fuseki:dataset  <#dataset> ;
    .

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

<#inferenceModel> rdf:type      ja:InfModel;
     ja:reasoner [ ja:reasonerURL http://jena.hpl.hp.com/2003/TransitiveReasoner ];
     ja:baseModel <#baseModel>;
     .

<#baseModel> rdf:type tdb2:GraphTDB2;
     tdb2:dataset <#actualDataset> .

<#actualDataset> rdf:type tdb2:DatasetTDB2;
     tdb2:location "C:\\Users\\hillsthe\\run\\data\\tdb2";
     .


________________________________

For important information including analyst certification and disclosures regarding specific companies, derivatives, or other instruments discussed in this email, please refer to the latest report, if attached and/or hyperlinked to this email, or by logging on to the Morgan Stanley Matrix Platform at http://matrix.ms.com/eqr/research . You may also refer to the Morgan Stanley Research Disclosure Website at http://www.morganstanley.com/eqr/disclosures/webapp/coverage. Morgan Stanley will make certain research products and announcements available only on the Morgan Stanley Matrix Platform.  The content provided in this email, including data or any attachments, is subject to the terms and conditions of use (available at https://ny.matrix.ms.com/matrix/portal/docs/terms/index.html#/terms/general ) applicable to research materials accessed through Matrix, including the terms regarding confidentiality and intellectual property rights. For access to the Morgan Stanley Matrix Platform please contact your sales representative or go to Matrix.

NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.

You may have certain rights regarding the information that Morgan Stanley collects about you. Please see our Privacy Pledge https://www.morganstanley.com/privacy-pledge for more information about your rights.

Re: TDB2 Data Doesn't Persist

Posted by Andy Seaborne <an...@apache.org>.

On 17/10/2022 23:02, Theodore.Hills@morganstanley.com wrote:
> Hi Andy,
> 
> Thanks again for the reply. This seems quite odd to me, so let me check my understanding.
> 
> When persistence is not an issue, RDFS inferencing without axioms works fine in a named graph--actually, across three named graphs. I use one of the named graphs for the vocabulary, and two for data.
> 
> But if I want my named graph to persist, and because I am using inferencing, I have to define my named graph in the assembler (config file).
> 
> Question: Do I need to put the named graph URL in the config file? If so, I can't tell from the documentation where to put that. Insights appreciated.

There's no difference - this defines adatset with a default graph and 
nothing else.

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

<#inferenceModel>
... inference details ...

## Sketch
## Dataset with default graph and a named graph

<#dataset> rdf:type ja:RDFDataset;
       ja:defaultGraph <#inferenceModelDft>;
       ja:namedGraph [
          ja:graphName <http://graphname/for/dataset> ;
          ja:graph <#myInferenceNamedGraph> ] ;
       .

It might be clearer to use ja:graph in place of ja:defaultGraph - used 
like this, they do the same thing.

<#dataset> rdf:type ja:RDFDataset;
       ja:graph <#inferenceModelDft>;
       ja:namedGraph [
          ja:graphName <http://graphname/for/dataset> ;
          ja:graph <#myInferenceNamedGraph> ] ;
       .

Selected named graphs example:

https://github.com/apache/jena/blob/main/jena-fuseki2/examples/tdb2-select-graphs.ttl

The fact the inference has to be repeated (because it will connect to a 
different graph in TDB) is not ideal.

     Andy


> 
> Thanks,
> Ted
> 
> Theodore Hills
> Consultant | Research
> Phone: +1 212 296-1833
> Theodore.Hills@morganstanley.com
> -----Original Message-----
> From: Andy Seaborne <an...@apache.org>
> Sent: Monday, October 17, 2022 4:25 PM
> To: Hills, Theodore (Research) <Th...@morganstanley.com>
> Cc: users@jena.apache.org
> Subject: Re: TDB2 Data Doesn't Persist
> 
> Hi Theordore,
> 
> <#dataset> rdf:type ja:RDFDataset;
>        ja:defaultGraph <#inferenceModel>
>        .
> 
> defines a dataset with just a default graph. It does not pass down named graphs. They end up in a temporary holder.
> 
> You can add the name graph to the ja:RDFDataset but you have to know it's name and define the inference. Inference is per-graph.
> 
> There is
> 
> https://jena.apache.org/documentation/rdfs/
> 
> # RDFS
> :rdfsDataset rdf:type ja:DatasetRDFS ;
>       ja:rdfsSchema <file:vocabulary.ttl>;
>       ja:dataset --- some TDB2 database ---
>       .
> 
> This applies RDFS - without axioms - so rdfs:subClassOf, rdf:subPropertyOf, rdfs:domain and rdfs:range - to all graphs in the ja:database.
> 
> The schema is fixed at startup.
> 
>       Andy
> 
> On 17/10/2022 14:39, Theodore.Hills@morganstanley.com wrote:
>> Hi Andy,
>>
>> Thank you for the prompt reply.
>>
>> I deleted everything in my tdb2 directory in order to force Fuseki to recreate the database from scratch so I knew I was working from a clean slate.
>>
>> I was able to duplicate your results, using my own D.ttl, which is below.
>>
>> <http://triples.ms.com/msro/dummy> <http://www.w3.org/2001/XMLSchema#string> "dummy" .
>>
>> I then loaded the dummy triple into a named graph using the curl command below.
>>
>> curl -T D.ttl --header 'Content-type: text/turtle' \
>>       'http://localhost:3030/msro/data?graph=https%3A%2F%2Ftriples.ms.com%2Fmsro%2F__dummy__'
>>
>> I was able to dump the named graph using the command below.
>>
>> curl 'http://localhost:3030/msro/data?graph=https%3A%2F%2Ftriples.ms.com%2Fmsro%2F__dummy__'
>>
>> I then stopped and restarted Fuseki, and the triple in the named graph was gone. The triple in the default graph was still there.
>>
>> Also, I monitored the size of Data-0001\nodes-data.obj at every step. Upon creation of a fresh database, it was 0 KB. It remained 0 KB even if I loaded my dummy triple into a named graph. Only when I loaded my dummy triple into the default graph did it grow to 1 KB. It remained 1KB across restarts.
>>
>> So, the problem seems to be that triples in the default graph persist, but triples in named graphs do not.
>>
>> The only inferencing I need is subclass inferencing in order for a query of this form to work:
>>     ?s rdfs:subClassOf+ ?c .
>>
>> Once I layered in the TransitiveReasoner in the config file, the above query worked fine in the midst of a complicated and well-tested query that runs fine on Stardog and MarkLogic. As mentioned, I was getting the desired results on Fuseki TDB2 as well. The only problem seems to be the lack of persistence for named graphs.
>>
>> Thanks so much for your attention to this problem!
>>
>> Theodore Hills
>> Consultant | Research
>> Phone: +1 212 296-1833
>> Theodore.Hills@morganstanley.com
>> -----Original Message-----
>> From: Andy Seaborne <an...@apache.org>
>> Sent: Saturday, October 15, 2022 5:41 AM
>> To: users@jena.apache.org
>> Subject: Re: TDB2 Data Doesn't Persist
>>
>> Hi Theodore,
>>
>> I tried your configuration and got persisted data.
>>
>> I tried:
>>
>> curl -T D.ttl --header 'Content-type: text/turtle' \
>>        'http://localhost:3030/msro/data?default'
>>
>> this appeared in the file:
>>
>> [2022-10-15 10:36:19] Fuseki     INFO  [3] Body: Content-Length=338,
>> Content-Type=text/turtle, Charset=null => Turtle : Count=4 Triples=4
>> Quads=0
>>
>> (reformatted for email).
>>
>> then I stopped the server, restarted it and did
>>
>>     curl 'http://localhost:3030/msro/data?default'
>>
>> and got the data with inference output.
>>
>>
>> How are you loading the data?
>>
>> Looking in "C:\\Users\\hillsthe\\run\\data\\tdb2", there is a file Data-0001/nodes-data.obj. How big it is it after loading the data? You can look while the server is running. Does it shrink when the server is stopped? It's zero bytes for an empty database, non-zero otherwise.
>>
>> ----
>>
>> Also - for general information - you're using the transitive reasoner What inferences are you hoping to generate?
>>
>>        Andy
>>
>> On 14/10/2022 15:09, Theodore.Hills@morganstanley.com wrote:
>>> Hello,
>>>
>>> I have Apache Jena Fuseki running on my localhost with TDB2 configured with inferencing. See entire config file below. I am running Fuseki server under Windows 10 with the following command line issued from a CMD prompt.
>>>
>>> C:\Users\hillsthe\apache-jena-fuseki-4.6.1\fuseki-server.bat --conf
>>> C:\Users\hillsthe\config.ttl
>>>
>>> I can do updates and queries and everything works as expected. However, if I stop the Fuseki server with a Control-C, and restart it with the above command, my graphs are empty. Any insights?
>>>
>>> Theodore Hills
>>> Consultant | Research
>>> Phone: +1 212 296-1833
>>> Theodore.Hills@morganstanley.com<mailto:Theodore.Hills@morganstanley.
>>> c
>>> om>
>>>
>>> ## Fuseki Server configuration file.
>>>
>>> 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 tdb1:    http://jena.hpl.hp.com/2008/tdb#
>>> PREFIX tdb2:    http://jena.apache.org/2016/tdb#
>>> PREFIX ja:      http://jena.hpl.hp.com/2005/11/Assembler#
>>> PREFIX :        <#>
>>>
>>>
>>> <#service1> rdf:type fuseki:Service ;
>>>        fuseki:name   "msro" ;       # http://host:port/msro
>>>        fuseki:endpoint [     # http://host:port/msro/sparql?query=
>>>            fuseki:operation fuseki:query ;
>>>            fuseki:name "sparql"
>>>        ] ;
>>>        fuseki:endpoint [     # http://host:port/msro/query?query=
>>>             # SPARQL query service (alt name)
>>>            fuseki:operation fuseki:query ;
>>>            fuseki:name "query"
>>>        ] ;
>>>
>>>        fuseki:endpoint [     # http://host:port/msro/update?query=
>>>             # SPARQL update service
>>>            fuseki:operation fuseki:update ;
>>>            fuseki:name "update"
>>>        ] ;
>>>
>>>        fuseki:endpoint [
>>>             # SPARQL Graph Store Protocol (read)
>>>            fuseki:operation fuseki:gsp_r ;
>>>            fuseki:name "get"
>>>        ] ;
>>>        fuseki:endpoint [
>>>            # SPARQL Graph Store Protcol (read and write)
>>>            # http://host:port/msro/data?default or http://host:port/msro/data?graph=<URL<http://host:port/msro/data?graph=%3cURL>>
>>>            fuseki:operation fuseki:gsp_rw ;
>>>            fuseki:name "data"
>>>        ] ;
>>>
>>>        fuseki:dataset  <#dataset> ;
>>>        .
>>>
>>> <#dataset> rdf:type ja:RDFDataset;
>>>         ja:defaultGraph <#inferenceModel>
>>>         .
>>>
>>> <#inferenceModel> rdf:type      ja:InfModel;
>>>         ja:reasoner [ ja:reasonerURL http://jena.hpl.hp.com/2003/TransitiveReasoner ];
>>>         ja:baseModel <#baseModel>;
>>>         .
>>>
>>> <#baseModel> rdf:type tdb2:GraphTDB2;
>>>         tdb2:dataset <#actualDataset> .
>>>
>>> <#actualDataset> rdf:type tdb2:DatasetTDB2;
>>>         tdb2:location "C:\\Users\\hillsthe\\run\\data\\tdb2";
>>>         .
>>>
>>>
>>> ________________________________
>>>
>>> For important information including analyst certification and disclosures regarding specific companies, derivatives, or other instruments discussed in this email, please refer to the latest report, if attached and/or hyperlinked to this email, or by logging on to the Morgan Stanley Matrix Platform at http://matrix.ms.com/eqr/research . You may also refer to the Morgan Stanley Research Disclosure Website at http://www.morganstanley.com/eqr/disclosures/webapp/coverage. Morgan Stanley will make certain research products and announcements available only on the Morgan Stanley Matrix Platform.  The content provided in this email, including data or any attachments, is subject to the terms and conditions of use (available at https://ny.matrix.ms.com/matrix/portal/docs/terms/index.html#/terms/general ) applicable to research materials accessed through Matrix, including the terms regarding confidentiality and intellectual property rights. For access to the Morgan Stanley Matrix Platform please contact your sales representative or go to Matrix.
>>>
>>> NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.
>>>
>>> You may have certain rights regarding the information that Morgan Stanley collects about you. Please see our Privacy Pledge https://www.morganstanley.com/privacy-pledge for more information about your rights.
>>>
>>
>>
>> ----------------------------------------------------------------------
>> ----------
>>
>> For important information including analyst certification and disclosures regarding specific companies, derivatives, or other instruments discussed in this email, please refer to the latest report, if attached and/or hyperlinked to this email, or by logging on to the Morgan Stanley Matrix Platform at http://matrix.ms.com/eqr/research . You may also refer to the Morgan Stanley Research Disclosure Website at http://www.morganstanley.com/eqr/disclosures/webapp/coverage. Morgan Stanley will make certain research products and announcements available only on the Morgan Stanley Matrix Platform.  The content provided in this email, including data or any attachments, is subject to the terms and conditions of use (available at https://ny.matrix.ms.com/matrix/portal/docs/terms/index.html#/terms/general ) applicable to research materials accessed through Matrix, including the terms regarding confidentiality and intellectual property rights. For access to the Morgan Stanley Matrix Platform please contact your sales representative or go to Matrix.
>>
>> NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.
>>
>> You may have certain rights regarding the information that Morgan Stanley collects about you.  Please see our Privacy Pledge https://www.morganstanley.com/privacy-pledge for more information about your rights.
>>
> 
> 
> --------------------------------------------------------------------------------
> 
> For important information including analyst certification and disclosures regarding specific companies, derivatives, or other instruments discussed in this email, please refer to the latest report, if attached and/or hyperlinked to this email, or by logging on to the Morgan Stanley Matrix Platform at http://matrix.ms.com/eqr/research . You may also refer to the Morgan Stanley Research Disclosure Website at http://www.morganstanley.com/eqr/disclosures/webapp/coverage. Morgan Stanley will make certain research products and announcements available only on the Morgan Stanley Matrix Platform.  The content provided in this email, including data or any attachments, is subject to the terms and conditions of use (available at https://ny.matrix.ms.com/matrix/portal/docs/terms/index.html#/terms/general ) applicable to research materials accessed through Matrix, including the terms regarding confidentiality and intellectual property rights. For access to the Morgan Stanley Matrix Platform please contact your sales representative or go to Matrix.
> 
> NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.
> 
> You may have certain rights regarding the information that Morgan Stanley collects about you.  Please see our Privacy Pledge https://www.morganstanley.com/privacy-pledge for more information about your rights.
> 

Re: TDB2 Data Doesn't Persist

Posted by Andy Seaborne <an...@apache.org>.

On 18/10/2022 23:11, Theodore.Hills@morganstanley.com wrote:
> Hi Andy,
> 
> I seem to have a configuration that's working, where my named graphs are persisting. See new config file below. However, it's horribly slow. I am running Java code which is reading 60,000 records and running SPARQL queries and updates viathe REST API. It will eventually will produce 5 million triples. The further along it gets, the slower it's working. It's about 1/3 done now and down to less than 1 update per second.
> 
> My ja:rdfsSchema file is large. It contains my full ontology and some reference data, which is large (about 90K axions).  I'm not sure that's a factor, however, since the slowdown seems to be based on the number of triples loaded. But I still don't understand this schema stuff, since inferencing isn't going to work with my query unless I've also loaded the full ontology into a named graph that the query references. What really needs to be in the schema file?
> 
> Appreciate any help.

If you want only
   ?s rdfs:subClassOf+ ?c .

you can ask that in the SPARQL query - no inference needed - except it 
won't get reused across queries.

If you add ja:DatasetRDFS, you don't need, and shouldn't use, the "+".

 > and some reference data

ja:DatasetRDFS assumes schema and data are separate.

It isn't a general RDFS reasoner - it assumes a fixed schema, and large 
data.

     Andy

> 
> Thanks,
> Ted
> 
> Theodore Hills
> Consultant | Research
> Phone: +1 212 296-1833
> Theodore.Hills@morganstanley.com
> 
> ## Fuseki Server configuration file.
> 
> 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 tdb1:    <http://jena.hpl.hp.com/2008/tdb#>
> PREFIX tdb2:    <http://jena.apache.org/2016/tdb#>
> PREFIX ja:      <http://jena.hpl.hp.com/2005/11/Assembler#>
> PREFIX :        <#>
> 
> 
> <#service1> rdf:type fuseki:Service ;
>      fuseki:name   "msro" ;       # http://host:port/msro
>      fuseki:endpoint [     # http://host:port/msro/sparql?query=
>          fuseki:operation fuseki:query ;
>          fuseki:name "sparql"
>      ] ;
>      fuseki:endpoint [     # http://host:port/msro/query?query=
>           # SPARQL query service (alt name)
>          fuseki:operation fuseki:query ;
>          fuseki:name "query"
>      ] ;
> 
>      fuseki:endpoint [     # http://host:port/msro/update?query=
>           # SPARQL update service
>          fuseki:operation fuseki:update ;
>          fuseki:name "update"
>      ] ;
> 
>      fuseki:endpoint [
>           # SPARQL Graph Store Protocol (read)
>          fuseki:operation fuseki:gsp_r ;
>          fuseki:name "get"
>      ] ;
>      fuseki:endpoint [
>          # SPARQL Graph Store Protcol (read and write)
>          # http://host:port/msro/data?default or http://host:port/msro/data?graph=<URL>
>          fuseki:operation fuseki:gsp_rw ;
>          fuseki:name "data"
>      ] ;
> 
>      fuseki:dataset  <#dataset> ;
>      .
> 
> <#dataset> rdf:type ja:DatasetRDFS ;
>        ja:rdfsSchema <file:///c:/MSDE/hillsthe/msrows/eqr/msro/eqr.msro/resources/msRoAll.ttl> ;
>        ja:dataset <#actualDataset> ;
>        .
> 
> <#actualDataset> rdf:type tdb2:DatasetTDB2;  # for example.
>       tdb2:location "C:\\Users\\hillsthe\\run\\data\\tdb2";
>       .
> 
> 
> -----Original Message-----
> From: Hills, Theodore (Research)
> Sent: Monday, October 17, 2022 6:02 PM
> To: Andy Seaborne <an...@apache.org>
> Cc: users@jena.apache.org
> Subject: RE: TDB2 Data Doesn't Persist
> 
> Hi Andy,
> 
> Thanks again for the reply. This seems quite odd to me, so let me check my understanding.
> 
> When persistence is not an issue, RDFS inferencing without axioms works fine in a named graph--actually, across three named graphs. I use one of the named graphs for the vocabulary, and two for data.
> 
> But if I want my named graph to persist, and because I am using inferencing, I have to define my named graph in the assembler (config file).
> 
> Question: Do I need to put the named graph URL in the config file? If so, I can't tell from the documentation where to put that. Insights appreciated.
> 
> Thanks,
> Ted
> 
> Theodore Hills
> Consultant | Research
> Phone: +1 212 296-1833
> Theodore.Hills@morganstanley.com
> -----Original Message-----
> From: Andy Seaborne <an...@apache.org>
> Sent: Monday, October 17, 2022 4:25 PM
> To: Hills, Theodore (Research) <Th...@morganstanley.com>
> Cc: users@jena.apache.org
> Subject: Re: TDB2 Data Doesn't Persist
> 
> Hi Theordore,
> 
> <#dataset> rdf:type ja:RDFDataset;
>        ja:defaultGraph <#inferenceModel>
>        .
> 
> defines a dataset with just a default graph. It does not pass down named graphs. They end up in a temporary holder.
> 
> You can add the name graph to the ja:RDFDataset but you have to know it's name and define the inference. Inference is per-graph.
> 
> There is
> 
> https://jena.apache.org/documentation/rdfs/
> 
> # RDFS
> :rdfsDataset rdf:type ja:DatasetRDFS ;
>       ja:rdfsSchema <file:vocabulary.ttl>;
>       ja:dataset --- some TDB2 database ---
>       .
> 
> This applies RDFS - without axioms - so rdfs:subClassOf, rdf:subPropertyOf, rdfs:domain and rdfs:range - to all graphs in the ja:database.
> 
> The schema is fixed at startup.
> 
>       Andy
> 
> On 17/10/2022 14:39, Theodore.Hills@morganstanley.com wrote:
>> Hi Andy,
>>
>> Thank you for the prompt reply.
>>
>> I deleted everything in my tdb2 directory in order to force Fuseki to recreate the database from scratch so I knew I was working from a clean slate.
>>
>> I was able to duplicate your results, using my own D.ttl, which is below.
>>
>> <http://triples.ms.com/msro/dummy> <http://www.w3.org/2001/XMLSchema#string> "dummy" .
>>
>> I then loaded the dummy triple into a named graph using the curl command below.
>>
>> curl -T D.ttl --header 'Content-type: text/turtle' \
>>       'http://localhost:3030/msro/data?graph=https%3A%2F%2Ftriples.ms.com%2Fmsro%2F__dummy__'
>>
>> I was able to dump the named graph using the command below.
>>
>> curl 'http://localhost:3030/msro/data?graph=https%3A%2F%2Ftriples.ms.com%2Fmsro%2F__dummy__'
>>
>> I then stopped and restarted Fuseki, and the triple in the named graph was gone. The triple in the default graph was still there.
>>
>> Also, I monitored the size of Data-0001\nodes-data.obj at every step. Upon creation of a fresh database, it was 0 KB. It remained 0 KB even if I loaded my dummy triple into a named graph. Only when I loaded my dummy triple into the default graph did it grow to 1 KB. It remained 1KB across restarts.
>>
>> So, the problem seems to be that triples in the default graph persist, but triples in named graphs do not.
>>
>> The only inferencing I need is subclass inferencing in order for a query of this form to work:
>>     ?s rdfs:subClassOf+ ?c .
>>
>> Once I layered in the TransitiveReasoner in the config file, the above query worked fine in the midst of a complicated and well-tested query that runs fine on Stardog and MarkLogic. As mentioned, I was getting the desired results on Fuseki TDB2 as well. The only problem seems to be the lack of persistence for named graphs.
>>
>> Thanks so much for your attention to this problem!
>>
>> Theodore Hills
>> Consultant | Research
>> Phone: +1 212 296-1833
>> Theodore.Hills@morganstanley.com
>> -----Original Message-----
>> From: Andy Seaborne <an...@apache.org>
>> Sent: Saturday, October 15, 2022 5:41 AM
>> To: users@jena.apache.org
>> Subject: Re: TDB2 Data Doesn't Persist
>>
>> Hi Theodore,
>>
>> I tried your configuration and got persisted data.
>>
>> I tried:
>>
>> curl -T D.ttl --header 'Content-type: text/turtle' \
>>        'http://localhost:3030/msro/data?default'
>>
>> this appeared in the file:
>>
>> [2022-10-15 10:36:19] Fuseki     INFO  [3] Body: Content-Length=338,
>> Content-Type=text/turtle, Charset=null => Turtle : Count=4 Triples=4
>> Quads=0
>>
>> (reformatted for email).
>>
>> then I stopped the server, restarted it and did
>>
>>     curl 'http://localhost:3030/msro/data?default'
>>
>> and got the data with inference output.
>>
>>
>> How are you loading the data?
>>
>> Looking in "C:\\Users\\hillsthe\\run\\data\\tdb2", there is a file Data-0001/nodes-data.obj. How big it is it after loading the data? You can look while the server is running. Does it shrink when the server is stopped? It's zero bytes for an empty database, non-zero otherwise.
>>
>> ----
>>
>> Also - for general information - you're using the transitive reasoner What inferences are you hoping to generate?
>>
>>        Andy
>>
>> On 14/10/2022 15:09, Theodore.Hills@morganstanley.com wrote:
>>> Hello,
>>>
>>> I have Apache Jena Fuseki running on my localhost with TDB2 configured with inferencing. See entire config file below. I am running Fuseki server under Windows 10 with the following command line issued from a CMD prompt.
>>>
>>> C:\Users\hillsthe\apache-jena-fuseki-4.6.1\fuseki-server.bat --conf
>>> C:\Users\hillsthe\config.ttl
>>>
>>> I can do updates and queries and everything works as expected. However, if I stop the Fuseki server with a Control-C, and restart it with the above command, my graphs are empty. Any insights?
>>>
>>> Theodore Hills
>>> Consultant | Research
>>> Phone: +1 212 296-1833
>>> Theodore.Hills@morganstanley.com<mailto:Theodore.Hills@morganstanley.
>>> c
>>> om>
>>>
>>> ## Fuseki Server configuration file.
>>>
>>> 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 tdb1:    http://jena.hpl.hp.com/2008/tdb#
>>> PREFIX tdb2:    http://jena.apache.org/2016/tdb#
>>> PREFIX ja:      http://jena.hpl.hp.com/2005/11/Assembler#
>>> PREFIX :        <#>
>>>
>>>
>>> <#service1> rdf:type fuseki:Service ;
>>>        fuseki:name   "msro" ;       # http://host:port/msro
>>>        fuseki:endpoint [     # http://host:port/msro/sparql?query=
>>>            fuseki:operation fuseki:query ;
>>>            fuseki:name "sparql"
>>>        ] ;
>>>        fuseki:endpoint [     # http://host:port/msro/query?query=
>>>             # SPARQL query service (alt name)
>>>            fuseki:operation fuseki:query ;
>>>            fuseki:name "query"
>>>        ] ;
>>>
>>>        fuseki:endpoint [     # http://host:port/msro/update?query=
>>>             # SPARQL update service
>>>            fuseki:operation fuseki:update ;
>>>            fuseki:name "update"
>>>        ] ;
>>>
>>>        fuseki:endpoint [
>>>             # SPARQL Graph Store Protocol (read)
>>>            fuseki:operation fuseki:gsp_r ;
>>>            fuseki:name "get"
>>>        ] ;
>>>        fuseki:endpoint [
>>>            # SPARQL Graph Store Protcol (read and write)
>>>            # http://host:port/msro/data?default or http://host:port/msro/data?graph=<URL<http://host:port/msro/data?graph=%3cURL>>
>>>            fuseki:operation fuseki:gsp_rw ;
>>>            fuseki:name "data"
>>>        ] ;
>>>
>>>        fuseki:dataset  <#dataset> ;
>>>        .
>>>
>>> <#dataset> rdf:type ja:RDFDataset;
>>>         ja:defaultGraph <#inferenceModel>
>>>         .
>>>
>>> <#inferenceModel> rdf:type      ja:InfModel;
>>>         ja:reasoner [ ja:reasonerURL http://jena.hpl.hp.com/2003/TransitiveReasoner ];
>>>         ja:baseModel <#baseModel>;
>>>         .
>>>
>>> <#baseModel> rdf:type tdb2:GraphTDB2;
>>>         tdb2:dataset <#actualDataset> .
>>>
>>> <#actualDataset> rdf:type tdb2:DatasetTDB2;
>>>         tdb2:location "C:\\Users\\hillsthe\\run\\data\\tdb2";
>>>         .
>>>
>>>
>>> ________________________________
>>>
>>> For important information including analyst certification and disclosures regarding specific companies, derivatives, or other instruments discussed in this email, please refer to the latest report, if attached and/or hyperlinked to this email, or by logging on to the Morgan Stanley Matrix Platform at http://matrix.ms.com/eqr/research . You may also refer to the Morgan Stanley Research Disclosure Website at http://www.morganstanley.com/eqr/disclosures/webapp/coverage. Morgan Stanley will make certain research products and announcements available only on the Morgan Stanley Matrix Platform.  The content provided in this email, including data or any attachments, is subject to the terms and conditions of use (available at https://ny.matrix.ms.com/matrix/portal/docs/terms/index.html#/terms/general ) applicable to research materials accessed through Matrix, including the terms regarding confidentiality and intellectual property rights. For access to the Morgan Stanley Matrix Platform please contact your sales representative or go to Matrix.
>>>
>>> NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.
>>>
>>> You may have certain rights regarding the information that Morgan Stanley collects about you. Please see our Privacy Pledge https://www.morganstanley.com/privacy-pledge for more information about your rights.
>>>
>>
>>
>> ----------------------------------------------------------------------
>> ----------
>>
>> For important information including analyst certification and disclosures regarding specific companies, derivatives, or other instruments discussed in this email, please refer to the latest report, if attached and/or hyperlinked to this email, or by logging on to the Morgan Stanley Matrix Platform at http://matrix.ms.com/eqr/research . You may also refer to the Morgan Stanley Research Disclosure Website at http://www.morganstanley.com/eqr/disclosures/webapp/coverage. Morgan Stanley will make certain research products and announcements available only on the Morgan Stanley Matrix Platform.  The content provided in this email, including data or any attachments, is subject to the terms and conditions of use (available at https://ny.matrix.ms.com/matrix/portal/docs/terms/index.html#/terms/general ) applicable to research materials accessed through Matrix, including the terms regarding confidentiality and intellectual property rights. For access to the Morgan Stanley Matrix Platform please contact your sales representative or go to Matrix.
>>
>> NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.
>>
>> You may have certain rights regarding the information that Morgan Stanley collects about you.  Please see our Privacy Pledge https://www.morganstanley.com/privacy-pledge for more information about your rights.
>>
> 
> 
> --------------------------------------------------------------------------------
> 
> For important information including analyst certification and disclosures regarding specific companies, derivatives, or other instruments discussed in this email, please refer to the latest report, if attached and/or hyperlinked to this email, or by logging on to the Morgan Stanley Matrix Platform at http://matrix.ms.com/eqr/research . You may also refer to the Morgan Stanley Research Disclosure Website at http://www.morganstanley.com/eqr/disclosures/webapp/coverage. Morgan Stanley will make certain research products and announcements available only on the Morgan Stanley Matrix Platform.  The content provided in this email, including data or any attachments, is subject to the terms and conditions of use (available at https://ny.matrix.ms.com/matrix/portal/docs/terms/index.html#/terms/general ) applicable to research materials accessed through Matrix, including the terms regarding confidentiality and intellectual property rights. For access to the Morgan Stanley Matrix Platform please contact your sales representative or go to Matrix.
> 
> NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.
> 
> You may have certain rights regarding the information that Morgan Stanley collects about you.  Please see our Privacy Pledge https://www.morganstanley.com/privacy-pledge for more information about your rights.
> 

RE: TDB2 Data Doesn't Persist

Posted by "Theodore.Hills@morganstanley.com" <Th...@morganstanley.com>.
Hi Andy,

I seem to have a configuration that's working, where my named graphs are persisting. See new config file below. However, it's horribly slow. I am running Java code which is reading 60,000 records and running SPARQL queries and updates viathe REST API. It will eventually will produce 5 million triples. The further along it gets, the slower it's working. It's about 1/3 done now and down to less than 1 update per second.

My ja:rdfsSchema file is large. It contains my full ontology and some reference data, which is large (about 90K axions).  I'm not sure that's a factor, however, since the slowdown seems to be based on the number of triples loaded. But I still don't understand this schema stuff, since inferencing isn't going to work with my query unless I've also loaded the full ontology into a named graph that the query references. What really needs to be in the schema file?

Appreciate any help.

Thanks,
Ted

Theodore Hills   
Consultant | Research   
Phone: +1 212 296-1833   
Theodore.Hills@morganstanley.com   

## Fuseki Server configuration file.

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 tdb1:    <http://jena.hpl.hp.com/2008/tdb#>
PREFIX tdb2:    <http://jena.apache.org/2016/tdb#>
PREFIX ja:      <http://jena.hpl.hp.com/2005/11/Assembler#>
PREFIX :        <#>


<#service1> rdf:type fuseki:Service ;
    fuseki:name   "msro" ;       # http://host:port/msro
    fuseki:endpoint [     # http://host:port/msro/sparql?query=
        fuseki:operation fuseki:query ; 
        fuseki:name "sparql" 
    ] ;
    fuseki:endpoint [     # http://host:port/msro/query?query=
         # SPARQL query service (alt name)
        fuseki:operation fuseki:query ; 
        fuseki:name "query" 
    ] ;

    fuseki:endpoint [     # http://host:port/msro/update?query=
         # SPARQL update service
        fuseki:operation fuseki:update ;
        fuseki:name "update" 
    ] ;

    fuseki:endpoint [ 
         # SPARQL Graph Store Protocol (read)
        fuseki:operation fuseki:gsp_r ; 
        fuseki:name "get" 
    ] ;
    fuseki:endpoint [     
        # SPARQL Graph Store Protcol (read and write)
        # http://host:port/msro/data?default or http://host:port/msro/data?graph=<URL>
        fuseki:operation fuseki:gsp_rw ; 
        fuseki:name "data" 
    ] ;

    fuseki:dataset  <#dataset> ;
    .

<#dataset> rdf:type ja:DatasetRDFS ;
      ja:rdfsSchema <file:///c:/MSDE/hillsthe/msrows/eqr/msro/eqr.msro/resources/msRoAll.ttl> ;
      ja:dataset <#actualDataset> ;
      .

<#actualDataset> rdf:type tdb2:DatasetTDB2;  # for example.
     tdb2:location "C:\\Users\\hillsthe\\run\\data\\tdb2";
     .


-----Original Message-----
From: Hills, Theodore (Research) 
Sent: Monday, October 17, 2022 6:02 PM
To: Andy Seaborne <an...@apache.org>
Cc: users@jena.apache.org
Subject: RE: TDB2 Data Doesn't Persist

Hi Andy,

Thanks again for the reply. This seems quite odd to me, so let me check my understanding.

When persistence is not an issue, RDFS inferencing without axioms works fine in a named graph--actually, across three named graphs. I use one of the named graphs for the vocabulary, and two for data.

But if I want my named graph to persist, and because I am using inferencing, I have to define my named graph in the assembler (config file).

Question: Do I need to put the named graph URL in the config file? If so, I can't tell from the documentation where to put that. Insights appreciated.

Thanks,
Ted

Theodore Hills   
Consultant | Research   
Phone: +1 212 296-1833   
Theodore.Hills@morganstanley.com   
-----Original Message-----
From: Andy Seaborne <an...@apache.org>
Sent: Monday, October 17, 2022 4:25 PM
To: Hills, Theodore (Research) <Th...@morganstanley.com>
Cc: users@jena.apache.org
Subject: Re: TDB2 Data Doesn't Persist

Hi Theordore,

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

defines a dataset with just a default graph. It does not pass down named graphs. They end up in a temporary holder.

You can add the name graph to the ja:RDFDataset but you have to know it's name and define the inference. Inference is per-graph.

There is

https://jena.apache.org/documentation/rdfs/

# RDFS
:rdfsDataset rdf:type ja:DatasetRDFS ;
     ja:rdfsSchema <file:vocabulary.ttl>;
     ja:dataset --- some TDB2 database ---
     .

This applies RDFS - without axioms - so rdfs:subClassOf, rdf:subPropertyOf, rdfs:domain and rdfs:range - to all graphs in the ja:database.

The schema is fixed at startup.

     Andy

On 17/10/2022 14:39, Theodore.Hills@morganstanley.com wrote:
> Hi Andy,
> 
> Thank you for the prompt reply.
> 
> I deleted everything in my tdb2 directory in order to force Fuseki to recreate the database from scratch so I knew I was working from a clean slate.
> 
> I was able to duplicate your results, using my own D.ttl, which is below.
> 
> <http://triples.ms.com/msro/dummy> <http://www.w3.org/2001/XMLSchema#string> "dummy" .
> 
> I then loaded the dummy triple into a named graph using the curl command below.
> 
> curl -T D.ttl --header 'Content-type: text/turtle' \
>      'http://localhost:3030/msro/data?graph=https%3A%2F%2Ftriples.ms.com%2Fmsro%2F__dummy__'
> 
> I was able to dump the named graph using the command below.
> 
> curl 'http://localhost:3030/msro/data?graph=https%3A%2F%2Ftriples.ms.com%2Fmsro%2F__dummy__'
> 
> I then stopped and restarted Fuseki, and the triple in the named graph was gone. The triple in the default graph was still there.
> 
> Also, I monitored the size of Data-0001\nodes-data.obj at every step. Upon creation of a fresh database, it was 0 KB. It remained 0 KB even if I loaded my dummy triple into a named graph. Only when I loaded my dummy triple into the default graph did it grow to 1 KB. It remained 1KB across restarts.
> 
> So, the problem seems to be that triples in the default graph persist, but triples in named graphs do not.
> 
> The only inferencing I need is subclass inferencing in order for a query of this form to work:
>    ?s rdfs:subClassOf+ ?c .
> 
> Once I layered in the TransitiveReasoner in the config file, the above query worked fine in the midst of a complicated and well-tested query that runs fine on Stardog and MarkLogic. As mentioned, I was getting the desired results on Fuseki TDB2 as well. The only problem seems to be the lack of persistence for named graphs.
> 
> Thanks so much for your attention to this problem!
> 
> Theodore Hills
> Consultant | Research
> Phone: +1 212 296-1833
> Theodore.Hills@morganstanley.com
> -----Original Message-----
> From: Andy Seaborne <an...@apache.org>
> Sent: Saturday, October 15, 2022 5:41 AM
> To: users@jena.apache.org
> Subject: Re: TDB2 Data Doesn't Persist
> 
> Hi Theodore,
> 
> I tried your configuration and got persisted data.
> 
> I tried:
> 
> curl -T D.ttl --header 'Content-type: text/turtle' \
>       'http://localhost:3030/msro/data?default'
> 
> this appeared in the file:
> 
> [2022-10-15 10:36:19] Fuseki     INFO  [3] Body: Content-Length=338,
> Content-Type=text/turtle, Charset=null => Turtle : Count=4 Triples=4
> Quads=0
> 
> (reformatted for email).
> 
> then I stopped the server, restarted it and did
> 
>    curl 'http://localhost:3030/msro/data?default'
> 
> and got the data with inference output.
> 
> 
> How are you loading the data?
> 
> Looking in "C:\\Users\\hillsthe\\run\\data\\tdb2", there is a file Data-0001/nodes-data.obj. How big it is it after loading the data? You can look while the server is running. Does it shrink when the server is stopped? It's zero bytes for an empty database, non-zero otherwise.
> 
> ----
> 
> Also - for general information - you're using the transitive reasoner What inferences are you hoping to generate?
> 
>       Andy
> 
> On 14/10/2022 15:09, Theodore.Hills@morganstanley.com wrote:
>> Hello,
>>
>> I have Apache Jena Fuseki running on my localhost with TDB2 configured with inferencing. See entire config file below. I am running Fuseki server under Windows 10 with the following command line issued from a CMD prompt.
>>
>> C:\Users\hillsthe\apache-jena-fuseki-4.6.1\fuseki-server.bat --conf 
>> C:\Users\hillsthe\config.ttl
>>
>> I can do updates and queries and everything works as expected. However, if I stop the Fuseki server with a Control-C, and restart it with the above command, my graphs are empty. Any insights?
>>
>> Theodore Hills
>> Consultant | Research
>> Phone: +1 212 296-1833
>> Theodore.Hills@morganstanley.com<mailto:Theodore.Hills@morganstanley.
>> c
>> om>
>>
>> ## Fuseki Server configuration file.
>>
>> 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 tdb1:    http://jena.hpl.hp.com/2008/tdb#
>> PREFIX tdb2:    http://jena.apache.org/2016/tdb#
>> PREFIX ja:      http://jena.hpl.hp.com/2005/11/Assembler#
>> PREFIX :        <#>
>>
>>
>> <#service1> rdf:type fuseki:Service ;
>>       fuseki:name   "msro" ;       # http://host:port/msro
>>       fuseki:endpoint [     # http://host:port/msro/sparql?query=
>>           fuseki:operation fuseki:query ;
>>           fuseki:name "sparql"
>>       ] ;
>>       fuseki:endpoint [     # http://host:port/msro/query?query=
>>            # SPARQL query service (alt name)
>>           fuseki:operation fuseki:query ;
>>           fuseki:name "query"
>>       ] ;
>>
>>       fuseki:endpoint [     # http://host:port/msro/update?query=
>>            # SPARQL update service
>>           fuseki:operation fuseki:update ;
>>           fuseki:name "update"
>>       ] ;
>>
>>       fuseki:endpoint [
>>            # SPARQL Graph Store Protocol (read)
>>           fuseki:operation fuseki:gsp_r ;
>>           fuseki:name "get"
>>       ] ;
>>       fuseki:endpoint [
>>           # SPARQL Graph Store Protcol (read and write)
>>           # http://host:port/msro/data?default or http://host:port/msro/data?graph=<URL<http://host:port/msro/data?graph=%3cURL>>
>>           fuseki:operation fuseki:gsp_rw ;
>>           fuseki:name "data"
>>       ] ;
>>
>>       fuseki:dataset  <#dataset> ;
>>       .
>>
>> <#dataset> rdf:type ja:RDFDataset;
>>        ja:defaultGraph <#inferenceModel>
>>        .
>>
>> <#inferenceModel> rdf:type      ja:InfModel;
>>        ja:reasoner [ ja:reasonerURL http://jena.hpl.hp.com/2003/TransitiveReasoner ];
>>        ja:baseModel <#baseModel>;
>>        .
>>
>> <#baseModel> rdf:type tdb2:GraphTDB2;
>>        tdb2:dataset <#actualDataset> .
>>
>> <#actualDataset> rdf:type tdb2:DatasetTDB2;
>>        tdb2:location "C:\\Users\\hillsthe\\run\\data\\tdb2";
>>        .
>>
>>
>> ________________________________
>>
>> For important information including analyst certification and disclosures regarding specific companies, derivatives, or other instruments discussed in this email, please refer to the latest report, if attached and/or hyperlinked to this email, or by logging on to the Morgan Stanley Matrix Platform at http://matrix.ms.com/eqr/research . You may also refer to the Morgan Stanley Research Disclosure Website at http://www.morganstanley.com/eqr/disclosures/webapp/coverage. Morgan Stanley will make certain research products and announcements available only on the Morgan Stanley Matrix Platform.  The content provided in this email, including data or any attachments, is subject to the terms and conditions of use (available at https://ny.matrix.ms.com/matrix/portal/docs/terms/index.html#/terms/general ) applicable to research materials accessed through Matrix, including the terms regarding confidentiality and intellectual property rights. For access to the Morgan Stanley Matrix Platform please contact your sales representative or go to Matrix.
>>
>> NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.
>>
>> You may have certain rights regarding the information that Morgan Stanley collects about you. Please see our Privacy Pledge https://www.morganstanley.com/privacy-pledge for more information about your rights.
>>
> 
> 
> ----------------------------------------------------------------------
> ----------
> 
> For important information including analyst certification and disclosures regarding specific companies, derivatives, or other instruments discussed in this email, please refer to the latest report, if attached and/or hyperlinked to this email, or by logging on to the Morgan Stanley Matrix Platform at http://matrix.ms.com/eqr/research . You may also refer to the Morgan Stanley Research Disclosure Website at http://www.morganstanley.com/eqr/disclosures/webapp/coverage. Morgan Stanley will make certain research products and announcements available only on the Morgan Stanley Matrix Platform.  The content provided in this email, including data or any attachments, is subject to the terms and conditions of use (available at https://ny.matrix.ms.com/matrix/portal/docs/terms/index.html#/terms/general ) applicable to research materials accessed through Matrix, including the terms regarding confidentiality and intellectual property rights. For access to the Morgan Stanley Matrix Platform please contact your sales representative or go to Matrix.
> 
> NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.
> 
> You may have certain rights regarding the information that Morgan Stanley collects about you.  Please see our Privacy Pledge https://www.morganstanley.com/privacy-pledge for more information about your rights.
> 


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

For important information including analyst certification and disclosures regarding specific companies, derivatives, or other instruments discussed in this email, please refer to the latest report, if attached and/or hyperlinked to this email, or by logging on to the Morgan Stanley Matrix Platform at http://matrix.ms.com/eqr/research . You may also refer to the Morgan Stanley Research Disclosure Website at http://www.morganstanley.com/eqr/disclosures/webapp/coverage. Morgan Stanley will make certain research products and announcements available only on the Morgan Stanley Matrix Platform.  The content provided in this email, including data or any attachments, is subject to the terms and conditions of use (available at https://ny.matrix.ms.com/matrix/portal/docs/terms/index.html#/terms/general ) applicable to research materials accessed through Matrix, including the terms regarding confidentiality and intellectual property rights. For access to the Morgan Stanley Matrix Platform please contact your sales representative or go to Matrix.

NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.

You may have certain rights regarding the information that Morgan Stanley collects about you.  Please see our Privacy Pledge https://www.morganstanley.com/privacy-pledge for more information about your rights.


RE: TDB2 Data Doesn't Persist

Posted by "Theodore.Hills@morganstanley.com" <Th...@morganstanley.com>.
Hi Andy,

Thanks again for the reply. This seems quite odd to me, so let me check my understanding.

When persistence is not an issue, RDFS inferencing without axioms works fine in a named graph--actually, across three named graphs. I use one of the named graphs for the vocabulary, and two for data.

But if I want my named graph to persist, and because I am using inferencing, I have to define my named graph in the assembler (config file).

Question: Do I need to put the named graph URL in the config file? If so, I can't tell from the documentation where to put that. Insights appreciated.

Thanks,
Ted

Theodore Hills   
Consultant | Research   
Phone: +1 212 296-1833   
Theodore.Hills@morganstanley.com   
-----Original Message-----
From: Andy Seaborne <an...@apache.org> 
Sent: Monday, October 17, 2022 4:25 PM
To: Hills, Theodore (Research) <Th...@morganstanley.com>
Cc: users@jena.apache.org
Subject: Re: TDB2 Data Doesn't Persist

Hi Theordore,

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

defines a dataset with just a default graph. It does not pass down named graphs. They end up in a temporary holder.

You can add the name graph to the ja:RDFDataset but you have to know it's name and define the inference. Inference is per-graph.

There is

https://jena.apache.org/documentation/rdfs/

# RDFS
:rdfsDataset rdf:type ja:DatasetRDFS ;
     ja:rdfsSchema <file:vocabulary.ttl>;
     ja:dataset --- some TDB2 database ---
     .

This applies RDFS - without axioms - so rdfs:subClassOf, rdf:subPropertyOf, rdfs:domain and rdfs:range - to all graphs in the ja:database.

The schema is fixed at startup.

     Andy

On 17/10/2022 14:39, Theodore.Hills@morganstanley.com wrote:
> Hi Andy,
> 
> Thank you for the prompt reply.
> 
> I deleted everything in my tdb2 directory in order to force Fuseki to recreate the database from scratch so I knew I was working from a clean slate.
> 
> I was able to duplicate your results, using my own D.ttl, which is below.
> 
> <http://triples.ms.com/msro/dummy> <http://www.w3.org/2001/XMLSchema#string> "dummy" .
> 
> I then loaded the dummy triple into a named graph using the curl command below.
> 
> curl -T D.ttl --header 'Content-type: text/turtle' \
>      'http://localhost:3030/msro/data?graph=https%3A%2F%2Ftriples.ms.com%2Fmsro%2F__dummy__'
> 
> I was able to dump the named graph using the command below.
> 
> curl 'http://localhost:3030/msro/data?graph=https%3A%2F%2Ftriples.ms.com%2Fmsro%2F__dummy__'
> 
> I then stopped and restarted Fuseki, and the triple in the named graph was gone. The triple in the default graph was still there.
> 
> Also, I monitored the size of Data-0001\nodes-data.obj at every step. Upon creation of a fresh database, it was 0 KB. It remained 0 KB even if I loaded my dummy triple into a named graph. Only when I loaded my dummy triple into the default graph did it grow to 1 KB. It remained 1KB across restarts.
> 
> So, the problem seems to be that triples in the default graph persist, but triples in named graphs do not.
> 
> The only inferencing I need is subclass inferencing in order for a query of this form to work:
>    ?s rdfs:subClassOf+ ?c .
> 
> Once I layered in the TransitiveReasoner in the config file, the above query worked fine in the midst of a complicated and well-tested query that runs fine on Stardog and MarkLogic. As mentioned, I was getting the desired results on Fuseki TDB2 as well. The only problem seems to be the lack of persistence for named graphs.
> 
> Thanks so much for your attention to this problem!
> 
> Theodore Hills
> Consultant | Research
> Phone: +1 212 296-1833
> Theodore.Hills@morganstanley.com
> -----Original Message-----
> From: Andy Seaborne <an...@apache.org>
> Sent: Saturday, October 15, 2022 5:41 AM
> To: users@jena.apache.org
> Subject: Re: TDB2 Data Doesn't Persist
> 
> Hi Theodore,
> 
> I tried your configuration and got persisted data.
> 
> I tried:
> 
> curl -T D.ttl --header 'Content-type: text/turtle' \
>       'http://localhost:3030/msro/data?default'
> 
> this appeared in the file:
> 
> [2022-10-15 10:36:19] Fuseki     INFO  [3] Body: Content-Length=338,
> Content-Type=text/turtle, Charset=null => Turtle : Count=4 Triples=4 
> Quads=0
> 
> (reformatted for email).
> 
> then I stopped the server, restarted it and did
> 
>    curl 'http://localhost:3030/msro/data?default'
> 
> and got the data with inference output.
> 
> 
> How are you loading the data?
> 
> Looking in "C:\\Users\\hillsthe\\run\\data\\tdb2", there is a file Data-0001/nodes-data.obj. How big it is it after loading the data? You can look while the server is running. Does it shrink when the server is stopped? It's zero bytes for an empty database, non-zero otherwise.
> 
> ----
> 
> Also - for general information - you're using the transitive reasoner What inferences are you hoping to generate?
> 
>       Andy
> 
> On 14/10/2022 15:09, Theodore.Hills@morganstanley.com wrote:
>> Hello,
>>
>> I have Apache Jena Fuseki running on my localhost with TDB2 configured with inferencing. See entire config file below. I am running Fuseki server under Windows 10 with the following command line issued from a CMD prompt.
>>
>> C:\Users\hillsthe\apache-jena-fuseki-4.6.1\fuseki-server.bat --conf 
>> C:\Users\hillsthe\config.ttl
>>
>> I can do updates and queries and everything works as expected. However, if I stop the Fuseki server with a Control-C, and restart it with the above command, my graphs are empty. Any insights?
>>
>> Theodore Hills
>> Consultant | Research
>> Phone: +1 212 296-1833
>> Theodore.Hills@morganstanley.com<mailto:Theodore.Hills@morganstanley.
>> c
>> om>
>>
>> ## Fuseki Server configuration file.
>>
>> 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 tdb1:    http://jena.hpl.hp.com/2008/tdb#
>> PREFIX tdb2:    http://jena.apache.org/2016/tdb#
>> PREFIX ja:      http://jena.hpl.hp.com/2005/11/Assembler#
>> PREFIX :        <#>
>>
>>
>> <#service1> rdf:type fuseki:Service ;
>>       fuseki:name   "msro" ;       # http://host:port/msro
>>       fuseki:endpoint [     # http://host:port/msro/sparql?query=
>>           fuseki:operation fuseki:query ;
>>           fuseki:name "sparql"
>>       ] ;
>>       fuseki:endpoint [     # http://host:port/msro/query?query=
>>            # SPARQL query service (alt name)
>>           fuseki:operation fuseki:query ;
>>           fuseki:name "query"
>>       ] ;
>>
>>       fuseki:endpoint [     # http://host:port/msro/update?query=
>>            # SPARQL update service
>>           fuseki:operation fuseki:update ;
>>           fuseki:name "update"
>>       ] ;
>>
>>       fuseki:endpoint [
>>            # SPARQL Graph Store Protocol (read)
>>           fuseki:operation fuseki:gsp_r ;
>>           fuseki:name "get"
>>       ] ;
>>       fuseki:endpoint [
>>           # SPARQL Graph Store Protcol (read and write)
>>           # http://host:port/msro/data?default or http://host:port/msro/data?graph=<URL<http://host:port/msro/data?graph=%3cURL>>
>>           fuseki:operation fuseki:gsp_rw ;
>>           fuseki:name "data"
>>       ] ;
>>
>>       fuseki:dataset  <#dataset> ;
>>       .
>>
>> <#dataset> rdf:type ja:RDFDataset;
>>        ja:defaultGraph <#inferenceModel>
>>        .
>>
>> <#inferenceModel> rdf:type      ja:InfModel;
>>        ja:reasoner [ ja:reasonerURL http://jena.hpl.hp.com/2003/TransitiveReasoner ];
>>        ja:baseModel <#baseModel>;
>>        .
>>
>> <#baseModel> rdf:type tdb2:GraphTDB2;
>>        tdb2:dataset <#actualDataset> .
>>
>> <#actualDataset> rdf:type tdb2:DatasetTDB2;
>>        tdb2:location "C:\\Users\\hillsthe\\run\\data\\tdb2";
>>        .
>>
>>
>> ________________________________
>>
>> For important information including analyst certification and disclosures regarding specific companies, derivatives, or other instruments discussed in this email, please refer to the latest report, if attached and/or hyperlinked to this email, or by logging on to the Morgan Stanley Matrix Platform at http://matrix.ms.com/eqr/research . You may also refer to the Morgan Stanley Research Disclosure Website at http://www.morganstanley.com/eqr/disclosures/webapp/coverage. Morgan Stanley will make certain research products and announcements available only on the Morgan Stanley Matrix Platform.  The content provided in this email, including data or any attachments, is subject to the terms and conditions of use (available at https://ny.matrix.ms.com/matrix/portal/docs/terms/index.html#/terms/general ) applicable to research materials accessed through Matrix, including the terms regarding confidentiality and intellectual property rights. For access to the Morgan Stanley Matrix Platform please contact your sales representative or go to Matrix.
>>
>> NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.
>>
>> You may have certain rights regarding the information that Morgan Stanley collects about you. Please see our Privacy Pledge https://www.morganstanley.com/privacy-pledge for more information about your rights.
>>
> 
> 
> ----------------------------------------------------------------------
> ----------
> 
> For important information including analyst certification and disclosures regarding specific companies, derivatives, or other instruments discussed in this email, please refer to the latest report, if attached and/or hyperlinked to this email, or by logging on to the Morgan Stanley Matrix Platform at http://matrix.ms.com/eqr/research . You may also refer to the Morgan Stanley Research Disclosure Website at http://www.morganstanley.com/eqr/disclosures/webapp/coverage. Morgan Stanley will make certain research products and announcements available only on the Morgan Stanley Matrix Platform.  The content provided in this email, including data or any attachments, is subject to the terms and conditions of use (available at https://ny.matrix.ms.com/matrix/portal/docs/terms/index.html#/terms/general ) applicable to research materials accessed through Matrix, including the terms regarding confidentiality and intellectual property rights. For access to the Morgan Stanley Matrix Platform please contact your sales representative or go to Matrix.
> 
> NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.
> 
> You may have certain rights regarding the information that Morgan Stanley collects about you.  Please see our Privacy Pledge https://www.morganstanley.com/privacy-pledge for more information about your rights.
> 


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

For important information including analyst certification and disclosures regarding specific companies, derivatives, or other instruments discussed in this email, please refer to the latest report, if attached and/or hyperlinked to this email, or by logging on to the Morgan Stanley Matrix Platform at http://matrix.ms.com/eqr/research . You may also refer to the Morgan Stanley Research Disclosure Website at http://www.morganstanley.com/eqr/disclosures/webapp/coverage. Morgan Stanley will make certain research products and announcements available only on the Morgan Stanley Matrix Platform.  The content provided in this email, including data or any attachments, is subject to the terms and conditions of use (available at https://ny.matrix.ms.com/matrix/portal/docs/terms/index.html#/terms/general ) applicable to research materials accessed through Matrix, including the terms regarding confidentiality and intellectual property rights. For access to the Morgan Stanley Matrix Platform please contact your sales representative or go to Matrix.

NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.

You may have certain rights regarding the information that Morgan Stanley collects about you.  Please see our Privacy Pledge https://www.morganstanley.com/privacy-pledge for more information about your rights.


Re: TDB2 Data Doesn't Persist

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

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

defines a dataset with just a default graph. It does not pass down named 
graphs. They end up in a temporary holder.

You can add the name graph to the ja:RDFDataset but you have to know 
it's name and define the inference. Inference is per-graph.

There is

https://jena.apache.org/documentation/rdfs/

# RDFS
:rdfsDataset rdf:type ja:DatasetRDFS ;
     ja:rdfsSchema <file:vocabulary.ttl>;
     ja:dataset --- some TDB2 database ---
     .

This applies RDFS - without axioms - so rdfs:subClassOf, 
rdf:subPropertyOf, rdfs:domain and rdfs:range - to all graphs in the 
ja:database.

The schema is fixed at startup.

     Andy

On 17/10/2022 14:39, Theodore.Hills@morganstanley.com wrote:
> Hi Andy,
> 
> Thank you for the prompt reply.
> 
> I deleted everything in my tdb2 directory in order to force Fuseki to recreate the database from scratch so I knew I was working from a clean slate.
> 
> I was able to duplicate your results, using my own D.ttl, which is below.
> 
> <http://triples.ms.com/msro/dummy> <http://www.w3.org/2001/XMLSchema#string> "dummy" .
> 
> I then loaded the dummy triple into a named graph using the curl command below.
> 
> curl -T D.ttl --header 'Content-type: text/turtle' \
>      'http://localhost:3030/msro/data?graph=https%3A%2F%2Ftriples.ms.com%2Fmsro%2F__dummy__'
> 
> I was able to dump the named graph using the command below.
> 
> curl 'http://localhost:3030/msro/data?graph=https%3A%2F%2Ftriples.ms.com%2Fmsro%2F__dummy__'
> 
> I then stopped and restarted Fuseki, and the triple in the named graph was gone. The triple in the default graph was still there.
> 
> Also, I monitored the size of Data-0001\nodes-data.obj at every step. Upon creation of a fresh database, it was 0 KB. It remained 0 KB even if I loaded my dummy triple into a named graph. Only when I loaded my dummy triple into the default graph did it grow to 1 KB. It remained 1KB across restarts.
> 
> So, the problem seems to be that triples in the default graph persist, but triples in named graphs do not.
> 
> The only inferencing I need is subclass inferencing in order for a query of this form to work:
>    ?s rdfs:subClassOf+ ?c .
> 
> Once I layered in the TransitiveReasoner in the config file, the above query worked fine in the midst of a complicated and well-tested query that runs fine on Stardog and MarkLogic. As mentioned, I was getting the desired results on Fuseki TDB2 as well. The only problem seems to be the lack of persistence for named graphs.
> 
> Thanks so much for your attention to this problem!
> 
> Theodore Hills
> Consultant | Research
> Phone: +1 212 296-1833
> Theodore.Hills@morganstanley.com
> -----Original Message-----
> From: Andy Seaborne <an...@apache.org>
> Sent: Saturday, October 15, 2022 5:41 AM
> To: users@jena.apache.org
> Subject: Re: TDB2 Data Doesn't Persist
> 
> Hi Theodore,
> 
> I tried your configuration and got persisted data.
> 
> I tried:
> 
> curl -T D.ttl --header 'Content-type: text/turtle' \
>       'http://localhost:3030/msro/data?default'
> 
> this appeared in the file:
> 
> [2022-10-15 10:36:19] Fuseki     INFO  [3] Body: Content-Length=338,
> Content-Type=text/turtle, Charset=null => Turtle : Count=4 Triples=4 Quads=0
> 
> (reformatted for email).
> 
> then I stopped the server, restarted it and did
> 
>    curl 'http://localhost:3030/msro/data?default'
> 
> and got the data with inference output.
> 
> 
> How are you loading the data?
> 
> Looking in "C:\\Users\\hillsthe\\run\\data\\tdb2", there is a file Data-0001/nodes-data.obj. How big it is it after loading the data? You can look while the server is running. Does it shrink when the server is stopped? It's zero bytes for an empty database, non-zero otherwise.
> 
> ----
> 
> Also - for general information - you're using the transitive reasoner What inferences are you hoping to generate?
> 
>       Andy
> 
> On 14/10/2022 15:09, Theodore.Hills@morganstanley.com wrote:
>> Hello,
>>
>> I have Apache Jena Fuseki running on my localhost with TDB2 configured with inferencing. See entire config file below. I am running Fuseki server under Windows 10 with the following command line issued from a CMD prompt.
>>
>> C:\Users\hillsthe\apache-jena-fuseki-4.6.1\fuseki-server.bat --conf
>> C:\Users\hillsthe\config.ttl
>>
>> I can do updates and queries and everything works as expected. However, if I stop the Fuseki server with a Control-C, and restart it with the above command, my graphs are empty. Any insights?
>>
>> Theodore Hills
>> Consultant | Research
>> Phone: +1 212 296-1833
>> Theodore.Hills@morganstanley.com<mailto:Theodore.Hills@morganstanley.c
>> om>
>>
>> ## Fuseki Server configuration file.
>>
>> 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 tdb1:    http://jena.hpl.hp.com/2008/tdb#
>> PREFIX tdb2:    http://jena.apache.org/2016/tdb#
>> PREFIX ja:      http://jena.hpl.hp.com/2005/11/Assembler#
>> PREFIX :        <#>
>>
>>
>> <#service1> rdf:type fuseki:Service ;
>>       fuseki:name   "msro" ;       # http://host:port/msro
>>       fuseki:endpoint [     # http://host:port/msro/sparql?query=
>>           fuseki:operation fuseki:query ;
>>           fuseki:name "sparql"
>>       ] ;
>>       fuseki:endpoint [     # http://host:port/msro/query?query=
>>            # SPARQL query service (alt name)
>>           fuseki:operation fuseki:query ;
>>           fuseki:name "query"
>>       ] ;
>>
>>       fuseki:endpoint [     # http://host:port/msro/update?query=
>>            # SPARQL update service
>>           fuseki:operation fuseki:update ;
>>           fuseki:name "update"
>>       ] ;
>>
>>       fuseki:endpoint [
>>            # SPARQL Graph Store Protocol (read)
>>           fuseki:operation fuseki:gsp_r ;
>>           fuseki:name "get"
>>       ] ;
>>       fuseki:endpoint [
>>           # SPARQL Graph Store Protcol (read and write)
>>           # http://host:port/msro/data?default or http://host:port/msro/data?graph=<URL<http://host:port/msro/data?graph=%3cURL>>
>>           fuseki:operation fuseki:gsp_rw ;
>>           fuseki:name "data"
>>       ] ;
>>
>>       fuseki:dataset  <#dataset> ;
>>       .
>>
>> <#dataset> rdf:type ja:RDFDataset;
>>        ja:defaultGraph <#inferenceModel>
>>        .
>>
>> <#inferenceModel> rdf:type      ja:InfModel;
>>        ja:reasoner [ ja:reasonerURL http://jena.hpl.hp.com/2003/TransitiveReasoner ];
>>        ja:baseModel <#baseModel>;
>>        .
>>
>> <#baseModel> rdf:type tdb2:GraphTDB2;
>>        tdb2:dataset <#actualDataset> .
>>
>> <#actualDataset> rdf:type tdb2:DatasetTDB2;
>>        tdb2:location "C:\\Users\\hillsthe\\run\\data\\tdb2";
>>        .
>>
>>
>> ________________________________
>>
>> For important information including analyst certification and disclosures regarding specific companies, derivatives, or other instruments discussed in this email, please refer to the latest report, if attached and/or hyperlinked to this email, or by logging on to the Morgan Stanley Matrix Platform at http://matrix.ms.com/eqr/research . You may also refer to the Morgan Stanley Research Disclosure Website at http://www.morganstanley.com/eqr/disclosures/webapp/coverage. Morgan Stanley will make certain research products and announcements available only on the Morgan Stanley Matrix Platform.  The content provided in this email, including data or any attachments, is subject to the terms and conditions of use (available at https://ny.matrix.ms.com/matrix/portal/docs/terms/index.html#/terms/general ) applicable to research materials accessed through Matrix, including the terms regarding confidentiality and intellectual property rights. For access to the Morgan Stanley Matrix Platform please contact your sales representative or go to Matrix.
>>
>> NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.
>>
>> You may have certain rights regarding the information that Morgan Stanley collects about you. Please see our Privacy Pledge https://www.morganstanley.com/privacy-pledge for more information about your rights.
>>
> 
> 
> --------------------------------------------------------------------------------
> 
> For important information including analyst certification and disclosures regarding specific companies, derivatives, or other instruments discussed in this email, please refer to the latest report, if attached and/or hyperlinked to this email, or by logging on to the Morgan Stanley Matrix Platform at http://matrix.ms.com/eqr/research . You may also refer to the Morgan Stanley Research Disclosure Website at http://www.morganstanley.com/eqr/disclosures/webapp/coverage. Morgan Stanley will make certain research products and announcements available only on the Morgan Stanley Matrix Platform.  The content provided in this email, including data or any attachments, is subject to the terms and conditions of use (available at https://ny.matrix.ms.com/matrix/portal/docs/terms/index.html#/terms/general ) applicable to research materials accessed through Matrix, including the terms regarding confidentiality and intellectual property rights. For access to the Morgan Stanley Matrix Platform please contact your sales representative or go to Matrix.
> 
> NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.
> 
> You may have certain rights regarding the information that Morgan Stanley collects about you.  Please see our Privacy Pledge https://www.morganstanley.com/privacy-pledge for more information about your rights.
> 

RE: TDB2 Data Doesn't Persist

Posted by "Theodore.Hills@morganstanley.com" <Th...@morganstanley.com>.
Hi Andy,

Thank you for the prompt reply.

I deleted everything in my tdb2 directory in order to force Fuseki to recreate the database from scratch so I knew I was working from a clean slate.

I was able to duplicate your results, using my own D.ttl, which is below.

<http://triples.ms.com/msro/dummy> <http://www.w3.org/2001/XMLSchema#string> "dummy" .

I then loaded the dummy triple into a named graph using the curl command below.

curl -T D.ttl --header 'Content-type: text/turtle' \
    'http://localhost:3030/msro/data?graph=https%3A%2F%2Ftriples.ms.com%2Fmsro%2F__dummy__'

I was able to dump the named graph using the command below.

curl 'http://localhost:3030/msro/data?graph=https%3A%2F%2Ftriples.ms.com%2Fmsro%2F__dummy__'

I then stopped and restarted Fuseki, and the triple in the named graph was gone. The triple in the default graph was still there.

Also, I monitored the size of Data-0001\nodes-data.obj at every step. Upon creation of a fresh database, it was 0 KB. It remained 0 KB even if I loaded my dummy triple into a named graph. Only when I loaded my dummy triple into the default graph did it grow to 1 KB. It remained 1KB across restarts.

So, the problem seems to be that triples in the default graph persist, but triples in named graphs do not.

The only inferencing I need is subclass inferencing in order for a query of this form to work:
  ?s rdfs:subClassOf+ ?c .

Once I layered in the TransitiveReasoner in the config file, the above query worked fine in the midst of a complicated and well-tested query that runs fine on Stardog and MarkLogic. As mentioned, I was getting the desired results on Fuseki TDB2 as well. The only problem seems to be the lack of persistence for named graphs.

Thanks so much for your attention to this problem!

Theodore Hills   
Consultant | Research   
Phone: +1 212 296-1833   
Theodore.Hills@morganstanley.com   
-----Original Message-----
From: Andy Seaborne <an...@apache.org> 
Sent: Saturday, October 15, 2022 5:41 AM
To: users@jena.apache.org
Subject: Re: TDB2 Data Doesn't Persist

Hi Theodore,

I tried your configuration and got persisted data.

I tried:

curl -T D.ttl --header 'Content-type: text/turtle' \
     'http://localhost:3030/msro/data?default'

this appeared in the file:

[2022-10-15 10:36:19] Fuseki     INFO  [3] Body: Content-Length=338, 
Content-Type=text/turtle, Charset=null => Turtle : Count=4 Triples=4 Quads=0

(reformatted for email).

then I stopped the server, restarted it and did

  curl 'http://localhost:3030/msro/data?default'

and got the data with inference output.


How are you loading the data?

Looking in "C:\\Users\\hillsthe\\run\\data\\tdb2", there is a file Data-0001/nodes-data.obj. How big it is it after loading the data? You can look while the server is running. Does it shrink when the server is stopped? It's zero bytes for an empty database, non-zero otherwise.

----

Also - for general information - you're using the transitive reasoner What inferences are you hoping to generate?

     Andy

On 14/10/2022 15:09, Theodore.Hills@morganstanley.com wrote:
> Hello,
> 
> I have Apache Jena Fuseki running on my localhost with TDB2 configured with inferencing. See entire config file below. I am running Fuseki server under Windows 10 with the following command line issued from a CMD prompt.
> 
> C:\Users\hillsthe\apache-jena-fuseki-4.6.1\fuseki-server.bat --conf 
> C:\Users\hillsthe\config.ttl
> 
> I can do updates and queries and everything works as expected. However, if I stop the Fuseki server with a Control-C, and restart it with the above command, my graphs are empty. Any insights?
> 
> Theodore Hills
> Consultant | Research
> Phone: +1 212 296-1833
> Theodore.Hills@morganstanley.com<mailto:Theodore.Hills@morganstanley.c
> om>
> 
> ## Fuseki Server configuration file.
> 
> 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 tdb1:    http://jena.hpl.hp.com/2008/tdb#
> PREFIX tdb2:    http://jena.apache.org/2016/tdb#
> PREFIX ja:      http://jena.hpl.hp.com/2005/11/Assembler#
> PREFIX :        <#>
> 
> 
> <#service1> rdf:type fuseki:Service ;
>      fuseki:name   "msro" ;       # http://host:port/msro
>      fuseki:endpoint [     # http://host:port/msro/sparql?query=
>          fuseki:operation fuseki:query ;
>          fuseki:name "sparql"
>      ] ;
>      fuseki:endpoint [     # http://host:port/msro/query?query=
>           # SPARQL query service (alt name)
>          fuseki:operation fuseki:query ;
>          fuseki:name "query"
>      ] ;
> 
>      fuseki:endpoint [     # http://host:port/msro/update?query=
>           # SPARQL update service
>          fuseki:operation fuseki:update ;
>          fuseki:name "update"
>      ] ;
> 
>      fuseki:endpoint [
>           # SPARQL Graph Store Protocol (read)
>          fuseki:operation fuseki:gsp_r ;
>          fuseki:name "get"
>      ] ;
>      fuseki:endpoint [
>          # SPARQL Graph Store Protcol (read and write)
>          # http://host:port/msro/data?default or http://host:port/msro/data?graph=<URL<http://host:port/msro/data?graph=%3cURL>>
>          fuseki:operation fuseki:gsp_rw ;
>          fuseki:name "data"
>      ] ;
> 
>      fuseki:dataset  <#dataset> ;
>      .
> 
> <#dataset> rdf:type ja:RDFDataset;
>       ja:defaultGraph <#inferenceModel>
>       .
> 
> <#inferenceModel> rdf:type      ja:InfModel;
>       ja:reasoner [ ja:reasonerURL http://jena.hpl.hp.com/2003/TransitiveReasoner ];
>       ja:baseModel <#baseModel>;
>       .
> 
> <#baseModel> rdf:type tdb2:GraphTDB2;
>       tdb2:dataset <#actualDataset> .
> 
> <#actualDataset> rdf:type tdb2:DatasetTDB2;
>       tdb2:location "C:\\Users\\hillsthe\\run\\data\\tdb2";
>       .
> 
> 
> ________________________________
> 
> For important information including analyst certification and disclosures regarding specific companies, derivatives, or other instruments discussed in this email, please refer to the latest report, if attached and/or hyperlinked to this email, or by logging on to the Morgan Stanley Matrix Platform at http://matrix.ms.com/eqr/research . You may also refer to the Morgan Stanley Research Disclosure Website at http://www.morganstanley.com/eqr/disclosures/webapp/coverage. Morgan Stanley will make certain research products and announcements available only on the Morgan Stanley Matrix Platform.  The content provided in this email, including data or any attachments, is subject to the terms and conditions of use (available at https://ny.matrix.ms.com/matrix/portal/docs/terms/index.html#/terms/general ) applicable to research materials accessed through Matrix, including the terms regarding confidentiality and intellectual property rights. For access to the Morgan Stanley Matrix Platform please contact your sales representative or go to Matrix.
> 
> NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.
> 
> You may have certain rights regarding the information that Morgan Stanley collects about you. Please see our Privacy Pledge https://www.morganstanley.com/privacy-pledge for more information about your rights.
> 


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

For important information including analyst certification and disclosures regarding specific companies, derivatives, or other instruments discussed in this email, please refer to the latest report, if attached and/or hyperlinked to this email, or by logging on to the Morgan Stanley Matrix Platform at http://matrix.ms.com/eqr/research . You may also refer to the Morgan Stanley Research Disclosure Website at http://www.morganstanley.com/eqr/disclosures/webapp/coverage. Morgan Stanley will make certain research products and announcements available only on the Morgan Stanley Matrix Platform.  The content provided in this email, including data or any attachments, is subject to the terms and conditions of use (available at https://ny.matrix.ms.com/matrix/portal/docs/terms/index.html#/terms/general ) applicable to research materials accessed through Matrix, including the terms regarding confidentiality and intellectual property rights. For access to the Morgan Stanley Matrix Platform please contact your sales representative or go to Matrix.

NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.

You may have certain rights regarding the information that Morgan Stanley collects about you.  Please see our Privacy Pledge https://www.morganstanley.com/privacy-pledge for more information about your rights.


Re: TDB2 Data Doesn't Persist

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

I tried your configuration and got persisted data.

I tried:

curl -T D.ttl --header 'Content-type: text/turtle' \
     'http://localhost:3030/msro/data?default'

this appeared in the file:

[2022-10-15 10:36:19] Fuseki     INFO  [3] Body: Content-Length=338, 
Content-Type=text/turtle, Charset=null => Turtle : Count=4 Triples=4 Quads=0

(reformatted for email).

then I stopped the server, restarted it and did

  curl 'http://localhost:3030/msro/data?default'

and got the data with inference output.


How are you loading the data?

Looking in "C:\\Users\\hillsthe\\run\\data\\tdb2", there is a file
Data-0001/nodes-data.obj. How big it is it after loading the data? You 
can look while the server is running. Does it shrink when the server is 
stopped? It's zero bytes for an empty database, non-zero otherwise.

----

Also - for general information - you're using the transitive reasoner 
What inferences are you hoping to generate?

     Andy

On 14/10/2022 15:09, Theodore.Hills@morganstanley.com wrote:
> Hello,
> 
> I have Apache Jena Fuseki running on my localhost with TDB2 configured with inferencing. See entire config file below. I am running Fuseki server under Windows 10 with the following command line issued from a CMD prompt.
> 
> C:\Users\hillsthe\apache-jena-fuseki-4.6.1\fuseki-server.bat --conf C:\Users\hillsthe\config.ttl
> 
> I can do updates and queries and everything works as expected. However, if I stop the Fuseki server with a Control-C, and restart it with the above command, my graphs are empty. Any insights?
> 
> Theodore Hills
> Consultant | Research
> Phone: +1 212 296-1833
> Theodore.Hills@morganstanley.com<ma...@morganstanley.com>
> 
> ## Fuseki Server configuration file.
> 
> 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 tdb1:    http://jena.hpl.hp.com/2008/tdb#
> PREFIX tdb2:    http://jena.apache.org/2016/tdb#
> PREFIX ja:      http://jena.hpl.hp.com/2005/11/Assembler#
> PREFIX :        <#>
> 
> 
> <#service1> rdf:type fuseki:Service ;
>      fuseki:name   "msro" ;       # http://host:port/msro
>      fuseki:endpoint [     # http://host:port/msro/sparql?query=
>          fuseki:operation fuseki:query ;
>          fuseki:name "sparql"
>      ] ;
>      fuseki:endpoint [     # http://host:port/msro/query?query=
>           # SPARQL query service (alt name)
>          fuseki:operation fuseki:query ;
>          fuseki:name "query"
>      ] ;
> 
>      fuseki:endpoint [     # http://host:port/msro/update?query=
>           # SPARQL update service
>          fuseki:operation fuseki:update ;
>          fuseki:name "update"
>      ] ;
> 
>      fuseki:endpoint [
>           # SPARQL Graph Store Protocol (read)
>          fuseki:operation fuseki:gsp_r ;
>          fuseki:name "get"
>      ] ;
>      fuseki:endpoint [
>          # SPARQL Graph Store Protcol (read and write)
>          # http://host:port/msro/data?default or http://host:port/msro/data?graph=<URL<http://host:port/msro/data?graph=%3cURL>>
>          fuseki:operation fuseki:gsp_rw ;
>          fuseki:name "data"
>      ] ;
> 
>      fuseki:dataset  <#dataset> ;
>      .
> 
> <#dataset> rdf:type ja:RDFDataset;
>       ja:defaultGraph <#inferenceModel>
>       .
> 
> <#inferenceModel> rdf:type      ja:InfModel;
>       ja:reasoner [ ja:reasonerURL http://jena.hpl.hp.com/2003/TransitiveReasoner ];
>       ja:baseModel <#baseModel>;
>       .
> 
> <#baseModel> rdf:type tdb2:GraphTDB2;
>       tdb2:dataset <#actualDataset> .
> 
> <#actualDataset> rdf:type tdb2:DatasetTDB2;
>       tdb2:location "C:\\Users\\hillsthe\\run\\data\\tdb2";
>       .
> 
> 
> ________________________________
> 
> For important information including analyst certification and disclosures regarding specific companies, derivatives, or other instruments discussed in this email, please refer to the latest report, if attached and/or hyperlinked to this email, or by logging on to the Morgan Stanley Matrix Platform at http://matrix.ms.com/eqr/research . You may also refer to the Morgan Stanley Research Disclosure Website at http://www.morganstanley.com/eqr/disclosures/webapp/coverage. Morgan Stanley will make certain research products and announcements available only on the Morgan Stanley Matrix Platform.  The content provided in this email, including data or any attachments, is subject to the terms and conditions of use (available at https://ny.matrix.ms.com/matrix/portal/docs/terms/index.html#/terms/general ) applicable to research materials accessed through Matrix, including the terms regarding confidentiality and intellectual property rights. For access to the Morgan Stanley Matrix Platform please contact your sales representative or go to Matrix.
> 
> NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.
> 
> You may have certain rights regarding the information that Morgan Stanley collects about you. Please see our Privacy Pledge https://www.morganstanley.com/privacy-pledge for more information about your rights.
>