jena java,如何使用Apache Jena Java API创建Fuseki SPARQL服务器?

博主想在本地创建Fuseki SPARQL服务器,希望用Jena Java API实现,虽查看Jena API但无进展。解决方案是通过Maven引入Fuseki依赖,用SPARQLServer类创建并启动服务器,不过该服务器嵌入启动它的JVM,JVM关闭则服务器关闭。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I am trying to create a Fuseki SPARQL server on my machine. The documentation on the Jena website describes how to create such a server from the command-line, here: http://jena.apache.org/documentation/serving_data/. I am looking for a way of creating and initializing such a server just using the Jena Java API. I have looked over the Jena API but have not made any progress in working out how to proceed. Has anyone done this before?

解决方案

Yes this is possible but it is not how Fuseki was designed to operate so do so at your own risk.

You will need to pull in Fuseki as a dependency, via maven this would be the following:

org.apache.jena

jena-fuseki

0.2.7

Then you can use the SPARQLServer class to create a server and call start() to actually run the server and stop() when you are done. (This is located in the org.apache.jena.fuseki.server package)

It is important to note that if you do this the server is embedded in the JVM from which you start it, when that JVM shuts down the server shuts down. This may be your intention but it may not.

Btw you question is unclear as to exactly why you want to do this? There may be alternative ways to achieve your goal without embedding Fuseki if you explain your goals further

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值