Search code examples
rdfsparqltriplestorefuseki

Sparql where clause


i'm trying to create a sparql query that returns every column where the column "subject" is "http://purl.org/dc/elements/1.1/creator".

In sql, it should be something like this:

SELECT * WHERE Subject = "<http://purl.org/dc/elements/1.1/creator>"

The sparql query that comes close to what I want looks like this:

SELECT ?subject ?predicate ?object
WHERE { 
    <http://purl.org/dc/elements/1.1/creator> ?object ?predicate optional {
    ?subject ?predicate ?object
  }
}

It returns a table, with all the three columns, but the ?subject column is empty for some reason. The ?predicate and the ?object column are not empty and show the correct data.

Anyone who can help me with this?

Thanks a lot :D


Solution

  • Assuming your Triplestore is populated with the correct statements then try -

    SELECT ?subject ?predicate ?object
    WHERE { 
        VALUES ?subject { <http://purl.org/dc/elements/1.1/creator> }
        ?subject ?predicate ?object .
    }