SimmerChan / KG-demo-for-movie

从无到有构建一个电影知识图谱,并基于该KG,开发一个简易的KBQA程序。
https://zhuanlan.zhihu.com/knowledgegraph
1.28k stars 424 forks source link

查询时报错Error 500: Not in a transaction #20

Closed c123853648 closed 5 years ago

SimmerChan commented 5 years ago

具体描述一下

frodo-x commented 4 years ago

同有此问题

[2020-06-01 21:24:58] Server     INFO  Started 2020/06/01 21:24:58 CST on port 3
030
[2020-06-01 21:26:02] Fuseki     INFO  [1] GET http://localhost:3030/kg_demo_mov
ie/query?query=%0APREFIX+%3A+%3Chttp%3A//www.kgdemo.com%23%3E%0APREFIX+rdf%3A+%3
Chttp%3A//www.w3.org/1999/02/22-rdf-syntax-ns%23%3E%0APREFIX+rdfs%3A+%3Chttp%3A/
/www.w3.org/2000/01/rdf-schema%23%3E%0A%0ASELECT+DISTINCT+%3Fx+WHERE+%7B%0A%3Fs+
%3ApersonName+%27%E5%91%A8%E6%B6%A6%E5%8F%91%27.%3Fs+%3AhasActedIn+%3Fm.%3Fm+%3A
movieTitle+%3Fx%0A%7D%0A&format=json&output=json&results=json
[2020-06-01 21:26:02] Fuseki     INFO  [1] GET /kg_demo_movie :: 'query' :: <non
e> ? query=%0APREFIX+%3A+%3Chttp%3A//www.kgdemo.com%23%3E%0APREFIX+rdf%3A+%3Chtt
p%3A//www.w3.org/1999/02/22-rdf-syntax-ns%23%3E%0APREFIX+rdfs%3A+%3Chttp%3A//www
.w3.org/2000/01/rdf-schema%23%3E%0A%0ASELECT+DISTINCT+%3Fx+WHERE+%7B%0A%3Fs+%3Ap
ersonName+%27%E5%91%A8%E6%B6%A6%E5%8F%91%27.%3Fs+%3AhasActedIn+%3Fm.%3Fm+%3Amovi
eTitle+%3Fx%0A%7D%0A&format=json&output=json&results=json
[2020-06-01 21:26:02] Fuseki     WARN  SPARQL Query: Unrecognize request paramet
er (ignored): results
[2020-06-01 21:26:02] Fuseki     INFO  [1] Query =  PREFIX : <http://www.kgdemo.
com#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <ht
tp://www.w3.org/2000/01/rdf-schema#>  SELECT DISTINCT ?x WHERE { ?s :personName
'周润发'.?s :hasActedIn ?m.?m :movieTitle ?x }
[2020-06-01 21:26:02] QueryIteratorCheck WARN  Open iterator: TripleMapper/71
[2020-06-01 21:26:02] Fuseki     WARN  [1] RC = 500 : Not in a transaction
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:23
9)
        at org.apache.jena.tdb2.store.nodetable.NodeTableNative.accessIndex(Node
TableNative.java:133)
        at org.apache.jena.tdb2.store.nodetable.NodeTableNative._idForNode(NodeT
ableNative.java:118)
        at org.apache.jena.tdb2.store.nodetable.NodeTableNative.getNodeIdForNode
(NodeTableNative.java:57)
        at org.apache.jena.tdb2.store.nodetable.NodeTableCache._idForNode(NodeTa
bleCache.java:222)
        at org.apache.jena.tdb2.store.nodetable.NodeTableCache.getNodeIdForNode(
NodeTableCache.java:114)
        at org.apache.jena.tdb2.store.nodetable.NodeTableWrapper.getNodeIdForNod
e(NodeTableWrapper.java:47)
        at org.apache.jena.tdb2.store.nodetable.NodeTableInline.getNodeIdForNode
(NodeTableInline.java:58)
        at org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.idFo
rNode(NodeTupleTableConcrete.java:182)
        at org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.find
AsNodeIds(NodeTupleTableConcrete.java:136)
        at org.apache.jena.tdb2.store.TripleTable.find(TripleTable.java:64)
        at org.apache.jena.tdb2.store.DatasetGraphTDB.findInDftGraph(DatasetGrap
hTDB.java:109)
        at org.apache.jena.sparql.core.DatasetGraphBaseFind.find(DatasetGraphBas
eFind.java:47)
        at org.apache.jena.sparql.core.DatasetGraphWrapper.find(DatasetGraphWrap
per.java:150)
        at org.apache.jena.sparql.core.GraphView.graphBaseFind(GraphView.java:12
2)
        at org.apache.jena.sparql.core.GraphView.graphBaseFind(GraphView.java:11
4)
        at org.apache.jena.graph.impl.GraphBase.find(GraphBase.java:241)
        at org.apache.jena.reasoner.FGraph.find(FGraph.java:49)
        at org.apache.jena.reasoner.rulesys.impl.RETEEngine.fastInit(RETEEngine.
java:155)
        at org.apache.jena.reasoner.rulesys.FBRuleInfGraph.prepare(FBRuleInfGrap
h.java:471)
        at org.apache.jena.reasoner.BaseInfGraph.requirePrepared(BaseInfGraph.ja
va:530)
        at org.apache.jena.reasoner.rulesys.FBRuleInfGraph.findWithContinuation(
FBRuleInfGraph.java:557)
        at org.apache.jena.reasoner.rulesys.FBRuleInfGraph.graphBaseFind(FBRuleI
nfGraph.java:587)
        at org.apache.jena.graph.impl.GraphBase.find(GraphBase.java:255)
        at org.apache.jena.sparql.engine.iterator.QueryIterTriplePattern$TripleM
