Glad if someone can clarify.
I always read that SQL and SPARQL are very similar. However, a lot of times i have seen sparql query without the FROM keyword. You would assume that you have to query the datasource 'FROM' somewhere in the database like how SQL behaves.
Example
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name
WHERE
{
?person foaf:name ?name .
}
How does it know where to look for? Like in SQL, look in Database1 - table1
Cheers
SPARQL queries are execute against an RDF dataset, which has two parts:
You can specify the graph to query using the optional FROM
or FROM NAMED
clauses. Have a look at Specifying RDF Datasets. If you omit those clauses, then the query is executed on the default graph.
Graphs and RDF dataset storage is implementation dependent. For example, using Jena ARQ you use a QueryExecutionFactory
and you can initialize it in two ways:
Model
, which becomes the default graph on which queries are executedDataset
, which can contain a single default graph and several named graphsCode Examples for Jena ARQ are available here. Other implementation may be different.