Macilias
Macilias

Reputation: 3535

SPARQL select from namespace

It's easy to select all statements from fuseki with a query like:

SELECT * { ?s  ?o  ?z}

but how to obtain all statements from a certain namespace prefix?

Upvotes: 1

Views: 1306

Answers (1)

AndyS
AndyS

Reputation: 16630

This can be done by testing the URI: if "from a certain namespace prefix" you want the subjects in the namespace: for ?s:

PREFIX ns: <....>
SELECT * {
 ?s  ?o  ?z
 FILTER (isURI(?s) && STRSTARTS(str(?s), str(ns:) ) )
}

Upvotes: 3

Related Questions