结果只有 SPARQL Return IRIs/URIs

SPARQL Return only IRIs/URIs as result

在 SPARQL 中,如何仅检索 IRI(或 URI)作为 BGP 的结果?

例如在

SELECT ?s ?o WHERE 
    {?s ?p ?o }
LIMIT 100

Return 只有那些 ?o 是 IRI

在 SPARQL 中存在以下测试

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

来源:List of SPARQL Filter Functions (Dataworld tutorial)

因此你可以写

SELECT ?s ?o WHERE {
       ?s ?p ?o 
       FILTER(isIRI(?o)) 
} limit 100