On 21/06/17 16:36, Andy Seaborne wrote:
Hi Rui,

It is not currently possible to have newly created graph automatically be inference graphs.

What sort of rules do you have in mind? forward or backward?

----

I took a look at what it might take: it needs coding. (Dave, please check what I discovered when you have a moment (!!)).

Not sure I fully understand Rui's use case but ...

DatasetGraphMap is the basic implementation of DatasetGraph which is a collection individual graph. One argument to the constructor is a GraphMaker.

So provide a GraphMaker that adds the inference capabalities makes a new Graph which is the inference graph over

I think Rui needs inference over a union of all the graphs in his TDB rather than separate per-graph inference, but wants to be able to update graphs separately through fuseki. If so then he may not need the full dynamic construction of new InfGraphs and so might not need GraphMakers.

This is making some assumptions:

* Inference does not span graphs.
* It's not inference over a default union graph - that has other considerations.
* The rules set isn't changing.

There is a specific issue for default union graph when changes happen. It is not going to see the changes that go into a named graph directly as it bypasses the default union graph.

The GraphMaker create graph need to call InfGraph.rebind() when the transaction commit occurs (in Fuseki, there is always a commit - it's always a transaction).

Yes, exactly. If the updates go into the TDB directly then the InfGraph (over the union) doesn't see the changes and would need a rebind() call.

In theory someone could write a new Dataset implementation that acted as a wrapper over a TDB plus a single InfGraph. The InfGraph would be configured with the TDB default union graph as it's base. The wrapper could pass updates to the TDB but present the InfGraph as its default graph. Any updates would need to trigger a rebind of InfGraph.

However, I see little value in that because the rebind() will cause the reasoner to start over and loose all the prior work so performance would be terrible.

Fundamentally the current inference engines are not well suited to a world of TDB-backed named graphs :(

Dave

On 20/06/17 22:05, Rui Zhang wrote:
Hi,
I face a problem, when I try to let my reasoner work on specific graph.
The process is this:
1. Initial the server by the attached ttl file. The file information is
attached below.
2. I know that the inference model has been built after initialization, and
I can use sparql to insert and select data by using fuseki.
     if I insert data into default graph, the inference results could be
obtained.
The question is that, if inserting data into new graphs, I can not make
the reasoner work on these graph any more, I'm trying to find a way to
solve it, because I want to clear the specific graph data and then insert
new information data frequently, and I also want to keep some basic
knowledge data in the default graph.



3. In the ttl configuration file, the "tdb:unionDefaultGraph true" is set,
the expected result should be the data from the union named graphs, if
selecting data in default. But the result is still from the original
default graph.

Could you help me figure out these problem?

Thanks and hoping for your reply!

Georege

@prefix fuseki:  <http://jena.apache.org/fuseki#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:   <http://www.w3.org/2000/01/rdf-schema#> .
@prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .
@prefix ja:      <http://jena.hpl.hp.com/2005/11/Assembler#> .
## ---------------------------------------------------------------
[] ja:loadClass "org.apache.jena.tdb.TDB" .
tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
tdb:GraphTDB    rdfs:subClassOf  ja:Model .

[] rdf:type fuseki:Server ;
    # Timeout - server-wide default: milliseconds.
    # Format 1: "1000" -- 1 second timeout
    # Format 2: "10000,60000" -- 10s timeout to first result, then 60s
timeout for the rest of query.
    # See java doc for ARQ.queryTimeout
# ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "10000" ] ;

    # ja:loadClass "your.code.Class" ;

    fuseki:services (
      <#reminer1>
    ) .

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


## In-memory, initially empty.
## This database set-up allows OWL inference.


<#rdf_dataset> rdf:type ja:RDFDataset ;
     ja:defaultGraph <#infGraph>;
     ##ja:defaultGraph <#modelDft>;
     .

<#infGraph> rdf:type ja:InfModel ;
         ja:reasoner [ ja:reasonerURL <http://jena.hpl.hp.com/2003/
GenericRuleReasoner> ];
         ja:rules: [ja:rulesFrom <file:./../rules/graphTest.rules>; ];
         ja:baseModel <#tdbGraph>;
     .

<#tdbGraph> rdf:type tdb:GraphTDB ;
     tdb:dataset <#tdb_datset> ;
     tdb:graphName <Graph_Test>;
     .

<#tdb_datset> rdf:type tdb:DatasetTDB ;
     tdb:location "db" ;
     tdb:unionDefaultGraph true ;
     .
## ---------------------------------------------------------------

Reply via email to