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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for bikidata-0.3.6.tar.gz
Algorithm Hash digest
SHA256 65120aef010803615dd44448a5e69ffe06d7e2f8640753343dcdf321f79b0df4
MD5 a8a9eaf5a6e204d420e4a2dde6898db2
BLAKE2b-256 16790b1fe664cdb159f79456851a4e0812460fbd257eb05045acdbf7343edab8

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for bikidata-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 4657d764694ff83ef101b6678eac90b772e3f00ea49964b2e0f312cf226d2344
MD5 1c399817a39cfd2c184eb7e3e6f50e06
BLAKE2b-256 9050f0dbfac55383974bca4d2eef22b05896b19a30d56323a12b61b511dfeb24

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