我正在尝试使用标识符的增量变量在图形上执行空白节点 skolemization,但是,urn:count 对象没有被更新。
到目前为止,我有以下代码。
PREFIX : <http://example.com/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
####################
# Create Counter Graph #
####################
INSERT DATA {
graph <urn:counters> {<urn:Example> <urn:count> 1 }
}
;
####################
# Rewrite objects #
####################
DELETE {
#remove the old value of the counter
graph <urn:counters> {<urn:Example> <urn:count> ?old}
?s ?p ?bnode .
}
INSERT {
#update the new value of the counter
graph <urn:counters> {<urn:Example> <urn:count> ?new}
?s ?p ?iri .
GRAPH :aliases {
?bnode owl:sameAs ?iri .
}
}
WHERE {
{
SELECT ?bnode ?iri ?new ?old
WHERE {
{
SELECT DISTINCT ?bnode
WHERE {
[] ?p ?bnode .
FILTER isBlank(?bnode)
}
}
# retrieve the counter
graph <urn:counters> {<urn:Example> <urn:count> ?old}
# compute the new value
bind(?old+1 as ?new)
#construct the IRI
bind(IRI(concat("http://example.org/item/", str(?old))) as ?iri)
}
}
?s ?p ?bnode .
}
;
这会产生以下输出。
<#TripleMap1>
rr:logicalTable <http://example.org/item/1> ;
rr:predicateObjectMap <http://example.org/item/1> ;
rr:subjectMap <http://example.org/item/1> .
但是我希望输出如下。
<#TripleMap1>
rr:logicalTable <http://example.org/item/1> ;
rr:predicateObjectMap <http://example.org/item/2> ;
rr:subjectMap <http://example.org/item/3> .
输入图如下。
@prefix rr: <http://www.w3.org/ns/r2rml#> .
<#TripleMap1>
rr:logicalTable [] ;
rr:predicateObjectMap [];
rr:subjectMap [];
任何帮助,将不胜感激。