0

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

Andronicus
  • 25,419
  • 17
  • 47
  • 88
Kuzeko
  • 1,545
  • 16
  • 39

1 Answers1

1

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
Kuzeko
  • 1,545
  • 16
  • 39