Eng. Samer T
Eng. Samer T

Reputation: 6526

how to return triple (was "row") number in SPARQL?

Can I return the triple number in SPARQL query?

For example, in Oracle database we can do this with rownum pseudo-column or ROW_NUMBER() function.

So how to query it in SPARQL from DBpedia, for example?

We can count triples by using count(*) or count(?var_name) function in SPARQL, but how to display an incremental number for each triple in SPARQL query? Is it possible?

Upvotes: 3

Views: 949

Answers (1)

scotthenninger
scotthenninger

Reputation: 4001

No, it is not possible because SPARQL is designed to query RDF graphs, and RDF graphs are not tables. Hence there is no concept of a row - instead data is represented by subject, object, predicate triples representing a graph.

A SPARQL SELECT statement does return a result set that is basically a row for each query match, but that's different than representing the data in rows.

Upvotes: 2

Related Questions