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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for bikidata-0.3.7.tar.gz
Algorithm Hash digest
SHA256 717b8480ca08d755f4f488832d7ff660840b3b34608a4aa9f58cd17e78e5330c
MD5 51687d42d3d217b2ca2e64b61734e999
BLAKE2b-256 bfc081cc308115798a8463daaf6c5e21c6ed9cd21f351879e50cadd6c6bbe4d5

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for bikidata-0.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f82a5a357f79fc15306cd1b2d4b1e24f545a8cc2417a956e54ada01af3f27804
MD5 a2bc1347b18ed8cfa2d677754be669d6
BLAKE2b-256 8e833b51276c8e482e7d6e1a3e957ba52cf0781678f19b8f6d8e1ae2802baf63

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