Question

SELECT ?class (count(distinct ?subClass) AS ?noci)  
WHERE { ?class jooo:hasJSubClass ?subClass}  
GROUP BY?class

I have the right answer but in the following format: "2"^^<http//www.w3.org/2001/XMLSchema#integer>. I need the answer to be only 2, So what can i do?

Was it helpful?

Solution

If you just want the lexical form — the "2" in "2"^^xsd:integer — use str():

SELECT ?class (str(count(distinct ?subClass)) AS ?noci) 

but note when talking about "2"^^xsd:integer, that is due to the surface appearance only — in Turtle, it can be 2 (with no ""). It's just syntax.

All literals (in RDF 1.1) have a lexical part and a datatype URI (and some have a lang tag in which case the datatype is rdf:langString). In RDF-2004 (AKA RDF 1.0), there are plain literals and datatype literals.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top