You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Sushanth Vaddaram <su...@gmail.com> on 2021/02/08 17:03:49 UTC

Graph in Memory

Hi,

We are using the following configuration where both the services dip and dipWithoutInf use the same databases

Now when dip_backup service which doesn't use reasoner updates the database, how can we tell the other service "dip" to infer from latest data and provide results from database rather than the memory where it created the graph previously

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

[] rdf:type fuseki:Server ;
   fuseki:services (	    
     <#dip>
     <#dipWithoutInf>
   ) .

# TDB
#[] ja:loadClass "org.apache.jena.tdb.TDB" .
#tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
#tdb:GraphTDB    rdfs:subClassOf  ja:Model .

## ---------------------------------------------------------------

<#dipWithoutInf> rdf:type fuseki:Service ;
    # URI of the dataset -- http://host:port/dip 
    fuseki:name                        "dip_backup" ; 
    fuseki:serviceQuery                "sparql" ;
    fuseki:serviceQuery                "query" ;
    fuseki:serviceUpdate               "update" ;
    fuseki:serviceUpload               "upload" ;
    fuseki:serviceReadWriteGraphStore  "data" ;     
    fuseki:serviceReadGraphStore       "get" ;
    fuseki:dataset           <#tdb_dataset_readwrite_without_inf>;
    .

<#tdb_dataset_readwrite_without_inf> rdf:type      tdb2:DatasetTDB2 ;
    tdb2:location "C:\\etc\\fuseki/databases/dip5";
    ## This is supported: tdb2:unionDefaultGraph true ;
	.

<#dip> rdf:type fuseki:Service ;
    # URI of the dataset -- http://host:port/dip 
    fuseki:name                        "dip" ; 
    fuseki:serviceQuery                "sparql" ;
    fuseki:serviceQuery                "query" ;
    fuseki:serviceUpdate               "update" ;
    fuseki:serviceUpload               "upload" ;
    fuseki:serviceReadWriteGraphStore  "data" ;     
    fuseki:serviceReadGraphStore       "get" ;
    fuseki:dataset                     <#dip_tbd> ;
    .

#TBD
<#dip_tbd> rdf:type ja:RDFDataset ;
     ja:defaultGraph <#infModel>  ;	 
	 tdb:fileMode "direct" ;
	 .

<#infModel>  a ja:InfModel ;
      ja:baseModel <#tdbGraph>;
      ja:reasoner
         [ja:reasonerURL
             <http://jena.hpl.hp.com/2003/OWLMicroFBRuleReasoner>].

<#tdbGraph>  rdf:type tdb2:GraphTDB ;
	tdb2:location "C:\\etc\\fuseki/databases/dip5" ;
	tdb2:unionDefaultGraph true ;

	.Thanks,
Sushanth Vadaram
	

Re: Graph in Memory

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

On 08/02/2021 17:03, Sushanth Vaddaram wrote:
> Hi,
> 
> We are using the following configuration where both the services dip and dipWithoutInf use the same databases
> 
> Now when dip_backup service which doesn't use reasoner updates the database, how can we tell the other service "dip" to infer from latest data and provide results from database rather than the memory where it created the graph previously

You should access (query and update) the database via the inference 
service otherwise the inference will not see the changes.

The direct route is only useful to see, not update, the un-inferred data 
if there are any forward rules. (All backwards rules might work.)

     Andy

> 
> @prefix :        <#> .
> @prefix fuseki:  <http://jena.apache.org/fuseki#> .
> @prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> @prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
> @prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .
> @prefix tdb2:  <http://jena.apache.org/2016/tdb#> .
> @prefix ja:      <http://jena.hpl.hp.com/2005/11/Assembler#> .
> 
> [] rdf:type fuseki:Server ;
>     fuseki:services (	
>       <#dip>
>       <#dipWithoutInf>
>     ) .
> 
> # TDB
> #[] ja:loadClass "org.apache.jena.tdb.TDB" .
> #tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
> #tdb:GraphTDB    rdfs:subClassOf  ja:Model .
> 
> ## ---------------------------------------------------------------
> 
> <#dipWithoutInf> rdf:type fuseki:Service ;
>      # URI of the dataset -- http://host:port/dip
>      fuseki:name                        "dip_backup" ;
>      fuseki:serviceQuery                "sparql" ;
>      fuseki:serviceQuery                "query" ;
>      fuseki:serviceUpdate               "update" ;
>      fuseki:serviceUpload               "upload" ;
>      fuseki:serviceReadWriteGraphStore  "data" ;
>      fuseki:serviceReadGraphStore       "get" ;
>      fuseki:dataset           <#tdb_dataset_readwrite_without_inf>;
>      .
> 
> <#tdb_dataset_readwrite_without_inf> rdf:type      tdb2:DatasetTDB2 ;
>      tdb2:location "C:\\etc\\fuseki/databases/dip5";
>      ## This is supported: tdb2:unionDefaultGraph true ;

The similar statement below on the graph below will have no effect.

> 	.
> 
> <#dip> rdf:type fuseki:Service ;
>      # URI of the dataset -- http://host:port/dip
>      fuseki:name                        "dip" ;
>      fuseki:serviceQuery                "sparql" ;
>      fuseki:serviceQuery                "query" ;
>      fuseki:serviceUpdate               "update" ;
>      fuseki:serviceUpload               "upload" ;
>      fuseki:serviceReadWriteGraphStore  "data" ;
>      fuseki:serviceReadGraphStore       "get" ;
>      fuseki:dataset                     <#dip_tbd> ;
>      .
> 
> #TBD
> <#dip_tbd> rdf:type ja:RDFDataset ;
>       ja:defaultGraph <#infModel>  ;	
> 	 tdb:fileMode "direct" ;
> 	 .
> 
> <#infModel>  a ja:InfModel ;
>        ja:baseModel <#tdbGraph>;
>        ja:reasoner
>           [ja:reasonerURL
>               <http://jena.hpl.hp.com/2003/OWLMicroFBRuleReasoner>].
> 
> <#tdbGraph>  rdf:type tdb2:GraphTDB ;
> 	tdb2:location "C:\\etc\\fuseki/databases/dip5" ;
> 	tdb2:unionDefaultGraph true ;

Applies to databases, not graphs.

> 
> 	.Thanks,
> Sushanth Vadaram
> 	
>