« Adding triples to a Wilbur database | Main | XML considered harmful, and other things »

2005-05-02

Querying RDF

Lately I have been doing a lot of thinking about the Semantic Web and specifically about how to query RDF. I have this query language that I like using to build applications that have to access RDF data. It's based on paths: This seems like a good idea, since I think of the RDF data as a graph with recursive and repetitive patterns, and my query language supports those (via an operator capable of computing the transitive closure of an arbitrary subpath).

Against this, I just cannot understand what's going on with SPARQL. Since when was it a good idea to query graphs using a query language that, essentially, is based on the relational calculus? It seems that others have noticed this too.

Neither approach (path queries or relational queries) is completely satisfactory, although I like the path approach better. More thinking is needed (I recommend this to the SPARQL folks too).

Speaking of thinking, I really like this quote (about scientific work) attributed to Werner Heisenberg that goes something like this: "...go on thinking beyond the point where thinking begins to hurt."

Now where did I put those painkillers again...?

Posted by ora at 13:10

Comments

I think we'll see a lot of interesting results when people start stress-testing SPARQL (i.e. writing queries that are more than just SELECT ?x WHERE (?x foaf:knows rich:Rich)). It's debatable whether SPARQL is "good enough" (striking the right balance of simplicity and familiarity versus power), or whether missing features or a basis in SQL is detrimental, and I think that exposure to real applications will illuminate this.

What would be sad is if SPARQL crowded out alternative, more powerful, query languages (I always liked the look of OWL-QL, myself, and SeRQL is quite capable).

Posted by: Richard Newman at May 2, 2005 06:01 PM

We just have SELECT clause for querying the triplestore. How about DELETE , UPDATE , CREATE ? We have those in SQL but not RDQL . Why ?

Posted by: Siddhartha at May 9, 2005 12:41 PM

In http://www.w3.org/TandS/QL/QL98/pp/enabling.html (which you signed up to at the time :) we see basically the same approach to RDF query. SPARQL extends in a couple of ways, by allowing options, and by allowing you to match against properties of the data source. But basic idea is the same...

Posted by: Dan Brickley at June 13, 2005 04:57 PM

No disagreement, necessarily. But over the years I have found the path queries to be very useful in practical application development, to the point that now I would have a hard time living without them.

Posted by: Ora Lassila at June 14, 2005 11:51 AM

Sounds like you are as frustrated as I am with a query language rooted in a data paradigm (relational data) at the opposite end of the structure spectrum from RDF:

See my earlier gripes / assesments:

http://copia.ogbuji.net/blog/2005/07/22#VersaPathBased

http://copia.ogbuji.net/blog/2005/07/06#BNodesAndRDFQuerying

http://copia.ogbuji.net/blog/2005-05-19/SPARQL_ver

And give Versa a try (I wrote an article covering it's fundamentals in contrast to SPARQL's quite recently):

http://www.xml.com/pub/a/2005/07/20/versa.html

Posted by: chimezie at August 5, 2005 06:18 PM

Yeah, your definately not the only one frustrated with the idea of modelling a query language from a data paradigm (relational data) completely opposite the structure spectrum from RDF. See:

http://copia.ogbuji.net/blog/2005-07-22/VersaPathBased

http://copia.ogbuji.net/blog/2005-05-19/SPARQL_ver

And check out GraphPath (http://www.langdale.com.au/GraphPath) as well

Posted by: chimezie at August 5, 2005 06:36 PM

I had my doubts when I first saw the SQL style in RDQL (or whichever), wondering why that approach was taken rather than an RPath. The latter did seem the intuitive approach. Since then I've only read the articles on the Path side, but have played around with the SQL side. Ok, I've run into some situations where something like a recursive call would have been welcome. But generally SPARQL appears to work a treat, and I reckon conceptually very easy for anyone with a vague idea of SQL. I suspect this may be a big advantage for encouraging adoption - a lot of data people have only just arrived at XPath, but have been around RDBMSs for years. Where there is a strong need for a path oriented approach, something like Versa can fulfil the role - it would be nice to see it integrated into some of the other APIs.

I can only speak for myself, but the lack I've been most aware of is the one Siddhartha refers to - I'm less bothered about how I access the graph (path or statements) than whether or not it's read-only. That part shouldn't be difficult, one way or another:

http://www.mindswap.org/2005/sparql/protocol/

http://dannyayers.com/archives/2005/07/14/sparql-protocol

Posted by: Danny at August 7, 2005 03:14 PM