In SPARQL how do I retrieve only IRIs (or URIs) as a result of a BGP?
E.g. in
SELECT ?s ?o WHERE
{?s ?p ?o }
LIMIT 100
Return only those ?o
that are IRIs
In SPARQL there exist the following tests
SPARQL tests: isIRI, isURI, isBlank, isLiteral, isNumeric, bound
isIRI
,isURI
: returns true if the term is an IRI or a URI
isBlank
: returns true if the term is a blank node
isLiteral
: returns true if the term is a literal
isNumeric
: returns true if the term is a numeric value
Source:List of SPARQL Filter Functions (Dataworld tutorial)
Hence you can write
SELECT ?s ?o WHERE {
?s ?p ?o
FILTER(isIRI(?o))
} limit 100