apper.<init>(QueryIterTriplePattern.java:75)
        at org.apache.jena.sparql.engine.iterator.QueryIterTriplePattern.nextSta
ge(QueryIterTriplePattern.java:49)
        at org.apache.jena.sparql.engine.iterator.QueryIterRepeatApply.makeNextS
tage(QueryIterRepeatApply.java:108)
        at org.apache.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBi
nding(QueryIterRepeatApply.java:65)
        at org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(Quer
yIteratorBase.java:114)
        at org.apache.jena.sparql.engine.iterator.QueryIterRepeatApply.makeNextS
tage(QueryIterRepeatApply.java:101)
        at org.apache.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBi
nding(QueryIterRepeatApply.java:65)
        at org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(Quer
yIteratorBase.java:114)
        at org.apache.jena.sparql.engine.iterator.QueryIterRepeatApply.makeNextS
tage(QueryIterRepeatApply.java:101)
        at org.apache.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBi
nding(QueryIterRepeatApply.java:65)
        at org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(Quer
yIteratorBase.java:114)
        at org.apache.jena.sparql.engine.iterator.QueryIterBlockTriples.hasNextB
inding(QueryIterBlockTriples.java:63)
        at org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(Quer
yIteratorBase.java:114)
        at org.apache.jena.sparql.engine.iterator.QueryIterConvert.hasNextBindin
g(QueryIterConvert.java:58)
        at org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(Quer
yIteratorBase.java:114)
        at org.apache.jena.sparql.engine.iterator.QueryIterDistinct.getInputNext
Unseen(QueryIterDistinct.java:104)
        at org.apache.jena.sparql.engine.iterator.QueryIterDistinct.hasNextBindi
ng(QueryIterDistinct.java:70)
        at org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(Quer
yIteratorBase.java:114)
        at org.apache.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBi
nding(QueryIteratorWrapper.java:39)
        at org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(Quer
yIteratorBase.java:114)
        at org.apache.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBi
nding(QueryIteratorWrapper.java:39)
        at org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(Quer
yIteratorBase.java:114)
        at org.apache.jena.sparql.engine.ResultSetStream.hasNext(ResultSetStream
.java:74)
        at org.apache.jena.sparql.engine.ResultSetCheckCondition.hasNext(ResultS
etCheckCondition.java:55)
        at org.apache.jena.fuseki.servlets.SPARQL_Query.executeQuery(SPARQL_Quer
y.java:320)
        at org.apache.jena.fuseki.servlets.SPARQL_Query.execute(SPARQL_Query.jav
a:270)
        at org.apache.jena.fuseki.servlets.SPARQL_Query.executeWithParameter(SPA
RQL_Query.java:228)
        at org.apache.jena.fuseki.servlets.SPARQL_Query.perform(SPARQL_Query.jav
a:203)
        at org.apache.jena.fuseki.servlets.ActionSPARQL.executeLifecycle(ActionS
PARQL.java:132)
        at org.apache.jena.fuseki.servlets.SPARQL_UberServlet.executeRequest(SPA
RQL_UberServlet.java:356)
        at org.apache.jena.fuseki.servlets.SPARQL_UberServlet.serviceDispatch(SP
ARQL_UberServlet.java:317)
        at org.apache.jena.fuseki.servlets.SPARQL_UberServlet.executeAction(SPAR
QL_UberServlet.java:271)
        at org.apache.jena.fuseki.servlets.ActionSPARQL.execCommonWorker(ActionS
PARQL.java:83)
        at org.apache.jena.fuseki.servlets.ActionBase.doCommon(ActionBase.java:8
1)
        at org.apache.jena.fuseki.servlets.FusekiFilter.doFilter(FusekiFilter.ja
va:73)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(Servlet
Handler.java:1637)
        at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilte
rChain.java:61)
        at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.j
ava:108)
        at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilt
er.java:137)
        at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerReq
uestFilter.java:125)
        at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilte
rChain.java:66)
        at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(Abstrac
tShiroFilter.java:449)
        at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiro
Filter.java:365)
        at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallab
le.java:90)
        at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable
.java:83)
        at org.apache.shiro.subject.support.DelegatingSubject.execute(Delegating
Subject.java:383)
        at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(Abs
tractShiroFilter.java:362)
        at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerReq
uestFilter.java:125)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(Servlet
Handler.java:1637)
        at org.apache.jena.fuseki.servlets.CrossOriginFilter.handle(CrossOriginF
ilter.java:285)
        at org.apache.jena.fuseki.servlets.CrossOriginFilter.doFilter(CrossOrigi
nFilter.java:248)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(Servlet
Handler.java:1629)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java
:533)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.j
ava:143)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.jav
a:548)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper
.java:132)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandl
er.java:190)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandl
er.java:1595)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandl
er.java:188)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandl
er.java:1253)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandle
r.java:168)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:
473)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandle
r.java:1564)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandle
r.java:166)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandle
r.java:1155)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.j
ava:141)
        at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.
java:521)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper
.java:132)
        at org.eclipse.jetty.server.Server.handle(Server.java:564)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317)
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.jav
a:251)
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(Abstra
ctConnection.java:279)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
        at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
        at org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.jav
a:128)
        at org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.invoke(Invo
cable.java:222)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWh
atYouKill.java:294)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhat
YouKill.java:126)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPoo
l.java:672)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool
.java:590)
        at java.lang.Thread.run(Thread.java:748)
[2020-06-01 21:26:02] Fuseki     INFO  [1] 500 Not in a transaction (121 ms)

fuseki_conf.ttl里,tdbGraph和tdbDataset使用tdb,同时取消本体文件那行的注释。然后解决了这个问题。