rdf-sparql 问题

发布于 2024-09-05 01:50:45 字数 118 浏览 9 评论 0原文

我需要获取属于我的本体的 rdfs 文件的属性值..它有公里属性,其值为 12500.00..我需要获取这个值....在我的 rdfs 文件中没有 URI ....

任何人都可以告诉我如何做到这一点::::

i need to get the property value of the rdfs file which was belongs to my ontology..it has kilometer property and the value of it is 12500.00.. i need to get this value.... in my rdfs file there is no URI....

CAN ANY ONE SHOW ME THE WAY FOR DO THIS::::

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

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

发布评论

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

评论(2

鹊巢 2024-09-12 01:50:46
SELECT ?value WHERE {
    ?thing <http://whatever/myvocabulary.rdfs#kilometer> ?value .
}

<...> 中的 URI 替换为词汇表中公里属性的实际 URI。

哦,您是否尝试阅读 SPARQL 教程

SELECT ?value WHERE {
    ?thing <http://whatever/myvocabulary.rdfs#kilometer> ?value .
}

Replace the URI inside <...> with the actual URI of the kilometer property in your vocabulary.

Oh and did you try reading a SPARQL tutorial?

无所的.畏惧 2024-09-12 01:50:46

如果您可以显示您尝试查询的数据示例,那么回答您的问题会容易得多。我可以假设您说“在我的 RDFS 文件中没有 URI”的两个原因:

  • 您文档中的 URI 是缩写的,因此看起来不像传统的 http://... URI。它们可能采用 somePrefix:some-name 形式,
  • 您尝试查询的值附加到所谓的空白节点,或没有 URI 的资源。

在第一种情况下,这只是扩展前缀的情况。在第二种情况下,您必须构建一条从您可以识别(通过名称或其属性)的节点到您尝试查询的节点的查询路径。在这两种情况下都很容易做到,但很难抽象地解释 - 如果您显示实际数据,就会容易得多。

在评论中您问:“我怎样才能获得我的 RDF 文件的 URI?”。我将不得不再次猜测,但我假设您正在尝试通过程序中的 URI 引用本体文件(例如,将其加载到 Jena 模型中)。我能想到三种可能性:

  • 你想要引用一个 file: URI;例如,c:\User\fred\vocabs\foo.ttl 处的本体将为 file:///c:/User/fred/vocabs/foo.ttl ,而 /home/fred/vocabs/foo.txt 将为 file:///home/fred/vocabs/foo.txt。请注意,file: 前缀后面有三个正斜杠字符。

  • 您想通过本地 Apache 服务器或类似服务器引用该文件;如果您的本体位于 /home/fred/public_html/vocabs/foo.ttl 中,则 URI 将类似于 http://localhost:8080/~fred/vocabs/foo.ttl(详细信息可能会有所不同,具体取决于您设置服务器的方式)

  • 您将文件托管在 Joseki 中 实例或类似实例,在这种情况下,URI 将由您的 Joseki 配置确定,有关详细信息,请参阅 Joseki 文档。

It would be a lot easier to answer your question if you could show a sample of the data that you're trying to query. I can hypothesise two reasons why you say "in my RDFS file there is no URI":

  • the URI's in your document are abbreviated so do not look like traditional http://... URI's, for example they may be in the form somePrefix:some-name
  • the value you are trying to query is attached to a so-called blank node, or a resource with no URI.

In the first case, it's simply a case of expanding the prefix. In the second case, you have to construct a path to query from a node you can identify (either by name, or by its properties) to the node you are trying to query. Easy to do in either case, but harder to explain in abstract - it will be much easier if you show your actual data.

In the comments you asked: "how can I get the URI of my RDF file?". Again I'm going to have to guess, but I presume that you are trying to reference your ontology file by URI in your program (e.g. to load it into a Jena model). There are three possibilities I can think of:

  • you want to reference a file: URI; for example the ontology at c:\User\fred\vocabs\foo.ttl would be file:///c:/User/fred/vocabs/foo.ttl, whereas /home/fred/vocabs/foo.txt would be file:///home/fred/vocabs/foo.txt. Note that there are three forward-slash characters after the file: prefix.

  • you want to reference the file via a local Apache server or similar; if your ontology is in /home/fred/public_html/vocabs/foo.ttl then the URI would be something like http://localhost:8080/~fred/vocabs/foo.ttl (details may vary depending on how you set up your server)

  • you host the file in a Joseki instance or similar, in which case the URI will be determined by your Joseki configuration, see the Joseki documentation for details.

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