Cypher or SPARQL (or both) for Neo4j as my RDF Store

5,138 views
Skip to first unread message

ASrivastav

unread,
Sep 10, 2012, 5:45:40 PM9/10/12
to ne...@googlegroups.com
I have a couple of questions:

1.  We have modeled/represented our Neo4j data as RDF triples.  In contrast to Cypher, I know that SPARQL is designed for RDF stores.  Is that enough of an argument to choose SPARQL over Cypher as my go-to query language for my database?  Or can Cypher accomplish everything SPARQL can, just not with as much dexterity and/or ease?  I assume SPARQL cannot be used with a non-RDF store, so it would not work the other way around.

2.  I read a FAQ blog on Neo4j which stated that "You can use Neo4j as an RDF store, and then run SPARQL queries against it, by using TinkerPop".  Does that mean that SPARQL can only be used on the Embedded Neo4j only, since other Tinkerpop products (i.e. Blueprints) require the embedded server?  By the way, we are using Neo4j Server (i.e. REST APIs), not the Embedded Server.

Thanks!

ASrivastav

Marko Rodriguez

unread,
Sep 10, 2012, 5:47:55 PM9/10/12
to ne...@googlegroups.com
Hi,

2.  I read a FAQ blog on Neo4j which stated that "You can use Neo4j as an RDF store, and then run SPARQL queries against it, by using TinkerPop".  Does that mean that SPARQL can only be used on the Embedded Neo4j only, since other Tinkerpop products (i.e. Blueprints) require the embedded server?  By the way, we are using Neo4j Server (i.e. REST APIs), not the Embedded Server.

Neo4j Server simply wraps Neo4j embedded. As such, you can use GraphSail over Neo4j and thus achieve SPARQL over Neo4j.


HTH,
Marko.

ASrivastav

unread,
Sep 10, 2012, 6:32:36 PM9/10/12
to ne...@googlegroups.com
I appreciate the quick response Marko!

Any thoughts/opinions on using SPARQL over Cypher?  My thought is that since Cypher is a proprietary Neo4j query language, I would want to use Cypher over SPARQL.  But if it's smarter to use SPARQL over Cypher for a RDF store, then I would rather use SPARQL.

Thanks.

ASrivastav

Peter Neubauer

unread,
Sep 10, 2012, 6:41:56 PM9/10/12
to ne...@googlegroups.com
Hi there,
yes, Cypher is closer to the metal. OTOH, RDF is more established if
you deal with Linked Data. Not really sure what you want. How much RDF
querying do you need? Can you express your queries in Cypher? In that
case, I would choose the latter.

Cheers,

/peter neubauer

Neo4j 1.8.RC1 "Vindeln Vy" -
http://blog.neo4j.org/2012/09/neo4j-18rc1-really-careful-ftw.html

G: neubauer.peter
S: peter.neubauer
P: +46 704 106975
L: http://www.linkedin.com/in/neubauer
T: @peterneubauer

Wanna learn something new? Come to @graphconnect.
> --
>
>

Rickard Öberg

unread,
Sep 10, 2012, 9:14:25 PM9/10/12
to ne...@googlegroups.com
As with any language selection it is a lot about what you are trying to
express. SPARQL is more oriented towards full database scanning and
matching, whereas Cypher generally wants you to know of a starting point
and work from there. I think this will change over time though, as the
indexing in Neo improves, so that you basically don't have to think
about "start points" anymore. SPARQL is also read-only by design, so if
you want mutating operations Cypher is the only choice.

/Rickard

--
Rickard �berg
Developer
Neo Technology
Twitter: @rickardoberg, Skype: rickardoberg

ASrivastav

unread,
Sep 11, 2012, 1:10:03 AM9/11/12
to ne...@googlegroups.com
Thanks for the helpful responses, Peter and Rickard.

To be honest, we want our data stored in RDF format but we don't necessarily need to retrieve the data via RDF querying.  Also, we definitely need to execute CRUD-type operations, so if SPARQL is read-only by design, then that eliminates itself.

I feel much better about the decision to go with a REST API + Cypher solution for our Neo4j Server.  It provides maximum security plus I can use Cypher to query, insert, update and delete data in my graph.

I appreciate all of the help in making this decision.  Thanks.
Rickard �berg

Peter Neubauer

unread,
Sep 11, 2012, 1:30:14 AM9/11/12
to ne...@googlegroups.com

Hi there,
yes, Cypher is closer to the metal. OTOH, RDF is more established if you deal with Linked Data. Not really sure what you want. How much RDF querying do you need? Can you express your queries in

Cheers,

/peter neubauer

Neo4j 1.8.RC1 "Vindeln Vy" - http://blog.neo4j.org/2012/09/neo4j-18rc1-really-careful-ftw.html

G: neubauer.peter
S: peter.neubauer
P: +46 704 106975
L: http://www.linkedin.com/in/neubauer
T: @peterneubauer

Wanna learn something new? Come to @graphconnect.

On Tue, Sep 11, 2012 at 12:32 AM, ASrivastav <asriv...@identropy.com> wrote:

> --
>
>

Rickard Öberg

unread,
Oct 31, 2012, 10:03:01 PM10/31/12
to ne...@googlegroups.com
On 11/1/12 06:09 , Venkat Krishnamurthy wrote:
> This last statement is totally not true. SPARQL 1.1 has a fully defined
> update API that works like SQL DDL/DML that allows inline updates on
> live graphs.

The SPARQL Query language, which is what Neo4j supports, is read-only.
The SPARQL 1.1 Update language is separate from the former, and adds
updates, but AFAIK there are no plugins in Neo4j to support it (the
SPARQLPlugin doesn't anyway).

Venkat Krishnamurthy

unread,
Nov 1, 2012, 10:37:27 AM11/1/12
to ne...@googlegroups.com
Agreed, but your statement 'SPARQL is also read-only by design' doesnt provide either the context or clarification that it's specific to Neo4j's current capabilities, and not the standard itself.

On Wednesday, October 31, 2012 10:03:06 PM UTC-4, Rickard Öberg wrote:
On 11/1/12 06:09 , Venkat Krishnamurthy wrote:
> This last statement is totally not true. SPARQL 1.1 has a fully defined
> update API that works like SQL DDL/DML that allows inline updates on
> live graphs.

The SPARQL Query language, which is what Neo4j supports, is read-only.
The SPARQL 1.1 Update language is separate from the former, and adds
updates, but AFAIK there are no plugins in Neo4j to support it (the
SPARQLPlugin doesn't anyway).

/Rickard

--
Rickard �berg
Reply all
Reply to author
Forward
0 new messages