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

查看:155
本文介绍了如何为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天全站免登陆