我想使用jena通过http将.nt文件加载到在我的计算机上运行的fuseki服务器中。
我可以使用RDFConnectionFactory连接fuseki服务器,但是在加载时出现以下错误。
500-501:不支持的内容编码 org.apache.jena.atlas.web.HttpException:500-501:不支持的内容编码
def getConnection(serviceUri:String): RDFConnection =
RDFConnectionFactory.connectFuseki(serviceUri)
def upload(graphName: String, path: String): Unit = {
val conn = getConnection
if (graphName.isEmpty) conn.load(path)
else conn.load(graphName, path)
}
val serviceUri = "http://localhost:3030/sample"
upload("","file:///F:/IdeaProjects/Knowledge-BI/dataset/data.nt")
服务器日志
[2019-06-09 14:22:56] Fuseki INFO [9] POST http://localhost:3030/sample/?graph=http://www.knowldegeBi.com
[2019-06-09 14:22:56] Fuseki WARN [9] RC = 500 : 501: Unsupported Content-Encoding
org.eclipse.jetty.http.BadMessageException: 501: Unsupported Content-Encoding
at org.eclipse.jetty.server.Request.extractContentParameters(Request.java:460)
at org.eclipse.jetty.server.Request.getParameters(Request.java:386)
at org.eclipse.jetty.server.Request.getParameter(Request.java:1029)
at javax.servlet.ServletRequestWrapper.getParameter(ServletRequestWrapper.java:194)
at org.apache.jena.fuseki.servlets.ServiceRouter.chooseOperation(ServiceRouter.java:142)
at org.apache.jena.fuseki.servlets.ActionService.execCommonWorker(ActionService.java:118)
at org.apache.jena.fuseki.servlets.ActionBase.doCommon(ActionBase.java:74)
at org.apache.jena.fuseki.servlets.FusekiFilter.doFilter(FusekiFilter.java:73)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.apache.jena.fuseki.servlets.CrossOriginFilter.handle(CrossOriginFilter.java:285)
at org.apache.jena.fuseki.servlets.CrossOriginFilter.doFilter(CrossOriginFilter.java:248)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1634)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:690)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:503)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
at java.lang.Thread.run(Unknown Source)
[2019-06-09 14:22:56] Fuseki INFO [9] 500 501: Unsupported Content-Encoding (316 ms)
我要上传的文件是https://drive.google.com/file/d/1bIoy_UyWXhLSlfQbN6ufpEz6RgM9u4l4/view 服务器是Apache Jena Fuseki 3.11.0
我只需要将.nt / .nq / .rdf文件上传到我的本地目录服务器即可。