首页 > 解决方案 > 文本中的 LinkedData 链接

问题描述

我的问题是关于语义关联数据的

考虑以下

<resource>
      skos:label "Some Label"

资源可以具有语义标记的标签。

我正在尝试构建标签/标题包含引用的数据集,我如何使用 skos:label 或一些类似的词汇来表示它?

在哪里

<resource>
   skos:label "Text " + <anotherresource1#text> <anotherresource2#text> .

<anoherresource1>
   :text "Hello" .

<anoherresource2>
   :text "World" .

这样标签就变成了“Text” + “Hello” + “World”

标签: rdfjenalinked-dataturtle-rdf

解决方案


我会争辩说,当您引用某些内容时,您希望您引用的文本实际存在于您的资源中,因为如果其他人更改它,那很可能会改变原始文本的含义。

这里有两件事要解决——如何创建区分原始文本和引用文本的文字,以及如何将其链接到其来源。

的范围skos:prefLabel似乎是普通文字的类,所以应该只有字符串和语言标记的字符串。rdfs:label然而,任何文字似乎都很好,所以我暂时先使用它(rdfs:comment但更适合更长和更复杂的文本)。

您还很可能希望以一种仍然易于工具识别和显示的方式公开文本。我将在这里使用 HTML 或 XML,因为任何不理解其含义的工具都可以简单地剥离标签并仅显示内容。

我将在这里使用 HTML,因为那里<q>有用于此目的的标签。您可能还想指定片段的语言并删除样式:

<http://example.org/resource>
   rdfs:label '<span lang="en">Text <q cite="http://example.org/anotherresource1" style="quotes:none">Hello</q> <q cite="http://example.org/anotherresource2" style="quotes:none">World</q></span>'^^rdf:HTML .

这对于呈现数据和从中引用其他资源应该足够了,但您可能还希望反向可发现。我会和dcterms这里一起去:

<http://example.org/anotherresource1>
   dcterms:isReferencedBy '<span lang="en">Text <q cite="http://example.org/anotherresource1" style="quotes:none">Hello</q> <q cite="http://example.org/anotherresource2" style="quotes:none">World</q></span>'^^rdf:HTML .

<http://example.org/anotherresource2>
   dcterms:isReferencedBy '<span lang="en">Text <q cite="http://example.org/anotherresource1" style="quotes:none">Hello</q> <q cite="http://example.org/anotherresource2" style="quotes:none">World</q></span>'^^rdf:HTML .

如您所见,这很快变得不切实际,但是有一种方法可以将它与一些 OWL 结合起来:

<http://example.org/resource>
   rdfs:label [
      owl:sameAs '<span lang="en">Text <q cite="http://example.org/anotherresource1" style="quotes:none">Hello</q> <q cite="http://example.org/anotherresource2" style="quotes:none">World</q></span>'^^rdf:HTML ;
      dcterms:references <http://example.org/anotherresource1> ;
      dcterms:references <http://example.org/anotherresource2>
   ] .

这使得可以将标签指定为与原始文字相同,但也可以根据其他关系来讨论它。

如果工具不理解,还有另一种选择owl:sameAs,尽管较弱:

<http://example.org/resource>
   rdfs:label '<span lang="en">Text <q cite="http://example.org/anotherresource1" style="quotes:none">Hello</q> <q cite="http://example.org/anotherresource2" style="quotes:none">World</q></span>'^^rdf:HTML ;
   rdfs:label [
      dcterms:references <http://example.org/anotherresource1> ;
      dcterms:references <http://example.org/anotherresource2>
   ] .

这仍然以一种需要最小努力来查找应该显示的内容的方式指定标签,但这并不一定意味着我们谈论单个标签。这个问题可以通过一些重复来解决:

<http://example.org/resource>
   rdfs:label '<span lang="en">Text <q cite="http://example.org/anotherresource1" style="quotes:none">Hello</q> <q cite="http://example.org/anotherresource2" style="quotes:none">World</q></span>'^^rdf:HTML ;
   rdfs:label [
      owl:sameAs '<span lang="en">Text <q cite="http://example.org/anotherresource1" style="quotes:none">Hello</q> <q cite="http://example.org/anotherresource2" style="quotes:none">World</q></span>'^^rdf:HTML ;
      dcterms:references <http://example.org/anotherresource1> ;
      dcterms:references <http://example.org/anotherresource2>
   ] .

最后三个选项中的第一个和第三个选项对我来说似乎同样有效,因此您可以选择最适合您打算浏览数据库的工具的选项。


推荐阅读