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.3.tar.gz (15.1 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.3-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bikidata-0.3.3.tar.gz
  • Upload date:
  • Size: 15.1 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.3.tar.gz
Algorithm Hash digest
SHA256 89d8ba8d98899180d922ba4c84953a2d0c5142e3ab7adba369e652d73a2d9d06
MD5 f16a467d158c7dbb323699ffca977b4e
BLAKE2b-256 e6496cbf99aedd43d2934e6159643162af093d4002f1f3ec0e62d8f940f169b5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bikidata-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 16.7 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1fe5caecc2b6da034596b166f94e045b65e3505cb741f98d43645bad6a17a997
MD5 457206cd73c874dd76179fb532968c54
BLAKE2b-256 59045b9e37bfa4aed9a26c4bee32f7c725ed77798dd4e53a4a1a1b511a230528

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