LINQ与SPARQL的比较? [英] Comparison of LINQ to SPARQL?

查看:64
本文介绍了LINQ与SPARQL的比较?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不是MS.NET专家,但对LINQ感到好奇,因此本文 http://www.linqpad.net/WhyLINQBeatsSQL.aspx 很好地解释了为什么它比SQL更好.

我在SPARQL上做了很多工作,并且在很多方面都比SQL差(即使1.1有点不成熟,恕我直言).上面的样式是否可以将LINQ与SPARQL进行比较?

我认为对于RDF数据最有趣的LINQ方面是LINQ可以返回层次结构(在RDBMS中,它是表值变量;或者认为是XML结构).SPARQL无法做到这一点:

  • 您无法进行CONSTRUCT子查询,请参见 GroupGraphPattern 并在语法中 SubSelect
  • 如果您尝试返回复杂构造的对象数组,那么我敢打赌,您会一团糟.我也不相信您可以混合使用数组&层次结构深达几个层次.如果您不同意,请参阅以下 http://vocab.getty.edu/doc/queries/#All_Data_For_Subject 并尝试编写查询以针对所有?s gvp:broaderExtended aat:300264089 返回查询(免责声明:我构建了该端点)

因此,对于SPARQL,我们要么返回表格数据,要么返回单个图形对象,但是不能自由地混合它们.具有讽刺意味的是,因为RDF 是图数据模型.

有几种LINQ到SPARQL的绑定:

但是,它们中的任何一个都可以处理这种层次结构"吗?方面?

解决方案

(我希望这是一个注释,但它太长了)

我既不是LINQ也不是SPARQL的专家,我也没有检查您提供的链接,但是最近我听了Anders Heilsberg,Microsoft技术研究员和C#首席设计师的播客.和LINQ.

http://www.se-radio.net/2008/05/episode-97-interview-anders-hejlsberg/

他说LINQ语法遵循FROM ... WHERE ... SELECT结构,以实现更好的类型推断.

当知道表名(FROM ...子句)时,LINQ中的类型推断引擎可以在编译时开始工作,以获取自动完成程序的列名,例如与Visual Studio中的语法检查器进行交互./p>

对于RDF三元组,属性/谓词(SELECT/WHERE)甚至可以为空,而FROM(空白节点)不能为空,我认为这不容易/不可能.

这些空白节点表示具有特定属性的个人的存在,但未提供标识或参考).

I'm not a MS.NET person but got curious about LINQ, and this article http://www.linqpad.net/WhyLINQBeatsSQL.aspx explains very well why it's better than SQL.

I work a lot with SPARQL and in many respects it's worse than SQL (even 1.1 is a bit immature IMHO). Is there a comparison of LINQ to SPARQL in the style of the above article?

I think the LINQ aspect that's most interesting for RDF data is that LINQ can return hierarchical structures (in RDBMS speak that's table-valued variables; or think XML structures). SPARQL cannot do that:

  • you can't make CONSTRUCT subqueries, see GroupGraphPattern and SubSelect in the grammar
  • if you try to return an array of complexly CONSTRUCTed objects, I bet you'll get a mess. Nor I believe you can mix arrays & hierarchical structures several levels deep. If you disagree, see this http://vocab.getty.edu/doc/queries/#All_Data_For_Subject and try to write a query to return it for all ?s gvp:broaderExtended aat:300264089 (disclaimers: I built that endpoint)

So with SPARQL we either return tabular data, or a single graph object but can't mix them freely. Which is ironic, because RDF is a graph data model.

There are several LINQ to SPARQL bindings:

But does any of them handle this "hierarchical structures" aspect?

解决方案

(I prefer this to be a comment but it is too too long)

I am not an expert, neither in LINQ nor SPARQL, and I didn't check the links you've provided, but recently I've listened to a Podcast with Anders Heilsberg, Microsoft Technical Fellow, and Lead Designer of C# and LINQ.

http://www.se-radio.net/2008/05/episode-97-interview-anders-hejlsberg/

He said that LINQ syntax follows a FROM ... WHERE ... SELECT structure to allow for better type inference.

When it knows the table name (FROM ... clause) the type inference engine in LINQ can start working at compile time, to fetch the column names for the autocompleter, and e.g interact with the syntax checker in Visual Studio.

I don't think this is easy/possible for a RDF triple where the property/predicate (SELECT /WHERE) can even be empty, but not FROM, (Blank Nodes).

These Blank Nodes denote existence of an individual with specific attributes, but without providing an identification or reference).

这篇关于LINQ与SPARQL的比较?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