Rdf SPARQL查询:如何仅获取文本或字符串作为结果?
数据:Rdf SPARQL查询:如何仅获取文本或字符串作为结果?,rdf,sparql,Rdf,Sparql,数据: <untitled-ontology-5:OperationName rdf:datatype="http://www.w3.org/2001/XMLSchema#string"> Adhesive Curing </untitled-ontology-5:OperationName> PREFIX rdf:<http://wwww.semanticweb.org/ontologies/2012/7/9/untitled-ontology-5#>
<untitled-ontology-5:OperationName rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
Adhesive Curing
</untitled-ontology-5:OperationName>
PREFIX rdf:<http://wwww.semanticweb.org/ontologies/2012/7/9/untitled-ontology-5#>
SELECT ?object
WHERE { ?subject rdf:OperationName ?object .
}
Adhesive Curing^^http://www.w3.org/2001/XMLSchema#string
Adhesive Curing
我的问题:
<untitled-ontology-5:OperationName rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
Adhesive Curing
</untitled-ontology-5:OperationName>
PREFIX rdf:<http://wwww.semanticweb.org/ontologies/2012/7/9/untitled-ontology-5#>
SELECT ?object
WHERE { ?subject rdf:OperationName ?object .
}
Adhesive Curing^^http://www.w3.org/2001/XMLSchema#string
Adhesive Curing
SPARQL查询的结果不是我想要的结果。正确的结果应该只包含文本/字符串,而不包含URI部分。我想创建以下结果:
正确的结果:
<untitled-ontology-5:OperationName rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
Adhesive Curing
</untitled-ontology-5:OperationName>
PREFIX rdf:<http://wwww.semanticweb.org/ontologies/2012/7/9/untitled-ontology-5#>
SELECT ?object
WHERE { ?subject rdf:OperationName ?object .
}
Adhesive Curing^^http://www.w3.org/2001/XMLSchema#string
Adhesive Curing
您需要使用
STR()
函数来检索文本的词法标签:
查询:
SELECT (str(?object) as ?label)
WHERE { ?subject rdf:OperationName ?object . }