简体   繁体   中英

SPARQL Return only IRIs/URIs as result

In SPARQL how do I retrieve only IRIs (or URIs) as a result of a BGP?

Eg 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM