# 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:
```python
import bikidata
r = bikidata.query({
"filters": [
{"p":"fts",
"o":"something"
}
]
})
```
or
```python
r = bikidata.query({
"filters": [
{ "p":"id",
"o":"<http://example.com/id/123>"
}
]
})
```
or
```python
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](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](https://redis.io/) 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:
```bash
pip install redis
```
And then you need to run the bikidata worker in a separate terminal:
```bash
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:
Raw data
{
"_id": null,
"home_page": "https://github.com/ISE-FIZKarlsruhe/bikidata/",
"name": "bikidata",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "search, RDF, Linked Data",
"author": "Etienne Posthumus",
"author_email": "ep@epoz.org",
"download_url": "https://files.pythonhosted.org/packages/93/e9/0eec65a70a40332af34de12d231a2f4d3c428c0eef9c4652c101ee78dd44/bikidata-0.3.1.tar.gz",
"platform": null,
"description": "# bikiDATA\n\n## Developer-friendly Queries over RDF triples\n\nUsing this tool you can hit the ground running, and make some useful queries over RDF data using simple JSON calls.\n\n### Getting started TL;DR\n\nYou have a n-triple file called `myfile.nt`.\n\nInstall bikidata by saying `pip install bikidata`\n\nImport it into bikidata with: `python -m bikidata myfile.nt`\n\nAnd now, in a python prompt, you can query things, for example:\n\n```python\nimport bikidata\n\nr = bikidata.query({\n \"filters\": [\n {\"p\":\"fts\",\n \"o\":\"something\"\n }\n ]\n})\n```\n\nor\n\n```python\nr = bikidata.query({\n \"filters\": [\n { \"p\":\"id\",\n \"o\":\"<http://example.com/id/123>\"\n }\n ]\n})\n```\n\nor\n\n```python\nr = bikidata.query({\n \"filters\": [\n {\"p\":\"fts\",\n \"o\":\"something\"\n },\n { \"op\":\"not\",\n \"p\":\"<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>\",\n \"o\":\"<https://swapi.co/vocabulary/Species>\"\n }\n ]\n})\n```\n\nFor more examples, see the file: [examples.ipynb](examples.ipynb)\n\n# Redis support\n\nWhen 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.\nBy using [Redis](https://redis.io/) we can scale the number of bikidata workers horizontally, and share the cache between them.\nThe `query_async` function can now be awaited in an async context. This function places the query in a Redis queue, and awaits the result.\n\nTo use this, you need to have a Redis server running, and install the `redis` python package:\n\n```bash\npip install redis\n```\n\nAnd then you need to run the bikidata worker in a separate terminal:\n\n```bash\npython -m bikidata worker\n```\n\nIt is possible to run multiple workers, and they will share the load.\n\nThen, in your code, you can await the `query_async` function in stead of the regular `query` function:\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Developer-friendly Queries over RDF triples",
"version": "0.3.1",
"project_urls": {
"Homepage": "https://github.com/ISE-FIZKarlsruhe/bikidata/",
"Repository": "https://github.com/ISE-FIZKarlsruhe/bikidata/"
},
"split_keywords": [
"search",
" rdf",
" linked data"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "dff2a867313ceb0bc0772cfe784ab3324f6524db238c08b48bc14946a10fa6a9",
"md5": "8acaa3ac6a5367e7b5b01dc241d29bbc",
"sha256": "9421934d9b7361bfdb102f199c7d396e9abc9475a3a09e44462dbbd97630451d"
},
"downloads": -1,
"filename": "bikidata-0.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8acaa3ac6a5367e7b5b01dc241d29bbc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 16411,
"upload_time": "2025-09-02T23:42:47",
"upload_time_iso_8601": "2025-09-02T23:42:47.295885Z",
"url": "https://files.pythonhosted.org/packages/df/f2/a867313ceb0bc0772cfe784ab3324f6524db238c08b48bc14946a10fa6a9/bikidata-0.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "93e90eec65a70a40332af34de12d231a2f4d3c428c0eef9c4652c101ee78dd44",
"md5": "5544bd5f1cfa36cfbcd3d8c349222386",
"sha256": "0d04725a7707db20661f0254c6dc78aa5cb3e2f1bac5813af6567e8bcc2ce52d"
},
"downloads": -1,
"filename": "bikidata-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "5544bd5f1cfa36cfbcd3d8c349222386",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 14816,
"upload_time": "2025-09-02T23:42:49",
"upload_time_iso_8601": "2025-09-02T23:42:49.236706Z",
"url": "https://files.pythonhosted.org/packages/93/e9/0eec65a70a40332af34de12d231a2f4d3c428c0eef9c4652c101ee78dd44/bikidata-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-02 23:42:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ISE-FIZKarlsruhe",
"github_project": "bikidata",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "bikidata"
}