问题
There are triplestores (semantic databases), and there are general-purpose graph databases.
Both are based on the similar concepts of linking one "item" to another via a relationship. Triplestores support RDF and are queried by SPARQL, but such add-ons can be (and are) implemented ontop of general-purpose graph databases as well.
What is the fundamental difference that would make you prefer a semantic db / triplestore to a general purpose graph database like neo4j?
回答1:
Triples stores are graph databases. RDF is a graph. Granted, triple stores tend to not store the information internally as a graph; that's sub-optimal for query answering, but they're still graph databases.
You'd prefer them to something like neo4j if you're interested in an ecosystem based on W3C standards. Makes interop with other RDF-based systems trivial, and it makes picking up everything and moving to a different triple store quite painless.
回答2:
To start with, besically all data-structures can be projected more or less painful into any underlying storage engine (or even your file system and text files). The reason to choose a certain data model and storage backend are IMHO:
- your development and modelling preferences
- your expected runtime performance for inserting, storing, and querying of your model.
As mentioned before, both RDBMSes and TripleStores tend to be useful at runtime in "shallow" traversing of JOIN or SparQL traversals, and do much work in caches or prepared views etc. Graph Databases (uniquely Neo4j) put the graph structure actually down to the storage layer and do pointer chasing (with a number of optimizations) on node-record level. Thus, when traversing the graph, you don't need to touch more than your current subgraph down to the storage layer, thus being able to traverse parts of the data without touching the whole graph, resulting in constant performance for a number of interesting scenarios.
回答3:
My 2 cents.
Neo4j comes under the category of Property Graph. They support directed relations and each relation has only two nodes; the start node and end node. The nodes and relationships can store arbitrary data in the form of key-value pairs. They however can't support 3-ary relations. i.e. You can't have one edge connecting more than two nodes i.e a kind of hyperdege. You can however emulate a 3-ary relations in property graphs by creating join nodes. You can see how to implement this in neo4j here.
Triplestores have standardized query language in the form of SPARQL but no standard exists yet for querying other graph databases. RDF is the standard for importing/exporting from triplestores.
来源:https://stackoverflow.com/questions/18482663/what-is-the-difference-between-triplestores-and-graph-databases