简体   繁体   English

dotNetRdf 中是否有任何类可以将本体上传到远程服务器?

[英]Is there any class in dotNetRdf to upload the ontology in the remote server?

I am developing a .Net API and connecting it with RDF Triple Store, with the help of dotNetRdf library.我正在开发一个 .Net API 并在dotNetRdf库的帮助下将其与 RDF Triple Store 连接。 I am successfully able to load the data and query rdf data from the remote serve.我能够成功地从远程服务器加载数据并查询 rdf 数据。 Is there any support in dotNetRdf to load the ttl file into the remote serve ? dotNetRdf 是否支持将 ttl 文件加载到远程服务器 I am trying to update the ontology in the real time, without doing it manually.我正在尝试实时更新本体,而无需手动进行。

Depending on the store that you are connecting to, you should be able to update the remote server using dotNetRDF's Triple Store integration .根据您连接的商店,您应该能够使用dotNetRDF 的 Triple Store 集成更新远程服务器。 In particular you should be able to use the UpdateGraph method to add the triples in your TTL file (or if you want to completely overwrite the data on the server you could use the SaveGraph method with caution! ).特别是您应该能够使用UpdateGraph方法在您的 TTL 文件中添加三元组(或者如果您想完全覆盖服务器上的数据,您可以谨慎使用SaveGraph方法 )。

You can see a list of the supported triple store integrations here .您可以在此处查看支持的三重存储集成列表。 Note that it includes an integration that supports the SPARQL Graph Store Protocol which may cover you for the server you are connecting too even if it's not explicitly listed.请注意,它包含一个支持SPARQL 图形存储协议的集成,即使未明确列出,它也可能涵盖您正在连接的服务器。

By the way, if you decide to use the UpdateGraph method you don't have to manually create the graph as is shown in the example, instead you can load your TTL file into a graph and then update the remote server using code something like this:顺便说一句,如果您决定使用UpdateGraph方法,则不必像示例中所示那样手动创建图形,而是可以将 TTL 文件加载到图形中,然后使用类似这样的代码更新远程服务器:

// Create a remote store connector. 
// The precise details will depend on which store you are connecting too.
var remoteStore = new SparqlHttpProtocolConnector(
  "http://example.org/store", // URL of the store's endpoint
  MimeTypesHelper.GetDefinitions("application/n-triples").First() // override the default use of RDF/XML for the upload
);
// Create a Graph and fill it with data we want to save
Graph g = new Graph();
g.LoadFromFile("data.ttl");

// Write triples from IGraph instance g into the named graph 
// http://example.org/graph on the remote store
remoteStore.UpdateGraph("http://example.org/graph", g.Triples, null);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM