All Projects → ziyasal → Pyley

ziyasal / Pyley

Licence: unlicense
Python package for an open-source graph database Cayley

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pyley

Tinkerpop
Apache TinkerPop - a graph computing framework
Stars: ✭ 1,309 (+766.89%)
Mutual labels:  graph-database
Libneo4j Client
neo4j-client -- Neo4j Command Line Interface (CLI)
Stars: ✭ 121 (-19.87%)
Mutual labels:  graph-database
Arangodb
🥑 ArangoDB is a native multi-model database with flexible data models for documents, graphs, and key-values. Build high performance applications using a convenient SQL-like query language or JavaScript extensions.
Stars: ✭ 11,880 (+7767.55%)
Mutual labels:  graph-database
Neo4j Core
A simple unified API that can access both the server and embedded Neo4j database. Used by the neo4j gem
Stars: ✭ 99 (-34.44%)
Mutual labels:  graph-database
Bio4j
Bio4j abstract model and general entry point to the project
Stars: ✭ 113 (-25.17%)
Mutual labels:  graph-database
Neo4j Streams
Neo4j Kafka Integrations, Docs =>
Stars: ✭ 126 (-16.56%)
Mutual labels:  graph-database
Cog
A Persistent Embedded Graph Database for Python
Stars: ✭ 90 (-40.4%)
Mutual labels:  graph-database
Arches
Arches is a web platform for creating, managing, & visualizing geospatial data. Arches was inspired by the needs of the Cultural Heritage community, particularly the widespread need of organizations to build & manage cultural heritage inventories
Stars: ✭ 146 (-3.31%)
Mutual labels:  graph-database
Pgql Lang
PGQL is an SQL-based query language for the Property Graph data model
Stars: ✭ 114 (-24.5%)
Mutual labels:  graph-database
Ferma
An ORM / OGM for the TinkerPop graph stack.
Stars: ✭ 130 (-13.91%)
Mutual labels:  graph-database
Homebase React
The React state management library for write-heavy applications
Stars: ✭ 101 (-33.11%)
Mutual labels:  graph-database
Aleph
Search and browse documents and data; find the people and companies you look for.
Stars: ✭ 1,539 (+919.21%)
Mutual labels:  graph-database
Gaffer
A large-scale entity and relation database supporting aggregation of properties
Stars: ✭ 1,642 (+987.42%)
Mutual labels:  graph-database
Activegraph
An active model wrapper for the Neo4j Graph Database for Ruby.
Stars: ✭ 1,329 (+780.13%)
Mutual labels:  graph-database
Gremlin Orm
gremlin-orm is an ORM for graph databases in Node.js
Stars: ✭ 136 (-9.93%)
Mutual labels:  graph-database
Crux
General purpose bitemporal database for SQL, Datalog & graph queries
Stars: ✭ 1,296 (+758.28%)
Mutual labels:  graph-database
Movies Javascript Bolt
Neo4j Movies Example with webpack-in-browser app using the neo4j-javascript-driver
Stars: ✭ 123 (-18.54%)
Mutual labels:  graph-database
Neo4j Php Ogm
Neo4j Object Graph Mapper for PHP
Stars: ✭ 151 (+0%)
Mutual labels:  graph-database
Jnosql
Eclipse JNoSQL is a framework which has the goal to help Java developers to create Jakarta EE applications with NoSQL.
Stars: ✭ 145 (-3.97%)
Mutual labels:  graph-database
Reddit Detective
Play detective on Reddit: Discover political disinformation campaigns, secret influencers and more
Stars: ✭ 129 (-14.57%)
Mutual labels:  graph-database

.. image:: https://github.com/ziyasal/pyley/raw/master/pyley.png?raw=true

pyley

.. image:: https://img.shields.io/pypi/v/pyley.svg :target: https://pypi.org/project/pyley

.. image:: https://img.shields.io/pypi/pyversions/pyley.svg :target: https://pypi.org/project/pyley

.. image:: https://travis-ci.org/ziyasal/pyley.svg?branch=master :target: https://travis-ci.org/ziyasal/pyley

.. image:: https://coveralls.io/repos/ziyasal/pyley/badge.svg?branch=master&service=github :target: https://coveralls.io/github/ziyasal/pyley?branch=master

Python <https://www.python.org/>_ client for an open-source graph database Cayley <https://github.com/google/cayley>_.

Cayley is an open-source graph inspired by the graph database behind `Freebase <http://freebase.com/>`_ and Google's `Knowledge Graph <http://www.google.com/insidesearch/features/search/knowledge.html>`_. Its goal is to be a part of the developer's toolbox where `Linked Data <http://linkeddata.org/>`_ and graph-shaped data (semantic webs, social networks, etc) in general are concerned.

Install via pip

You can install pyley using::

$ pip install pyley

Sample

Import pyley:

.. code-block:: python

from pyley import CayleyClient, GraphObject

# Create cayley client
# this creates client with default parameters `http://localhost:64210/api/v1/query/gizmo`
client = CayleyClient()

# or  specify `url` and `version` parameters
client = CayleyClient("http://localhost:64210", "v1")

g = GraphObject()

# Query all vertices in the graph, limit to the first 5 vertices found.
g.Vertex().GetLimit(5)

# Start with only one vertex, the literal name "Humphrey Bogart", and retrieve all of them.
query = g.Vertex("Humphrey Bogart").All();
response = client.Send(query)
# response.result contains JSON data and response.r contains raw response
print response.result 

# `g` and `V` are synonyms for `graph` and `Vertex` respectively, as they are quite common.
query = g.V("Humphrey Bogart").All()
response = client.Send(query)

# "Humphrey Bogart" is a name, but not an entity. 
# Let's find the entities with this name in our dataset.
# Follow links that are pointing In to our "Humphrey Bogart" node with the predicate "name".
query = g.V("Humphrey Bogart").In("<name>").All()
response = client.Send(query)

# Notice that "name" is a generic predicate in our dataset. 
# Starting with a movie gives a similar effect.
query = g.V("Casablanca").In("name").All()
response = client.Send(query)

# Relatedly, we can ask the reverse; all ids with the name "Casablanca"
query = g.V().Has("name", "Casablanca").All()
response = client.Send(query)

# Let's get the list of actors in the film
query = g.V().Has("name", "Casablanca") \
              .Out("/film/film/starring") \
              .Out("/film/performance/actor") \
              .Out("name") \
              .All()

response = client.Send(query)

# But this is starting to get long. 
# Let's use a morphism -- a pre-defined path stored in a variable -- as our linkage
film_to_actor = g.Morphism().Out("/film/film/starring").Out("/film/performance/actor")
query = g.V() \
        .Has("name", "Casablanca") \
        .Follow(film_to_actor) \
        .Out("name") \
        .All()
response = client.Send(query)

# Add data programatically to the JSON result list. Can be any JSON type.
query = g.Emit({'name': "John Doe", 'age': 41, 'isActor': True})
response = client.Send(query)

Bugs

If you encounter a bug, performance issue, or malfunction, please add an Issues <https://github.com/ziyasal/pyley/issues>_ with steps on how to reproduce the problem or feel to free to open a pull request.

TODO

  • Improve Gizmo implementation (Basic steps implemented at the moment)
  • Add more tests
  • Add more documentation

Open Source Projects in Use

  • requests <https://github.com/kennethreitz/requests>_ by @kennethreitz

License

@ziλasal & @abdullahselek

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].