background preloader

Algorithms

Facebook Twitter

Introduction to py2neo. Fundamentals — py2neo 1.5.1 documentation. At the heart of py2neo are three core classes needed for every application: GraphDatabaseService, Node and Relationship. A GraphDatabaseService maintains a link to a Neo4j database via a root URI. For a default installation, this will be (don’t forget the trailing slash!) And can be constructed as follows: from py2neo import neo4jgraph_db = neo4j.GraphDatabaseService(" A GraphDatabaseService object provides access to a number of core methods, such as those to create and delete nodes, match relationships and manage indexes. This could be carried out in a single create statement: from py2neo import node, reldie_hard = graph_db.create( node(name="Bruce Willis"), node(name="John McClane"), node(name="Alan Rickman"), node(name="Hans Gruber"), node(name="Nakatomi Plaza"), rel(0, "PLAYS", 1), rel(2, "PLAYS", 3), rel(1, "VISITS", 4), rel(3, "STEALS_FROM", 4), rel(1, "KILLS", 3),) Node & Relationship Abstracts Examples: Note Transactions.

Using Neo4j and Tinkerpop to work with RDF. Part 1! [Warning: This is another super-technical post. If you don’t know what the Semantic Web and RDF are, this will be incomprehensible.] In my last post, I talked about my attempt, as a novice programmer currently capable of only rudimentary Python and not much else, to use Neo4j as an RDF triple store so that I could work with the DBpedia dataset on my laptop. Tinkerpop is an open-source set of tools that lets you magically convert Neo4j into a fully functional triplestore. My conclusion from that attempt was that using only Python to set up and control Neo4j for RDF is basically impossible. To reiterate why I’m doing this in the first place: the DBPedia dataset is fascinating and I want to explore it. I’m still determined to accomplish that goal, so my new plan is to just bite the bullet and teach myself “just enough Java” (JeJ. As of six months ago, I knew basically nothing about programming. Now for Java, on all of those points…not so much.

So: STEP 1: Make sure you have Java. 1. 2. 3. Home · tinkerpop/furnace Wiki.