tentris


Nametentris JSON
Version 0.19.4b0 PyPI version JSON
download
home_pageNone
SummaryPython bindings for using the RDF graph database Tentris RDF rdflib
upload_time2025-08-11 10:37:49
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseNone
keywords tentris knowledge graph rdf sparql graph database rdflib semantic web
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Running Tentris Using Python

> **Note:** Connecting to local/remote Tentris instances via HTTP is supported on all plattforms.
> Running Tentris **within** python is only supported on Linux.

## Getting Started

The Tentris Python library is a plugin for [rdflib](https://rdflib.readthedocs.io/en/7.1.0/gettingstarted.html).

### Native (Linux only)

With the native `TentrisStore`, Tentris is embedded in Python applications.

```python
import tentris
import rdflib

# Create an RDFLib graph using Tentris as its backend
graph = rdflib.Graph(store="Tentris")

# Load the graph using the SPARQL Update operation `LOAD`
# https://www.w3.org/TR/2013/REC-sparql11-update-20130321/#load 
graph.update("LOAD <https://files.tentris.io/mona-lisa.ttl>")

# Query the Mona Lisa knowledge graph
query_str = """
   PREFIX foaf: <http://xmlns.com/foaf/0.1/>
   PREFIX dbr: <http://dbpedia.org/resource/>
   PREFIX dbo: <http://dbpedia.org/ontology/>

   SELECT ?name WHERE {
      dbr:Mona_Lisa dbo:author ?person .
      ?person foaf:name ?name .
   }
"""

for binding in graph.query(query_str):
    print(f"{binding.name.n3()}")
```

The `TentrisStore` operates in-memory and does not persist data in the disk.
To use a disk-based instance of Tentris, the [HTTP-based store](#http) should be used.

### HTTP (Any Operating System)

Remote or local instances of Tentris can be queries using the HTTP-based `TentrisHTTPStore`.

#### Local

Assuming a Tentris server is running on the localhost listening to the default port, it can be queried as shown in the
example below.

```python
import tentris
import rdflib

graph = rdflib.Graph(store="TentrisHTTP")

for binding in graph.query("SELECT * WHERE { ?s ?p ?o } LIMIT 10"):
    print(f"{binding.s.n3()} {binding.p.n3()} {binding.o.n3()}")
```

#### Remote

To query remote instances of Tentris, the URL needs to be explicitly stated.

```python
from tentris import TentrisHTTPStore
import rdflib

graph = rdflib.Graph(store=TentrisHTTPStore("https://dbpedia.data.dice-research.org"))

for binding in graph.query("SELECT * WHERE { ?s ?p ?o } LIMIT 10"):
    print(f"{binding.s.n3()} {binding.p.n3()} {binding.o.n3()}")
```

For more information about setting up a disk-based instance of Tentris, please refer to the
chapter [Binary](https://docs.tentris.io/running_with_binaries.html).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "tentris",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": "Tentris GmbH <info@tentris.io>",
    "keywords": "tentris, knowledge graph, RDF, SPARQL, graph database, rdflib, semantic web",
    "author": null,
    "author_email": "Tentris GmbH <info@tentris.io>",
    "download_url": null,
    "platform": null,
    "description": "# Running Tentris Using Python\n\n> **Note:** Connecting to local/remote Tentris instances via HTTP is supported on all plattforms.\n> Running Tentris **within** python is only supported on Linux.\n\n## Getting Started\n\nThe Tentris Python library is a plugin for [rdflib](https://rdflib.readthedocs.io/en/7.1.0/gettingstarted.html).\n\n### Native (Linux only)\n\nWith the native `TentrisStore`, Tentris is embedded in Python applications.\n\n```python\nimport tentris\nimport rdflib\n\n# Create an RDFLib graph using Tentris as its backend\ngraph = rdflib.Graph(store=\"Tentris\")\n\n# Load the graph using the SPARQL Update operation `LOAD`\n# https://www.w3.org/TR/2013/REC-sparql11-update-20130321/#load \ngraph.update(\"LOAD <https://files.tentris.io/mona-lisa.ttl>\")\n\n# Query the Mona Lisa knowledge graph\nquery_str = \"\"\"\n   PREFIX foaf: <http://xmlns.com/foaf/0.1/>\n   PREFIX dbr: <http://dbpedia.org/resource/>\n   PREFIX dbo: <http://dbpedia.org/ontology/>\n\n   SELECT ?name WHERE {\n      dbr:Mona_Lisa dbo:author ?person .\n      ?person foaf:name ?name .\n   }\n\"\"\"\n\nfor binding in graph.query(query_str):\n    print(f\"{binding.name.n3()}\")\n```\n\nThe `TentrisStore` operates in-memory and does not persist data in the disk.\nTo use a disk-based instance of Tentris, the [HTTP-based store](#http) should be used.\n\n### HTTP (Any Operating System)\n\nRemote or local instances of Tentris can be queries using the HTTP-based `TentrisHTTPStore`.\n\n#### Local\n\nAssuming a Tentris server is running on the localhost listening to the default port, it can be queried as shown in the\nexample below.\n\n```python\nimport tentris\nimport rdflib\n\ngraph = rdflib.Graph(store=\"TentrisHTTP\")\n\nfor binding in graph.query(\"SELECT * WHERE { ?s ?p ?o } LIMIT 10\"):\n    print(f\"{binding.s.n3()} {binding.p.n3()} {binding.o.n3()}\")\n```\n\n#### Remote\n\nTo query remote instances of Tentris, the URL needs to be explicitly stated.\n\n```python\nfrom tentris import TentrisHTTPStore\nimport rdflib\n\ngraph = rdflib.Graph(store=TentrisHTTPStore(\"https://dbpedia.data.dice-research.org\"))\n\nfor binding in graph.query(\"SELECT * WHERE { ?s ?p ?o } LIMIT 10\"):\n    print(f\"{binding.s.n3()} {binding.p.n3()} {binding.o.n3()}\")\n```\n\nFor more information about setting up a disk-based instance of Tentris, please refer to the\nchapter [Binary](https://docs.tentris.io/running_with_binaries.html).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python bindings for using the RDF graph database Tentris RDF rdflib",
    "version": "0.19.4b0",
    "project_urls": {
        "Changelog": "https://github.com/tentris/tentris/releases",
        "Documentation": "https://docs.tentris.io/running_with_python.html",
        "Homepage": "https://tentris.io",
        "Issues": "https://github.com/tentris/tentris/issues",
        "License": "https://tentris.io/#eula",
        "Repository": "https://github.com/tentris/tentris"
    },
    "split_keywords": [
        "tentris",
        " knowledge graph",
        " rdf",
        " sparql",
        " graph database",
        " rdflib",
        " semantic web"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "539286ba931efa6812b3822fe2a96a45bf86258fbbe8234bae77cc203a745ca4",
                "md5": "eb4abc2f8633ee99f4d1d925f27379e6",
                "sha256": "bcc02bf4df76272920c8b8e0abc5d714f36283f927bf34477eda833e3b128bc2"
            },
            "downloads": -1,
            "filename": "tentris-0.19.4b0-cp312-abi3-manylinux_2_34_x86_64.whl",
            "has_sig": false,
            "md5_digest": "eb4abc2f8633ee99f4d1d925f27379e6",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.12",
            "size": 10365287,
            "upload_time": "2025-08-11T10:37:49",
            "upload_time_iso_8601": "2025-08-11T10:37:49.436412Z",
            "url": "https://files.pythonhosted.org/packages/53/92/86ba931efa6812b3822fe2a96a45bf86258fbbe8234bae77cc203a745ca4/tentris-0.19.4b0-cp312-abi3-manylinux_2_34_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "60dff901406007e49bf64f43eb4e9851938de0d5f5a8a68da8d285a66fc3b3c6",
                "md5": "1afbc6e922a09e14775185b5a2d6742e",
                "sha256": "15bc0ae2b6be533fad2d2d7277067654c66bb8a20c5853cdce538d5f8822a1aa"
            },
            "downloads": -1,
            "filename": "tentris-0.19.4b0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1afbc6e922a09e14775185b5a2d6742e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 10751,
            "upload_time": "2025-08-11T10:37:51",
            "upload_time_iso_8601": "2025-08-11T10:37:51.858350Z",
            "url": "https://files.pythonhosted.org/packages/60/df/f901406007e49bf64f43eb4e9851938de0d5f5a8a68da8d285a66fc3b3c6/tentris-0.19.4b0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-11 10:37:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tentris",
    "github_project": "tentris",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "tentris"
}
        
Elapsed time: 1.91600s