Skip to main content

Developer-friendly Queries over RDF triples

Project description

bikiDATA

Developer-friendly Queries over RDF triples

Using this tool you can hit the ground running, and make some useful queries over RDF data using simple JSON calls.

Getting started TL;DR

You have a n-triple file called myfile.nt.

Install bikidata by saying pip install bikidata

Import it into bikidata with: python -m bikidata myfile.nt

And now, in a python prompt, you can query things, for example:

import bikidata

r = bikidata.query({
    "filters": [
        {"p":"fts",
         "o":"something"
        }
    ]
})

or

r = bikidata.query({
    "filters": [
        { "p":"id",
          "o":"<http://example.com/id/123>"
        }
    ]
})

or

r = bikidata.query({
    "filters": [
        {"p":"fts",
         "o":"something"
        },
        { "op":"not",
          "p":"<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>",
          "o":"<https://swapi.co/vocabulary/Species>"
        }
    ]
})

For more examples, see the file: examples.ipynb

Redis support

When querying non-trivial datasets of a few million triples, or handling many concurrent users, we do not want to open a new database connection for each query, and cache the results in memory. By using Redis we can scale the number of bikidata workers horizontally, and share the cache between them. The query_async function can now be awaited in an async context. This function places the query in a Redis queue, and awaits the result.

To use this, you need to have a Redis server running, and install the redis python package:

pip install redis

And then you need to run the bikidata worker in a separate terminal:

python -m bikidata worker

It is possible to run multiple workers, and they will share the load.

Then, in your code, you can await the query_async function in stead of the regular query function:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bikidata-0.3.4.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bikidata-0.3.4-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file bikidata-0.3.4.tar.gz.

File metadata

  • Download URL: bikidata-0.3.4.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for bikidata-0.3.4.tar.gz
Algorithm Hash digest
SHA256 b2c9826ec709cb0e3ffb770fd3fd9979f3810f052d4da9417a55037ad3abfbf1
MD5 3db1712403b759b1efbe313893b80649
BLAKE2b-256 b7801578ad96d541ab84beff318745520494a5057260d0d21506b1c366b3bfd1

See more details on using hashes here.

File details

Details for the file bikidata-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: bikidata-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for bikidata-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 70be934f5b1e1e2e3efd967cbeb8507659119b309efb1e498704f0a55acd191d
MD5 1c35827b1919cbb3935d2779f2427170
BLAKE2b-256 bcb69f57cae14016043f7e4d75fc6c435b6ab3794a0c066520bda462307423af

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page