Graphics Reference
In-Depth Information
> export JAVA_OPTIONS=-Xmx4096m
> cd titan-all-0.4.4/bin
> gremlin.sh ../../productdb/makeproductdb.groovy
Graph Query Languages
Oncethegraphdatabasehasbeenpopulated,youarereadytostartquerying
it for information. There is a good chance that you are familiar with SQL.
SQListhestandardquerylanguageforprettymuchanythingthatresembles
a relational database. Graph databases, however, have unique structures
that require unique query languages, so, unfortunately, SQL will not get you
very far here. You will need to spend some amount of time learning a new
language. Luckily, a little basic knowledge will go a long way.
Two of those most universal standards are SPARQL and Gremlin. Titan
supports both.
SPARQL Protocol and RDF Query Language (SPARQL) is supported by
many graph databases for querying Resource Description Framework
(RDF). RDF is a formal standard for knowledge representation that was
born out of the “Semantic Web” movement, the goal of which is to provide
structured representations of the vastly unstructured data available on the
Internet. SPARQL is a standard query language for RDF-encoded
information and bears some resemblance to SQL in both name and syntax.
The following is an example of a query that you might use to retrieve all
categorizations of product 44:
SELECT ?category WHERE
tg:44 tg:categorization ?category
}
Tip
To try out SPARQL on a massive RDF collection of knowledge
statements extracted from Wikipedia, visit DBpedia at
http://wiki.dbpedia.org/ .
Gremlin is a distinctly different and elegant graph-traversal-oriented
language for query, analysis, and manipulation of graphs. Gremlin can be
a little cleaner and more intuitive in some cases, and less so in others. For
Search WWH ::




Custom Search