语义网 SPARQL CONSTRUCT 问题

发布于 2024-08-11 11:50:10 字数 486 浏览 10 评论 0原文

我正在使用名为 TopQuadrant 的工具来创建语义网 (RDF/OWL) 本体。该工具允许从 MS Excel 导入数据。我的电子表格基本上是一个两列工作表,第一列是 XPATH 表达式,第二列是该 XPATH 的描述。

导入电子表格后,我想使用 SPARQL 迭代数据,以根据第一列中的值创建本体。例如,如果我有一个如下所示的工作表:

XPATH                              Description
Food
Food/Fruit
Food/Fruit/Apple
Food/Vegetables
Food/Vegetables/Turnips

我希望 SPARQL 创建我的本体,其根类(当然在“Thing”下)为“Food”,在“Food”下有 2 个名为“Fruit”的子类和“蔬菜”,“水果”下是“苹果”的子类,“蔬菜”下是萝卜的子类……继续下去。

这是SPARQL 可以做的事情吗?

提前致谢。

I am using a tool called TopQuadrant to create a Semantic Web (RDF/OWL) Ontology. This tool allows for import of data from MS Excel. My spreadsheet is basically a two-column sheet with the first column being an XPATH expression and the second column being a description of that XPATH.

Once I import my spreadsheet, I would like to use SPARQL to iterate through the data to create an Ontology based on the values in my first column. For instance, if I had a sheet that looked as follows:

XPATH                              Description
Food
Food/Fruit
Food/Fruit/Apple
Food/Vegetables
Food/Vegetables/Turnips

I would like SPARQL to create my Ontology with a root class (under "Thing" of course) of 'Food', and under 'Food', 2 subclasses called 'Fruit' and 'Vegetables', and under 'Fruit' a subclass of 'Apple', and under 'Vegetables' a sublcass of Turnips... going on down the line.

Is this something that SPARQL can do?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

西瓜 2024-08-18 11:50:10

不,我不这么认为,SPARQL 被设计为一种查询语言,因此这超出了它的范围。虽然您从问题标题中暗示您希望使用 CONSTRUCT 查询来执行此操作,但由于数据的格式,这在 SPARQL 1.0 下是不可行的。

您的问题需要以 SPARQL 无法实现的方式处理第一列中的值,而无需定义您自己的自定义扩展 - 我不确定 TopQuadrant 是否对此有任何类型的支持。

仅根据电子表格中的数据,这是不可能的,但根据 TopQuadrant 导入电子表格的方式,这可能是可能的。作为一个语义 Web 工具,我假设 TopQuadrant 正在将您的电子表格输入转换为某种 RDF。如果是这种情况,您可以编辑您的问题以添加 RDF 表示,我可以给您一个更明确的答案。

我希望即使采用 RDF 形式,您也可能无法通过单个查询实现您的目标

No I don't think it is, SPARQL is designed as a query language so this is beyond it's scope. While you have implied from the question title you wish to use a CONSTRUCT query to do this it's not something that is doable under SPARQL 1.0 because of the format of your data.

Your question requires processing of the values in your first column in a way that's not possible with SPARQL without defining your own custom extensions to it - I am unsure if TopQuadrant has any kind of support for this.

Based on the data in your spreadsheet alone this is not possible, BUT it may be possible depending on how TopQuadrant imports your spreadsheet. As a Semantic Web tool I would assume that TopQuadrant is converting your spreadsheet input into some kind of RDF. If this is the case and you can edit your question to add that RDF representation I could give you a more definitive answer.

I would expect that even in an RDF form you probably can't achieve your aim with a single query

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文