作为 .NET 开发人员,我如何开始使用 Sparql?
我正在尝试解析古腾堡计划的大型 RDF 文件。我团队的另一名成员在尝试了 Semweb 和 python 库后陷入了困境。
由于对 rdf 有点天真,我尝试用 Ruby 编写一个简单的 ol' xml 解析脚本。我很快意识到它太复杂而无法真正发挥作用。
我已经下载了 Intellidimension 的工具并正在考虑使用它。
我想我不明白如何使用SPARQL。 Java 中好像有一个解析器叫 Jena。 .NET 中有类似的东西吗?
抱歉,这个问题很明显……我只是不确定在哪里编写 SPARQL 查询。是否有一个库允许我使用字符串构建查询(类似于 Data.SQlClient),然后针对某些 Sparql 处理器执行?
您执行 Sparql 的目的是什么?
I'm trying to parse Project Gutenberg's large RDF file. Another member of my team is pretty stuck, having tried Semweb and a python library.
Being a little naive about rdf, I tried to write a plain ol' xml parsing script in Ruby. I soon realized it was too complex to really work.
I've downloaded Intellidimension's tool and am thinking of using it.
I guess I don't understand how to use SPARQL. It seems there is a parser in Java called Jena. Is there something like that in .NET?
Sorry for the obvious question....I'm just not sure where to write the SPARQL queries. Is there a library that would allow me to build a query using strings, similar to Data.SQlClient and then execute against some Sparql processor?
What do you execute Sparql against?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
.Net 中的另一个选择是 dotNetRDF (免责声明 - 我是该项目的首席开发人员)
它比 SemWeb 有优势目前正在维护并且正在积极进行开发,此外它还包括对许多较新的语义 Web 技术的支持,例如 RDFa 和 SPARQL 1.1 与
Intellidimension 相比,它的优点是完全免费(从 GPL、LGPL 或 MIT 中选择您自己的许可证,具体取决于根据您的需要)
回复:SPARQL
SemWeb 和 dotNetRDF 都包含用于执行查询的 SPARQL 解析器和引擎。 SemWeb 基于旧的基于 Java 的 SPARQL 引擎的 IKVM 端口,该引擎早已被 Jena 框架中更高级的 ARQ 引擎所取代。 dotNetRDF 具有 Leviathan 引擎,该引擎具有与 ARQ 接近的功能(尽管对于某些类型的查询不一定具有相同的性能)。
ARQ (Jena) 和 Leviathan (dotNetRDF) 都支持大多数新兴的 SPARQL 1.1 规范。如果您已有 SQL 知识,那么您很可能希望使用支持此功能的引擎,因为这会将 SQL 的许多熟悉的功能添加到 SPARQL 语言中,例如聚合(COUNT、MAX 等)、GROUP BY、HAVING、项目表达式( fn:concat(?x, ?y) AS ?z)
Another option in .Net is dotNetRDF (disclaimer - I am the lead developer on this project)
It has the advantage over SemWeb that is is currently maintained and has active ongoing development plus it includes support for many of the newer Semantic Web technologies such as RDFa and SPARQL 1.1
Versus Intellidimension it has the advantage of being totally free (pick your own license from GPL, LGPL or MIT depending on your needs)
Re: SPARQL
Both SemWeb and dotNetRDF include SPARQL parsers and engines for executing queries. SemWeb's is based on an IKVM port of an old Java based SPARQL engine which has long since by superceded by the much superior ARQ engine in the Jena framework. dotNetRDF has the Leviathan engine which has close feature parity to ARQ (though not necessarily as performant for some kinds of queries).
Both ARQ (Jena) and Leviathan (dotNetRDF) support the majority of the emerging SPARQL 1.1 specification. If you have existing knowledge of SQL then you most likely want to use an engine which supports this as this adds many of the familiar features of SQL into the SPARQL language e.g. Aggregates (COUNT, MAX etc), GROUP BY, HAVING, Project Expressions (fn:concat(?x, ?y) AS ?z)
解决方法是使用 SemWeb Library 将 RDF 文件解析到内存中,然后解析到数据库。您还可以导入关联的本体。
Semweb 有一个嵌入式 SPARQL 库,因此您可以在数据库上运行 SPARQL 查询。如果您不熟悉 SPARQL,可以使用 LINQ。
如果您不熟悉语义 Web 技术,我建议您首先阅读语义 Web 入门 (以书籍和 PowerPoint 文件形式提供)。 Jena 网站上还有一个不错的SPARQL 教程
The way to go is using the SemWeb Library to parse the RDF File into memory and then into a database. You may also import the associated ontologies.
Semweb has an embedded SPARQL library, so you can run SPARQL Queries on the database. If you are not familiar with SPARQL, you can use LINQ.
If you are new to Semantic Web Technologies, I recommend first to read the Semantic Web Primer (available as book and PowerPoint files). There is also a nice SPARQL Tutorial on the Jena Website
还有一个选择是 dotSesame 库。这是 Java RDF 框架 Sesame 的 IKVM 移植。它包括 RDF 解析器、编写器、SPARQL 查询引擎和推理器。
Yet another option is the dotSesame library. This is an IKVM port of the Java RDF framework Sesame. It includes RDF parsers, writers, a SPARQL query engine, and reasoners.
使用 RDFSharp (http://rdfsharp.codeplex.com/),您不需要了解 SPARQL,因为您可以流畅地创建 SPARQL 查询并将其应用到图表和存储中。所有这些都无需编写一行 SPARQL 查询。
With RDFSharp (http://rdfsharp.codeplex.com/) you don't need to know SPARQL, because you create fluently your SPARQL queries and apply them to graphs and stores. All without writing a single line of SPARQL query.