Git Product home page Git Product logo

pystardog's Introduction

pystardog

Python wrapper for communicating with the Stardog HTTP server.

What is it?

This framework wraps all the functionality of a client for the Stardog Knowledge Graph, and provides access to a full set of functions such as executing SPARQL queries, administrative tasks on Stardog, and the use of the Reasoning API.

The implementation uses the HTTP protocol, since most of Stardog functionality is available using this protocol. For more information, go to the Stardog's HTTP Programming documentation.

Installation

pystardog is on PyPI so all you need is: pip install pystardog

Documentation

Documentation is readable at Read the Docs or can be built using Sphinx:

cd docs
pip install -r requirements.txt
make html

Tests

To run the tests locally, a valid Stardog license is required and placed in the dockerfiles/stardog-license-key.bin. Docker and docker-compose are also required.

 docker-compose -f docker-compose.single-node.yml up --exit-code-from tests-single-node
 docker-compose -f docker-compose.cluster.yml up --exit-code-from tests

Format

To run a format of all the files

virtualenv -p $(which python3) venv
. venv/bin/activate
pip install -r test-requirements.txt
black .

Quick Example

import stardog

conn_details = {
  'endpoint': 'http://localhost:5820',
  'username': 'admin',
  'password': 'admin'
}

with stardog.Admin(**conn_details) as admin:
  db = admin.new_database('db')

  with stardog.Connection('db', **conn_details) as conn:
    conn.begin()
    conn.add(stardog.content.File('./test/data/example.ttl'))
    conn.commit()
    results = conn.select('select * { ?a ?p ?o }')

  db.drop()

Interactive Tutorial

There is a Jupyter notebook and instructions in the notebooks directory of this repository.

pystardog's People

Contributors

scardena avatar cullan avatar cpdomina avatar joephayes avatar alimoabd2127 avatar drahnreb avatar jbalint avatar mhgrove avatar rmyers avatar snowell avatar fventuri-availity avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.