{"id":1470,"date":"2013-07-05T19:46:52","date_gmt":"2013-07-05T19:46:52","guid":{"rendered":"https:\/\/notebooks.dataone.org\/?p=1470"},"modified":"2013-07-24T00:52:12","modified_gmt":"2013-07-24T00:52:12","slug":"week-3-creating-pbase-repository-and-working-on-queries","status":"publish","type":"post","link":"https:\/\/notebooks.dataone.org\/pbase\/week-3-creating-pbase-repository-and-working-on-queries\/","title":{"rendered":"Week 3: Creating PBase Repository and Working on Queries"},"content":{"rendered":"

The main focus of this week was to build PBase main repository, set up the development environment, and get more familiar with the format of Cypher queries.<\/p>\n

The first thing to do was to translate workflow provenance traces to a Neo4j compatible format. Some of the approaches are: Neo4j Import tool<\/a>, Neo4j Batch Importer<\/a>, GraphML Loader<\/a> to load a graphML<\/a> file (a XML format for graphs), and XML to Graph Converter<\/a> (converts a XML file into Geoff, and Cypher creation commands).<\/p>\n

Neo4j comes in two forms: A standalone server that can be installed on any machine and is accessible through a REST API, or as a local database embedded in JVM process.<\/p>\n

Geoff<\/a> is a declarative notation for showing graph data with concise human-readable text. It allows defining independent sub-graphs within a graph. There are several container representations for Geoff. For PBase project we used a form of JSON as input for Neo4j database server.<\/p>\n

Neo4j’s XML Convertor<\/a> can be used to convert\u00a0 graphs in XML to Cypher commands and Geoff format but the format of workflow traces is different from this and that is why we need to create a specific convertor for them. A RESTClient then can be used to load the resulting Geoff formatted graph into Neo4j.<\/p>\n

The figure below shows three different ways of showing a piece (entities e35, e36, e38 and their relationships) of a Vistrail Wf (from left to right: a Vistrail Wf provenance trace, Graphviz, and Geoff representation).<\/p>\n

\"\"<\/a>
Click for a larger view.<\/figcaption><\/figure>\n

One other task for this week was setting up development environment and installing required tools, and looking through Cypher online tutorial<\/a>(s).<\/p>\n

Cypher is a declarative (what<\/em>, not how<\/em>) graph database query language for Neo4j, based on pattern matching and a SQL-like syntax. Cypher enables a user to ask the database to find data that matches a specific pattern (i.e.\u201cfind things like this\u201d). Similar to most query languages, Cypher is composed of clauses. In the most simple case, a query is compose of a START clause followed by a MATCH and a RETURN clause. Other Cypher clauses, WHERE, CREATE, DELETE,.., are very similar to those of SQL. Cypher can be used to show labeled directed relationships, transitive relationship paths, variable length paths ((A)-[*]->(B)), optional relationships (A-[?]->B), ….<\/p>\n

(Neo4j)-[:IS_A]->(Graph Database)<\/p>\n

(Neo4j)-[:likes]->Cypher<\/p>\n

\"Familiar<\/a>
Familiar SQL clauses in Cypher<\/figcaption><\/figure>\n

For example, the following queries, in order, show the list of data nodes (nodes that\u00a0 \u201cwasGeneratedBy\u201d actors), the list of data that has been generated but never used, and list of all data nodes that were used in generating node(61).<\/p>\n

\"2\"<\/a>After last week’s ProvWG meeting, we have a list of general categories of queries that PBase should be able to address. Next week I am going to tailor this list to a more specific list of queries and devote more time on translating them into Cypher.<\/p>\n

All feedback and suggestions are welcome and will be appreciated.<\/p>\n","protected":false},"excerpt":{"rendered":"

The main focus of this week was to build PBase main repository, set up the development environment, and get more familiar with the format of Cypher queries. The first thing to do was to translate workflow provenance traces to a Neo4j compatible format. Some of the approaches are: Neo4j Import Continue reading Week 3: Creating PBase Repository and Working on Queries<\/span>→<\/span><\/a><\/p>\n","protected":false},"author":40,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"_links":{"self":[{"href":"https:\/\/notebooks.dataone.org\/wp-json\/wp\/v2\/posts\/1470"}],"collection":[{"href":"https:\/\/notebooks.dataone.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/notebooks.dataone.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/notebooks.dataone.org\/wp-json\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/notebooks.dataone.org\/wp-json\/wp\/v2\/comments?post=1470"}],"version-history":[{"count":39,"href":"https:\/\/notebooks.dataone.org\/wp-json\/wp\/v2\/posts\/1470\/revisions"}],"predecessor-version":[{"id":1504,"href":"https:\/\/notebooks.dataone.org\/wp-json\/wp\/v2\/posts\/1470\/revisions\/1504"}],"wp:attachment":[{"href":"https:\/\/notebooks.dataone.org\/wp-json\/wp\/v2\/media?parent=1470"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/notebooks.dataone.org\/wp-json\/wp\/v2\/categories?post=1470"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/notebooks.dataone.org\/wp-json\/wp\/v2\/tags?post=1470"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}