# irdf: Interactive RDF graph widgets in Jupyter
This package allows you to visualize your RDFlib graph objects in two ways: as triple tables or a network visualization.
In the triple tables, you can filter the triples by subject, predicate or object value.
In the network visualizations, you can see the relations between entities, and the literals associated with them.
## Install
```
pip install irdf
```
## Usage
```python
import rdflib
import irdf
# Create a Graph
g = rdflib.Graph()
# Parse in an RDF file hosted on the Internet
g.parse('http://dbpedia.org/data/Vrije_Universiteit_Amsterdam.ttl')
```
```python
# Get an interactive table
irdf.table(g)
```
![table](https://raw.githubusercontent.com/bennokr/irdf/main/preview-table.png)
```python
# Get an interactive graph (filtering on certain properties)
# Click on nodes to see associated literals!
irdf.graph(g, p_filter=['/ontology/', 'depiction'], lang='en')
```
![graph](https://raw.githubusercontent.com/bennokr/irdf/main/preview-graph.png)
### Wikidata
In Wikidata, the labels of properties are associated with special property entities.
To get nice labels on edges in your visualization, you can specify a custom SPARQL property path to fetch them:
```python
import rdflib, irdf
g = rdflib.Graph()
g.parse('https://www.wikidata.org/wiki/Special:EntityData/Q1065414.ttl')
label_path = '(^wikibase:directClaim)*/rdfs:label'
irdf.graph(g, p_filter=['/direct/'], lang='en', label_path=label_path)
```
## Acknowledgements
This library is based on the great work of [ipycytoscape](https://github.com/cytoscape/ipycytoscape) and [itables](https://github.com/mwouts/itables).
Raw data
{
"_id": null,
"home_page": null,
"name": "irdf",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "ipython, jupyter, visualization, interaction, interact",
"author": null,
"author_email": "Benno Kruit <b.b.kruit@vu.nl>",
"download_url": "https://files.pythonhosted.org/packages/59/dc/904bcd3915453ac88c79e6ddcd8c8f77fb1da2374df12177c2690026c8f9/irdf-1.4.tar.gz",
"platform": null,
"description": "# irdf: Interactive RDF graph widgets in Jupyter\nThis package allows you to visualize your RDFlib graph objects in two ways: as triple tables or a network visualization.\n\nIn the triple tables, you can filter the triples by subject, predicate or object value.\n\nIn the network visualizations, you can see the relations between entities, and the literals associated with them.\n\n## Install\n```\npip install irdf\n```\n\n## Usage\n```python\nimport rdflib\nimport irdf\n\n# Create a Graph\ng = rdflib.Graph()\n\n# Parse in an RDF file hosted on the Internet\ng.parse('http://dbpedia.org/data/Vrije_Universiteit_Amsterdam.ttl')\n```\n\n```python\n# Get an interactive table\nirdf.table(g)\n```\n![table](https://raw.githubusercontent.com/bennokr/irdf/main/preview-table.png)\n\n```python\n# Get an interactive graph (filtering on certain properties)\n# Click on nodes to see associated literals!\nirdf.graph(g, p_filter=['/ontology/', 'depiction'], lang='en')\n```\n![graph](https://raw.githubusercontent.com/bennokr/irdf/main/preview-graph.png)\n\n### Wikidata\nIn Wikidata, the labels of properties are associated with special property entities.\nTo get nice labels on edges in your visualization, you can specify a custom SPARQL property path to fetch them:\n\n```python\nimport rdflib, irdf\ng = rdflib.Graph()\ng.parse('https://www.wikidata.org/wiki/Special:EntityData/Q1065414.ttl')\nlabel_path = '(^wikibase:directClaim)*/rdfs:label'\nirdf.graph(g, p_filter=['/direct/'], lang='en', label_path=label_path)\n```\n\n## Acknowledgements\nThis library is based on the great work of [ipycytoscape](https://github.com/cytoscape/ipycytoscape) and [itables](https://github.com/mwouts/itables).\n",
"bugtrack_url": null,
"license": null,
"summary": "Jupyter extension for interacting with RDF graphs",
"version": "1.4",
"project_urls": {
"Homepage": "https://github.com/bennokr/irdf",
"Issues": "https://github.com/bennokr/irdf/issues"
},
"split_keywords": [
"ipython",
" jupyter",
" visualization",
" interaction",
" interact"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "604fdbf9c7af3036a8f9e87f05492ddb1a9747cf5b18bd0a4ac12d426de04077",
"md5": "fccd50856ea0f5d18d01d60c20daa132",
"sha256": "8d5b454ae58eb8cec664e0d893a86fbdcc10aa8166875150f7e6424cb7ace767"
},
"downloads": -1,
"filename": "irdf-1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fccd50856ea0f5d18d01d60c20daa132",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 5466,
"upload_time": "2024-06-19T13:30:00",
"upload_time_iso_8601": "2024-06-19T13:30:00.873096Z",
"url": "https://files.pythonhosted.org/packages/60/4f/dbf9c7af3036a8f9e87f05492ddb1a9747cf5b18bd0a4ac12d426de04077/irdf-1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "59dc904bcd3915453ac88c79e6ddcd8c8f77fb1da2374df12177c2690026c8f9",
"md5": "2736b9b1b6405a2bb4f98c140c4182b3",
"sha256": "8ec0966300c11200b1f74216fc55d91e4f1bef58eea507547c7187f351d96995"
},
"downloads": -1,
"filename": "irdf-1.4.tar.gz",
"has_sig": false,
"md5_digest": "2736b9b1b6405a2bb4f98c140c4182b3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 5196,
"upload_time": "2024-06-19T13:30:02",
"upload_time_iso_8601": "2024-06-19T13:30:02.934370Z",
"url": "https://files.pythonhosted.org/packages/59/dc/904bcd3915453ac88c79e6ddcd8c8f77fb1da2374df12177c2690026c8f9/irdf-1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-19 13:30:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "bennokr",
"github_project": "irdf",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "irdf"
}