On 31/01/2019 17:57, ajs6f wrote:
2/ It is not possible in an assembler/Fuseki configuration file, to create a
new named graph and have a another inference graph put around that new graph at
runtime.
Just to pull on one of these threads, my understanding is that this essentially because
the assembler system works only by names. IOW, there's no such thing as a
"variable", and a blank node doesn't function as a slot (as it might in a
SPARQL query), just as an nameless node. So you have to know the specific name of any
specific named graph to which you want to refer. A named graph that doesn't yet exist and
may have any name at all when it does obviously doesn't fit into that.
Andy and other more knowledgeable people: is that correct?
The issue is that the assembler runs once at the start, builds some Java
structures based on that and does not get invoked when the new graph is
created later.
The issue is also that the union graph is partition - if a single
concrete graph were used, it might well work.
I haven't worked out the other details like why persistence isn't
happening. Might be related to a union graph. Might be update
happening going around the inference graph.
If so, we might want to think about changing that as a _very long-term_ goal.
Having the ability to refer to resources in assembler RDF by triple pattern or
property matching or by some other means like that could be astoundingly
powerful for a lot of these use cases that we see involving complex setups with
multiple sources of data and inference. Yes, I realize that it would also be
pretty gosh dang difficult (how do you know when to apply or re-apply the
filtering/matching?) and might not be worth doing on those grounds alone, but I
might file a ticket just to not forget the possibility.
ajs6f
On Jan 31, 2019, at 12:41 PM, Andy Seaborne <a...@apache.org> wrote:
Hi Pierre,
A few points to start with:
1/ For my general understanding of how we might take the inferene provision
further in jena, what inferences are you particularly interested in?
2/ It is not possible in an assembler/Fuseki configuration file, to create a
new named graph and have a another inference graph put around that new graph at
runtime.
3/ The union graph can't be updated. It's a read-only union.
4/ "ERROR Exception in initialization: caught: Not in tramsaction"
Do you have the stacktrace for this?
Inline questions about attempt 1.
Andy
On 31/01/2019 15:00, Pierre Grenon wrote:
Hello,
I am trying to:
Set up Fuseki2 with inference and a TDB2 dataset in which can be persisted
named graphs created with SPARQL Update.
This is in order to:
- maintain a set of ontologies in a named graph
- maintain datasets in a number of named graphs
- perform reasoning in the union graphs
The assumption is that all data is persisted in a given TDB2 database.
The higher purpose is to use reasoning over ontologies when querying over
instance data located in named graphs. I think this is conceptually what is
discussed here:
Subject Re: Ontologies and model data
Date Mon, 03 Jun 2013 20:26:18 GMT
http://mail-archives.apache.org/mod_mbox/jena-users/201306.mbox/%3c51acfbea.2010...@apache.org%3E
The set up above is what comes across as a way of achieving this higher goal but I am
not sure either that it is the best set up. Everything I have tried to do allows me
to either perform inferences in <urn:x-arq:UnionGraph> or to persist triples in
named graphs in a TDB2 database, but not both.
My problem is:
I cannot find a correct configuration that allows me to persist named graphs
added to a TDB2 dataset and have inference at the same time.
Some attempts are documented below.
I have done most of my test in apache-jena-fuseki-3.8.0, my last tries were in
apache-jena-fuseki-3.10.0.
Would somebody be in a position to advise or provide a minimal working example?
With many thanks and best regards,
Pierre
###
Attempt 1:
# Example of a data service with SPARQL query abnd update on an
# inference model. Data is taken from TDB.
https://github.com/apache/jena/blob/master/jena-fuseki2/examples/service-inference-2.ttl
which I have adapted to use TDB2 (which basically meant updating the namespace
and the references to classes).
Outcome: This allows me to load data into named graphs and to perform
inferemce. However, it does not persist upon restarting the server.
Did you enable tdb:unionDefaultGraph as well, load the named graph and the
access the union?
What isn't persisted? Inferences or base data?
###
Attempt 2:
Define two services pointing to different graphs as advised in
Subject Re: Persisting named graphs in TDB with jena-fuseki
Date Thu, 10 Mar 2016 14:47:10 GMT
http://mail-archives.apache.org/mod_mbox/jena-users/201603.mbox/%3cd30738c0.64a6f%25rve...@dotnetrdf.org%3E
Outcome: I could only manage de3fining two independent services on two
independent datasets and couldn't figure out how to link the TDB2 and the
Inference graphs.
A reference to https://issues.apache.org/jira/browse/JENA-1122
is made in
http://mail-archives.apache.org/mod_mbox/jena-users/201603.mbox/%3c56ec23e3.9010...@apache.org%3E
But I do not understand what is said here.
###
Attempt 3:
I have found a config that seemed t make the link that was needed between
graphs in Attempt 2 in:
https://stackoverflow.com/questions/47568703/named-graphs-v-default-graph-behaviour-in-apache-jena-fuseki
which I have adapted to TDB2.
However, this gives me:
ERROR Exception in initialization: caught: Not in tramsaction
This also seems to have been a cut off point in the thread mentioned above
Subject Re: Configuring fuseki with TDB2 and OWL reasoning
Date Tue, 20 Feb 2018 10:55:13 GMT
http://mail-archives.apache.org/mod_mbox/jena-users/201802.mbox/%3C6d37a8c7-aca1-4c1c-0cd3-fa041ecc07eb%40apache.org%3E
This message refers to https://issues.apache.org/jira/browse/JENA-1492
which I do not understand but that comes across as having been resolved.
Indeed, I tested the config attached to it (probably as minimal example for
that issue) and it worked, but I don't think this is the config I need.
#### ATTEMPT 3 Config
@prefix : <http://base/#> .
@prefix tdb2: <http://jena.apache.org/2016/tdb#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .
# TDB2
#tdb2:DatasetTDB2 rdfs:subClassOf ja:RDFDataset .
#tdb2:GraphTDB rdfs:subClassOf ja:Model .
# Service 1: Dataset endpoint (no reasoning)
:dataService a fuseki:Service ;
fuseki:name "tdbEnpoint" ;
fuseki:serviceQuery "sparql", "query" ;
fuseki:serviceUpdate "update" ;
fuseki:dataset :tdbDataset ;
.
# Service 2: Reasoning endpoint
:reasoningService a fuseki:Service ;
fuseki:dataset :infDataset ;
fuseki:name "reasoningEndpoint" ;
fuseki:serviceQuery "query", "sparql" ;
fuseki:serviceReadGraphStore "get" ;
.
# Inference dataset
:infDataset rdf:type ja:RDFDataset ;
ja:defaultGraph :infModel ;
.
# Inference model
:infModel a ja:InfModel ;
ja:baseModel :g ;
ja:reasoner [
ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner> ;
] ;
.
# Intermediate graph referencing the default union graph
:g rdf:type tdb2:GraphTDB ;
tdb2:dataset :tdbDataset ;
tdb2:graphName <urn:x-arq:UnionGraph> ;
.
# The location of the TDB dataset
:tdbDataset rdf:type tdb2:DatasetTDB2 ;
tdb2:location "C:\\dev\\apache-jena-fuseki-3.8.0\\run/databases/weird7" ;
tdb2:unionDefaultGraph true ;
.
#### SERVER
...
[2019-01-31 13:54:58] Config INFO Load configuration:
file:///C:/dev/apache-jena-fuseki-3.10.0/run/configuration/weird7.ttl
[2019-01-31 13:54:58] Server ERROR Exception in initialization: caught: Not
in a transaction
[2019-01-31 13:54:58] WebAppContext WARN Failed startup of context
o.e.j.w.WebAppContext@6edc4161{Apache Jena Fuseki
Server,/,file:///C:/dev/apache-jena-fuseki-3.10.0/webapp/,UNAVAILABLE}
org.apache.jena.assembler.exceptions.AssemblerException: caught: Not in a
transaction
doing:
root:
file:///C:/dev/apache-jena-fuseki-3.10.0/run/configuration/weird7.ttl#model_inf
with type: http://jena.hpl.hp.com/2005/11/Assembler#InfModel assembler class:
class org.apache.jena.assembler.assemblers.InfModelAssembler
root: http://base/#dataset with type:
http://jena.hpl.hp.com/2005/11/Assembler#RDFDataset assembler class: class
org.apache.jena.sparql.core.assembler.DatasetAssembler
at
org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.openBySpecificType(AssemblerGroup.java:165)
at
org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.open(AssemblerGroup.java:144)
at
org.apache.jena.assembler.assemblers.AssemblerGroup$ExpandingAssemblerGroup.open(AssemblerGroup.java:93)
at
org.apache.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:39)
at
org.apache.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:35)
at
org.apache.jena.assembler.assemblers.AssemblerGroup.openModel(AssemblerGroup.java:47)
at
org.apache.jena.sparql.core.assembler.DatasetAssembler.createDataset(DatasetAssembler.java:56)
at
org.apache.jena.sparql.core.assembler.DatasetAssembler.open(DatasetAssembler.java:43)
at
org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.openBySpecificType(AssemblerGroup.java:157)
at
org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.open(AssemblerGroup.java:144)
at
org.apache.jena.assembler.assemblers.AssemblerGroup$ExpandingAssemblerGroup.open(AssemblerGroup.java:93)
at
org.apache.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:39)
at
org.apache.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:35)
at
org.apache.jena.fuseki.build.FusekiConfig.getDataset(FusekiConfig.java:345)
at
org.apache.jena.fuseki.build.FusekiConfig.buildDataService(FusekiConfig.java:299)
at
org.apache.jena.fuseki.build.FusekiConfig.buildDataAccessPoint(FusekiConfig.java:289)
at
org.apache.jena.fuseki.build.FusekiConfig.readConfiguration(FusekiConfig.java:272)
at
org.apache.jena.fuseki.build.FusekiConfig.readConfigurationDirectory(FusekiConfig.java:251)
at
org.apache.jena.fuseki.webapp.FusekiWebapp.initializeDataAccessPoints(FusekiWebapp.java:226)
at
org.apache.jena.fuseki.webapp.FusekiServerListener.serverInitialization(FusekiServerListener.java:98)
at
org.apache.jena.fuseki.webapp.FusekiServerListener.contextInitialized(FusekiServerListener.java:56)
at
org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:952)
at
org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:558)
at
org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:917)
at
org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:370)
at
org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1497)
at
org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1459)
at
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:847)
at
org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:287)
at
org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:138)
at
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:108)
at
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
at
org.eclipse.jetty.server.handler.gzip.GzipHandler.doStart(GzipHandler.java:410)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:138)
at org.eclipse.jetty.server.Server.start(Server.java:416)
at
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:108)
at
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
at org.eclipse.jetty.server.Server.doStart(Server.java:383)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at
org.apache.jena.fuseki.cmd.JettyFusekiWebapp.start(JettyFusekiWebapp.java:138)
at org.apache.jena.fuseki.cmd.FusekiCmd.runFuseki(FusekiCmd.java:372)
at
org.apache.jena.fuseki.cmd.FusekiCmd$FusekiCmdInner.exec(FusekiCmd.java:356)
at jena.cmd.CmdMain.mainMethod(CmdMain.java:93)
at jena.cmd.CmdMain.mainRun(CmdMain.java:58)
at jena.cmd.CmdMain.mainRun(CmdMain.java:45)
at
org.apache.jena.fuseki.cmd.FusekiCmd$FusekiCmdInner.innerMain(FusekiCmd.java:104)
at org.apache.jena.fuseki.cmd.FusekiCmd.main(FusekiCmd.java:67)
Caused by: org.apache.jena.dboe.transaction.txn.TransactionException: Not in a
transaction
at
org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle.checkTxn(TransactionalComponentLifecycle.java:417)
at
org.apache.jena.dboe.trans.bplustree.BPlusTree.getRootRead(BPlusTree.java:159)
at
org.apache.jena.dboe.trans.bplustree.BPlusTree.find(BPlusTree.java:239)
at
org.apache.jena.tdb2.store.nodetable.NodeTableNative.accessIndex(NodeTableNative.java:133)
at
org.apache.jena.tdb2.store.nodetable.NodeTableNative._idForNode(NodeTableNative.java:118)
at
org.apache.jena.tdb2.store.nodetable.NodeTableNative.getNodeIdForNode(NodeTableNative.java:57)
at
org.apache.jena.tdb2.store.nodetable.NodeTableCache._idForNode(NodeTableCache.java:222)
at
org.apache.jena.tdb2.store.nodetable.NodeTableCache.getNodeIdForNode(NodeTableCache.java:114)
at
org.apache.jena.tdb2.store.nodetable.NodeTableWrapper.getNodeIdForNode(NodeTableWrapper.java:47)
at
org.apache.jena.tdb2.store.nodetable.NodeTableInline.getNodeIdForNode(NodeTableInline.java:58)
at
org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.idForNode(NodeTupleTableConcrete.java:182)
at
org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.findAsNodeIds(NodeTupleTableConcrete.java:136)
at
org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.find(NodeTupleTableConcrete.java:114)
at
org.apache.jena.tdb2.store.DatasetPrefixesTDB.readPrefixMap(DatasetPrefixesTDB.java:111)
at
org.apache.jena.sparql.graph.GraphPrefixesProjection.getNsPrefixMap(GraphPrefixesProjection.java:94)
at
org.apache.jena.tdb2.store.GraphViewSwitchable$PrefixMappingImplTDB2.getNsPrefixMap(GraphViewSwitchable.java:159)
at
org.apache.jena.shared.impl.PrefixMappingImpl.setNsPrefixes(PrefixMappingImpl.java:138)
at
org.apache.jena.tdb2.store.GraphViewSwitchable.createPrefixMapping(GraphViewSwitchable.java:68)
at
org.apache.jena.graph.impl.GraphBase.getPrefixMapping(GraphBase.java:165)
at
org.apache.jena.reasoner.BaseInfGraph.getPrefixMapping(BaseInfGraph.java:55)
at
org.apache.jena.rdf.model.impl.ModelCom.getPrefixMapping(ModelCom.java:1018)
at
org.apache.jena.rdf.model.impl.ModelCom.setNsPrefixes(ModelCom.java:1055)
at
org.apache.jena.assembler.assemblers.ModelAssembler.open(ModelAssembler.java:45)
at
org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.openBySpecificType(AssemblerGroup.java:157)
... 49 more
[2019-01-31 13:54:58] Server INFO Started 2019/01/31 13:54:58 GMT on port
3030
THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION.
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN.
IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014).
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS,
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/.
HORIZON ASSET LLP IS AUTHORISED AND REGULATED
BY THE FINANCIAL CONDUCT AUTHORITY.