如何向 RDF 三元组添加开始和结束时间? [英] How do I add a start and end time to a RDF triple?

查看:30
本文介绍了如何向 RDF 三元组添加开始和结束时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我们在 Turtle 语法中有以下三元组:

Supposing we have the following triple in Turtle syntax:

<http:/example.com/Paul> <http:/example.com/running> <http:/example.com/10miles> .

如何添加开始时间和结束时间?例如,如果我想说他从上午 10 点开始,并在上午 12 点完成了 10 英里的跑步.我想使用 xsd:dateTime.

How do I add a start and end time? For example if I want to say he started at 10 am and finished his 10miles run at 12 am. I want to use xsd:dateTime.

推荐答案

做到这一点的一种方法是通过具体化 - 对语句进行陈述.在这里,您可以选择为语句提供 URI,以便它可以在外部取消引用,或者使用空白节点.这意味着,在您的情况下,您需要通过对它的主语、宾语和谓词进行陈述来识别该陈述,并在您的情况下讲述更多关于它的事情——关于它所代表的一个时期的开始和结束.这是使用空白节点时的样子:

One way of doing this is through reification - making statements about the statement. Here, you have a choice of giving the statement a URI, so that it's externally dereferenceable, or using a blank node. That would mean, in your case, that you need to identify the statement by making statements about it subject, object and predicate, and tell more things about it, in your case - about start and end of a period it represents. This is how it would look with a blank node:

[
  rdf:type rdf:Statement ;   #this anonymous resource is a Statement... 
  rdf:subject ex:Paul ;      #...with subject Paul
  rdf:predicate ex:running ; #...predicate running
  rdf:object "10miles" ;     #...and object "10miles"
  ex:hasPeriodStart "2018-04-09T10:00:00"^^xsd:dateTime ;
  ex:hasPeriodEnd "2018-04-09T12:00:00"^^xsd:dateTime ;
].

在定义 ex:hasPeriodStartex:hasPeriodEnd 时,您可能需要声明它们的类型和范围:

When defining ex:hasPeriodStart and ex:hasPeriodEnd you might want to declare their type and range:

ex:hasPeriodStart
  rdf:type owl:DatatypeProperty ;
  rdfs:range xsd:dateTime ;

或者您可能更愿意使用 SHACL 来确保数据的质量,您可以在其中'将使用形状表达式定义您的约束.

Or you might prefer to assure the quality of your data with SHACL, where you'll define your constraints with shape expressions.

我建议不要定义与时间相关的属性,而是重用 中的那些时间本体.

I'd recommend not to define your time-related properties but to reuse those from the time ontology.

这篇关于如何向 RDF 三元组添加开始和结束时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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