我已经建立了一个Fuseki端点,希望能够使用一些SPARQL(选择和更新/删除查询)访问Jena SDB数据库(后端真的是一个MySQL数据库)。 SPARQL选择查询工作正常,但每当我尝试运行更新查询(如插入或删除)时,我从Fuseki获得以下内容:
Error 500: DatasetGraph.delete(Quad)
Fuseki - version 0.2.6-SNAPSHOT (Build date: 2012-12-06T08:26:37-0500)
我通过运行以下脚本启动了我的终端:
#!/bin/bash
export FusekiInstallDir=/data/jena-fuseki-0.2.6-SNAPSHOT
export FusekiPort=3030
export FusekiJVMArgs="-cp ./fuseki-server.jar:lib/ReconnectingSDB-0.1-SNAPSHOT.jar:lib/jena-sdb-1.3.6-SNAPSHOT.jar:lib/mysql-connector-java-5.1.16-bin.jar:lib/jena-arq-2.9.5-SNAPSHOT.jar -Xmx768M"
export Date=`date +%Y-%m-%d`
export FusekiLogFile=$FusekiInstallDir/FusekiLog-$Date.log
export FusekiConfigFile=$FusekiInstallDir/fuseki.ttl
export FusekiServiceName=/VIVO
# Check to see if logfile exists
if [ ! -f $FusekiLogFile ]; then
touch $FusekiLogFile
fi
# Check to see if config file exists
if [ ! -f $FusekiConfigFile ]; then
echo “ERROR – Fuseki failed to start – no configuration file - $FusekiConfigFile” >> $FusekiLogFile
exit 1
fi
# Execute Java calling the package for Fuseki
java $FusekiJVMArgs org.apache.jena.fuseki.FusekiCmd --desc $FusekiConfigFile --update --port=$FusekiPort $FusekiServiceName >> $FusekiLogFile 2>&1 &
访问以下配置文件(fuseki.ttl):
@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 sdb: <http://jena.hpl.hp.com/2007/sdb#> .
@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix jumble: <http://rootdev.net/vocab/jumble#> .
@prefix : <#> .
[] rdf:type fuseki:Server ;
# Services available. Only explicitly listed services are configured.
# If there is a service description not linked from this list, it is ignored.
fuseki:services (
<#service1>
) .
# Declaration additional assembler items.
# [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
[] ja:loadClass "net.rootdev.fusekisdbconnect.SDBConnect" .
jumble:SDBConnect rdfs:subClassOf ja:RDFDataset .
<#dataset> rdf:type jumble:SDBConnect ;
rdfs:label "SDB" ;
sdb:layout "layout2" ;
jumble:defaultUnionGraph "true" ; # will switch option on globally, in fact
sdb:connection [
rdf:type sdb:SDBConnection ;
# Using MySQL
sdb:sdbHost "LASP-DB-DEV" ;
sdb:sdbType "MySQL" ;
sdb:sdbName "db" ;
sdb:sdbUser "user" ;
sdb:sdbPassword "pass" ;
sdb:driver "com.mysql.jdbc.Driver" ;
#sdb:jdbcUrl "jdbc:mysql://localhost/vivodb?autoReconnect=true"
] ;
.
## ---------------------------------------------------------------
## Vivo dataset in sdb
<#service1> rdf:type fuseki:Service ;
fuseki:name "VIVO" ; # http://host:port/ds
fuseki:serviceQuery "query" ; # SPARQL query service
fuseki:serviceQuery "sparql" ; # SPARQL query service
fuseki:serviceUpdate "update" ;
# A separate ead-only graph store endpoint:
fuseki:serviceReadGraphStore "get" ; # SPARQL Graph store protocol (read only)
fuseki:dataset <#dataset> ;
.
有没有人对可能导致这种情况的原因有任何想法?如果有帮助,下面是生成的FusekiLog文件。提前谢谢!
12:32:40 INFO Server :: Dataset from assembler
12:32:40 WARN SDBConnect :: Hooking in to update and query engines
12:32:40 WARN SDBConnect :: Hooking in to assemblers
12:32:40 WARN SDBConnect :: Hooking in to assemblers
12:32:41 INFO Server :: Dataset path = /VIVO
12:32:41 INFO Server :: Fuseki 0.2.6-SNAPSHOT 2012-12-06T08:26:37-0500
12:32:41 INFO Server :: Started 2013/03/20 12:32:41 MDT on port 3030
12:32:52 INFO Fuseki :: [1] GET http://sorce-dp2:3030/VIVO/query?query=PREFIX+rdf%3A+++%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0D%0APREFIX+rdfs%3A++%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0D%0APREFIX+xsd%3A+++%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0D%0APREFIX+owl%3A+++%3Chttp%3A%2F%2Fwww.w3.org%2F2002%2F07%2Fowl%23%3E%0D%0APREFIX+swrl%3A++%3Chttp%3A%2F%2Fwww.w3.org%2F2003%2F11%2Fswrl%23%3E%0D%0APREFIX+swrlb%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2003%2F11%2Fswrlb%23%3E%0D%0APREFIX+vitro%3A+%3Chttp%3A%2F%2Fvitro.mannlib.cornell.edu%2Fns%2Fvitro%2F0.7%23%3E%0D%0APREFIX+bibo%3A+%3Chttp%3A%2F%2Fpurl.org%2Fontology%2Fbibo%2F%3E%0D%0APREFIX+dcelem%3A+%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E%0D%0APREFIX+dcterms%3A+%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%3E%0D%0APREFIX+event%3A+%3Chttp%3A%2F%2Fpurl.org%2FNET%2Fc4dm%2Fevent.owl%23%3E%0D%0APREFIX+foaf%3A+%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%0D%0APREFIX+geo%3A+%3Chttp%3A%2F%2Faims.fao.org%2Faos%2Fgeopolitical.owl%23%3E%0D%0APREFIX+pvs%3A+%3Chttp%3A%2F%2Fvivoweb.org%2Fontology%2Fprovenance-support%23%3E%0D%0APREFIX+ero%3A+%3Chttp%3A%2F%2Fpurl.obolibrary.org%2Fobo%2F%3E%0D%0APREFIX+scires%3A+%3Chttp%3A%2F%2Fvivoweb.org%2Fontology%2Fscientific-research%23%3E%0D%0APREFIX+skos%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2004%2F02%2Fskos%2Fcore%23%3E%0D%0APREFIX+vitro-public%3A+%3Chttp%3A%2F%2Fvitro.mannlib.cornell.edu%2Fns%2Fvitro%2Fpublic%23%3E%0D%0APREFIX+vivo%3A+%3Chttp%3A%2F%2Fvivoweb.org%2Fontology%2Fcore%23%3E%0D%0APREFIX+laspcms%3A+%3Chttp%3A%2F%2Fsorce-dp2%3A8080%2Flaspcms%2F%3E%0D%0APREFIX+vsto%3A+%3Chttp%3A%2F%2Fescience.rpi.edu%2Fontology%2Fvsto%2F2%2F0%2Fvsto.owl%23%3E%0D%0A%0D%0ASELECT+%3Fname%0D%0AWHERE%0D%0A%7B%0D%0A%3Fthing+a+vsto%3ADataset+.%0D%0A%3Fthing+rdfs%3Alabel+%3Fname%0D%0A%7D%0D%0A&output=text&stylesheet=%2Fxml-to-html.xsl
12:32:52 INFO Fuseki :: [1] Query = PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX swrl: <http://www.w3.org/2003/11/swrl#> PREFIX swrlb: <http://www.w3.org/2003/11/swrlb#> PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> PREFIX bibo: <http://purl.org/ontology/bibo/> PREFIX dcelem: <http://purl.org/dc/elements/1.1/> PREFIX dcterms: <http://purl.org/dc/terms/> PREFIX event: <http://purl.org/NET/c4dm/event.owl#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX geo: <http://aims.fao.org/aos/geopolitical.owl#> PREFIX pvs: <http://vivoweb.org/ontology/provenance-support#> PREFIX ero: <http://purl.obolibrary.org/obo/> PREFIX scires: <http://vivoweb.org/ontology/scientific-research#> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX vitro-public: <http://vitro.mannlib.cornell.edu/ns/vitro/public#> PREFIX vivo: <http://vivoweb.org/ontology/core#> PREFIX laspcms: <http://sorce-dp2:8080/laspcms/> PREFIX vsto: <http://escience.rpi.edu/ontology/vsto/2/0/vsto.owl#> SELECT ?name WHERE { ?thing a vsto:Dataset . ?thing rdfs:label ?name }
12:32:52 INFO Fuseki :: [1] OK/select
12:32:52 INFO Fuseki :: [1] 200 OK
12:35:06 INFO Fuseki :: [2] POST http://sorce-dp2:3030/VIVO/update
12:35:06 WARN SPARQL_Update$HttpActionUpdate :: Transaction still active in endWriter - no commit or abort seen (forced abort)
12:35:06 WARN SPARQL_Update$HttpActionUpdate :: Exception in forced abort (trying to continue)
com.hp.hpl.jena.sparql.core.DatasetGraphWithLock$JenaLockException: Can't abort a locked update
at com.hp.hpl.jena.sparql.core.DatasetGraphWithLock._abort(DatasetGraphWithLock.java:97)
at com.hp.hpl.jena.sparql.core.DatasetGraphTrackActive.abort(DatasetGraphTrackActive.java:63)
at org.apache.jena.fuseki.servlets.HttpAction.endWrite(HttpAction.java:121)
at org.apache.jena.fuseki.servlets.SPARQL_Update.execute(SPARQL_Update.java:246)
at org.apache.jena.fuseki.servlets.SPARQL_Update.executeForm(SPARQL_Update.java:232)
at org.apache.jena.fuseki.servlets.SPARQL_Update.perform(SPARQL_Update.java:118)
at org.apache.jena.fuseki.servlets.SPARQL_ServletBase.doCommonWorker(SPARQL_ServletBase.java:117)
at org.apache.jena.fuseki.servlets.SPARQL_ServletBase.doCommon(SPARQL_ServletBase.java:67)
at org.apache.jena.fuseki.servlets.SPARQL_Update.doPost(SPARQL_Update.java:84)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:598)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:442)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1033)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:369)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:967)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.eclipse.jetty.server.Server.handle(Server.java:358)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:47)
at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:894)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:948)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:851)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:66)
at org.eclipse.jetty.server.nio.BlockingChannelConnector$BlockingChannelEndPoint.run(BlockingChannelConnector.java:293)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)
at java.lang.Thread.run(Thread.java:662)
12:35:06 WARN Fuseki :: [2] RC = 500 : DatasetGraph.delete(Quad)
java.lang.UnsupportedOperationException: DatasetGraph.delete(Quad)
at com.hp.hpl.jena.sparql.core.DatasetGraphBase.delete(DatasetGraphBase.java:81)
at com.hp.hpl.jena.sparql.core.DatasetGraphTrackActive.delete(DatasetGraphTrackActive.java:131)
at com.hp.hpl.jena.sparql.core.DatasetGraphWrapper.delete(DatasetGraphWrapper.java:76)
at com.hp.hpl.jena.sparql.modify.UpdateEngineWorker.execDelete(UpdateEngineWorker.java:438)
at com.hp.hpl.jena.sparql.modify.UpdateEngineWorker.visit(UpdateEngineWorker.java:357)
at com.hp.hpl.jena.sparql.modify.request.UpdateModify.visit(UpdateModify.java:97)
at com.hp.hpl.jena.sparql.modify.UpdateEngineMain.execute(UpdateEngineMain.java:57)
at com.hp.hpl.jena.sparql.modify.UpdateProcessorBase.execute(UpdateProcessorBase.java:56)
at com.hp.hpl.jena.update.UpdateAction.execute$(UpdateAction.java:334)
at com.hp.hpl.jena.update.UpdateAction.execute(UpdateAction.java:327)
at com.hp.hpl.jena.update.UpdateAction.execute(UpdateAction.java:307)
at com.hp.hpl.jena.update.UpdateAction.execute(UpdateAction.java:257)
at org.apache.jena.fuseki.servlets.SPARQL_Update.execute(SPARQL_Update.java:242)
at org.apache.jena.fuseki.servlets.SPARQL_Update.executeForm(SPARQL_Update.java:232)
at org.apache.jena.fuseki.servlets.SPARQL_Update.perform(SPARQL_Update.java:118)
at org.apache.jena.fuseki.servlets.SPARQL_ServletBase.doCommonWorker(SPARQL_ServletBase.java:117)
at org.apache.jena.fuseki.servlets.SPARQL_ServletBase.doCommon(SPARQL_ServletBase.java:67)
at org.apache.jena.fuseki.servlets.SPARQL_Update.doPost(SPARQL_Update.java:84)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:598)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:442)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1033)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:369)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:967)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.eclipse.jetty.server.Server.handle(Server.java:358)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:47)
at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:894)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:948)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:851)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:66)
at org.eclipse.jetty.server.nio.BlockingChannelConnector$BlockingChannelEndPoint.run(BlockingChannelConnector.java:293)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)
at java.lang.Thread.run(Thread.java:662)
12:35:06 INFO Fuseki :: [2] 500 DatasetGraph.delete(Quad)
答案 0 :(得分:0)
你似乎正在运行
Fuseki - version 0.2.2-incubating-SNAPSHOT
尽管
export FusekiInstallDir=/data/jena-fuseki-0.2.4
这可能是一个现已修复的已知错误。你能升级到0.2.5吗?
配置说:
jumble:SDBConnect rdfs:subClassOf ja:RDFDataset .
但是
<#ufvivo_dataset_read> rdf:type sdb:DatasetStore ;
sdb:store <#VIVOStore>
.
<#VIVOStore> rdf:type jumble:SDBConnect;
因此jumble:SDBConnect
不是数据集(可能无关紧要 - 代码遵循<#VIVOStore>
链接
没有
sdb:DatasetStore rdfs:subClassOf ja:RDFDataset .
但是你的本地init类可以在这里做点什么。
答案 1 :(得分:0)
存在tdb.lock,您需要删除此文件 使用以下命令删除该文件
rm -f run/system/tdb.lock