Use a numeric value as a string value in SPARQL

Is there any way to use a numeric value as a string value in a SPARQL query? For example, consider the following data, query, and desired RDF result:

Knowledge base

@prefix gr:  <http://purl.org/goodrelations/v1#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.

:o a gr:QuantitativeValueFloat;
     gr:hasMinValueFloat "1,0"^^xsd:float
     gr:hasMaxValueFloat "10,0"^^xsd:float

Query

PREFIX gr: <http://purl.org/goodrelations/v1#>    
SELECT ?o ?v
WHERE {
  ?o a gr:QuantitativeValueFloat;
       gr:hasMinValueFloat ?vMin;
       gr:hasMaxValueFloat ?vMax.
  CONCAT((?vMin, ?vMax) as ?v)
}

Perfect result

-----------------
| o  | v        | 
=================
| :o | 1,0-10,0 | 
-----------------
+4
source share
1 answer

RDF , str. SPARQL . , 1 "1" ^^ xsd: integer, , "1" , str (1), str ( "1" ^^ xsd: integer). , , str concat

select ?xy where {
  values ?x { 1   }  #-- short for "1"^^xsd:integer
  values ?y { 2.5 }  #-- short for "2.5"^^xsd:decimal

  bind(concat(str(?x),"--",str(?y)) as ?xy)
}

------------
| xy       |
============
| "1--2.5" |
------------

, , , "10,0" ^^ xd: float, "10.0" ^^ xsd: float, (.), (,). ( , , SPARQL .)

+7

All Articles