0
我一直在試圖做一些格式的日期/時間值,以使它們在結果中顯示爲字符串文字。我正在使用來自apache-jena-2.11.0的Jena ARQ。ARQ是否支持SPARQL 1.1日期和時間函數?
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?activity ?agent ?time ?time (YEAR(?time) as ?year) WHERE {
?activity prov:endedAtTime ?time ;
prov:wasAssociatedWith ?agent .
}
ARQ報告的日期時間
"2015-02-20T13:07:53+00:00:00"^^<xsd:dateTime> to me.
這是屬性的外觀在RDF爲TTL:
<http://www.w3.org/ns/prov#endedAtTime>
"2014-08-04T15:35:09+01:00:00"^^<xsd:dateTime> ;
這與下面使用耶拿API創建:
resource.addProperty(PROVO.endedAtTime,
model.createTypedLiteral(date, "xsd:dateTime"));
Mayb e我使用的API錯誤?
謝謝安迪。還有點不確定。我添加了一些關於我如何使用Jena API的信息。它是我的用途,爲財產產生錯誤的類型? – Interition 2015-03-14 10:19:03
在創建文字時需要放入URI:'model.createTypedLiteral(date,「http://www.w3.org/2001/XMLSchema#dateTime」)' – AndyS 2015-03-14 15:38:50
@Interition更明確地說,* string *「xsd: dateTime「是你傳遞給createTypedLiteral的東西。耶拿期待一個真正的URI字符串。請注意,TTL在字符串「xsd:dateTime」周圍包含''「^^',其中'<>'。當你使用實際的URI時,你會得到'「... ^^ xsd:dateTime'和正確的URI。 –
2015-03-15 01:27:55