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.4.tar.gz (21.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.4-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bikidata-0.4.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.6

File hashes

Hashes for bikidata-0.4.tar.gz
Algorithm Hash digest
SHA256 306dff09a74bdb239ce5d5fd4721fbfaf9ed0c230d9e75c6b47459f930da281e
MD5 eeeda7064dad0c99481bd0276c4bf7cf
BLAKE2b-256 288982ba59aedf94daa7983345f91d942d61b923cba8c0737f1a78257f7bc41d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bikidata-0.4-py3-none-any.whl
  • Upload date:
  • Size: 23.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.6

File hashes

Hashes for bikidata-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 121696c0c3f263b04378b191df9db26fc34629ec0190ef2671158791e00adfca
MD5 0a7bd66111ff3831d6b630126f96cdcd
BLAKE2b-256 eb5b2b3a038a30e52ce7db4ffd5aab7ad0c63dcb7c6d3051b4778e0d7aafd19d

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