How to remove XML Schema data type from sparql query?

Im running a sparql query in a file that contains

<User rdf:about="#RJ"> <hasName rdf:datatype="http://www.w3.org/2001/XMLSchema#string">RJ</hasName> </User> 

I want to return only the name ie 'RJ', but when I enter my query

 SELECT ?name FROM <example.com> WHERE { assign:RJ assign:hasName ?name . } 

where assign is the correct namespace, I return this:

 "RJ" ^^<http://www.w3.org/2001/XMLSchema#string> 

Does anyone have any tips on how to remove the xml schema type for sparql noob?

early

+6
xsd semantic-web rdf owl sparql
source share
1 answer

Can you do this, it depends on the SPARQL implementation you are using. In SPARQL 1.0, this is not possible, but SPARQL 1.1 , which is currently widely supported by most implementations that became the W3C recommendation in March 2013. can use Project Expressions as follows:

 SELECT (STR(?name) AS ?StringName) FROM <example.com> WHERE { assign:RJ assign:hasName ?name } 

Basically, a project expression allows you to use any valid SPARQL expression that you could use elsewhere to calculate a new value based on variables that were previously bound.

+8
source share

All Articles