ontodag 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ontodag-0.1.0/PKG-INFO +77 -0
- ontodag-0.1.0/README.md +61 -0
- ontodag-0.1.0/pyproject.toml +27 -0
- ontodag-0.1.0/setup.cfg +4 -0
- ontodag-0.1.0/src/ontodag/__init__.py +17 -0
- ontodag-0.1.0/src/ontodag/__main__.py +590 -0
- ontodag-0.1.0/src/ontodag/dag.py +741 -0
- ontodag-0.1.0/src/ontodag/owl.py +216 -0
- ontodag-0.1.0/src/ontodag/swarm_adapter.py +103 -0
- ontodag-0.1.0/src/ontodag.egg-info/PKG-INFO +77 -0
- ontodag-0.1.0/src/ontodag.egg-info/SOURCES.txt +21 -0
- ontodag-0.1.0/src/ontodag.egg-info/dependency_links.txt +1 -0
- ontodag-0.1.0/src/ontodag.egg-info/entry_points.txt +2 -0
- ontodag-0.1.0/src/ontodag.egg-info/requires.txt +11 -0
- ontodag-0.1.0/src/ontodag.egg-info/top_level.txt +1 -0
- ontodag-0.1.0/tests/test_boundaries.py +120 -0
- ontodag-0.1.0/tests/test_cli.py +225 -0
- ontodag-0.1.0/tests/test_invariants.py +329 -0
- ontodag-0.1.0/tests/test_swarm_adapter.py +317 -0
- ontodag-0.1.0/tests/test_swarm_bee.py +112 -0
- ontodag-0.1.0/tests/testdag.py +294 -0
- ontodag-0.1.0/tests/testitem.py +60 -0
- ontodag-0.1.0/tests/testowl.py +123 -0
ontodag-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ontodag
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Associative memory and categories based on a directed acyclic graph data structure
|
|
5
|
+
Requires-Python: >=3.8
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: graphviz
|
|
8
|
+
Requires-Dist: owlready2
|
|
9
|
+
Requires-Dist: recordstore>=0.11
|
|
10
|
+
Provides-Extra: web
|
|
11
|
+
Requires-Dist: flask; extra == "web"
|
|
12
|
+
Requires-Dist: dot2tex; extra == "web"
|
|
13
|
+
Requires-Dist: Pillow; extra == "web"
|
|
14
|
+
Provides-Extra: swarm
|
|
15
|
+
Requires-Dist: requests; extra == "swarm"
|
|
16
|
+
|
|
17
|
+
# OntoDAG
|
|
18
|
+
|
|
19
|
+
Associative memory and categories based on a directed acyclic graph data structure
|
|
20
|
+
|
|
21
|
+
## Documentation
|
|
22
|
+
|
|
23
|
+
- **[User Guide](docs/USER_GUIDE.md)** — installation, tutorial, Python API,
|
|
24
|
+
command line, web app/REST, file formats, troubleshooting. Start here.
|
|
25
|
+
- **[How It Works Inside](docs/HOW_IT_WORKS.md)** — the design in plain language
|
|
26
|
+
(canonical form, query planning, content-addressed persistence) and future plans.
|
|
27
|
+
- `docs/SWARM_DESIGN.md`, `docs/SEMANTIC_CODES.md` — engineering design documents.
|
|
28
|
+
|
|
29
|
+
See also **[ontodag-fs](https://github.com/petfold/ontodag-fs)**: any OntoDAG
|
|
30
|
+
store can be browsed as a filesystem — paths are category queries, files are
|
|
31
|
+
classified objects stored on Swarm, FUSE-mountable (`odag-fs`, which shares
|
|
32
|
+
odag's store settings).
|
|
33
|
+
|
|
34
|
+
## Specification
|
|
35
|
+
|
|
36
|
+
A Directed Acyclic Graph (DAG) associative storage and category manager in Python. You can store items into a ontodag and recall items from it. To store or "put" an item into a ontodag, you give it a name and a set of other names of already existing items that are its supercategories. To recall or "get", you specify a set of item names to get all items that are subcategories of all these items.
|
|
37
|
+
|
|
38
|
+
## Roadmap
|
|
39
|
+
|
|
40
|
+
- [x] Implement the basic DAG data structure (put, remove)
|
|
41
|
+
- [x] Simplify definitions not to include unnecessary links (e.g. bird under animal, animal is not needed)
|
|
42
|
+
- During put keep a dictionary of 'done' nodes of the inserted item and all its super categories
|
|
43
|
+
- Insert a link only to nodes which are not 'done'
|
|
44
|
+
- Increment counter only for items which are not 'done'
|
|
45
|
+
- [x] Save/load data structure into/from file (try PKL)
|
|
46
|
+
- [x] Load ontology from file (e.g. OWL)
|
|
47
|
+
- [x] Visualize graph (with python library - Graphviz)
|
|
48
|
+
- [x] More extensive test cases
|
|
49
|
+
- [x] Select suitable ontology for importing (to serve as the basis of the DAG)
|
|
50
|
+
- [x] Sub-class of OntoDAG with counters (for statistics)
|
|
51
|
+
- [ ] Predicated (parametric) items. Dealing with items not stored in the graph (e.g. numbers, intervals, geo coordinates, areas; general, hierarchical types (types stored in the graph))
|
|
52
|
+
- [ ] Implement space and time calculation for graph items (e.g. century, GPS bounding box)
|
|
53
|
+
- categories for item types, e.g. point in time, time interval, geo coordinates, geo area, url
|
|
54
|
+
- way to handle non-stored numerical types (time intervals, geo coordinates, areas, numbers, arbitrary types)
|
|
55
|
+
- way to store and retrieve ordered values (photo with exact time in response to "last week")
|
|
56
|
+
- ways to define (partial) ordering function
|
|
57
|
+
- file types (hierarchical, e.g. image, png)
|
|
58
|
+
- [ ] Name usage across different instances of OntoDAG:
|
|
59
|
+
- namespaces
|
|
60
|
+
- avoiding confusing names (different language and usage, spelling)
|
|
61
|
+
- ability to merge DAGs with different name usage, using namespaces
|
|
62
|
+
- [ ] Optimize retrieval and storage by choosing subsets of query items and finding existing nodes already stored in the DAG.
|
|
63
|
+
- [ ] Add and remove intermediate nodes to optimize search in the graph
|
|
64
|
+
- [ ] Port implementation to Golang
|
|
65
|
+
- [ ] Implement a REST API for the Golang (or Rust) implementation
|
|
66
|
+
- [ ] Interface with a graph database implementation.
|
|
67
|
+
- [ ] Implement a web interface for the REST API & host it on a website with user profiles
|
|
68
|
+
- [ ] Implement a limited functionality (DAG-only) graph database for Ethereum Swarm
|
|
69
|
+
- [ ] Design a plugin for Ethereum Swarm to store the DAG in a decentralized way
|
|
70
|
+
|
|
71
|
+
## Potential Applications
|
|
72
|
+
* Using the ontology graph for content categorization instead of folders
|
|
73
|
+
* Replace content tags with a more structured ontology
|
|
74
|
+
* Access control (ACT) groups
|
|
75
|
+
* Memberships in organizations and gate content based on membership
|
|
76
|
+
* Communication channel groups defined by the ontology
|
|
77
|
+
* Fostering deals within a universal marketplace for services and goods
|
ontodag-0.1.0/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# OntoDAG
|
|
2
|
+
|
|
3
|
+
Associative memory and categories based on a directed acyclic graph data structure
|
|
4
|
+
|
|
5
|
+
## Documentation
|
|
6
|
+
|
|
7
|
+
- **[User Guide](docs/USER_GUIDE.md)** — installation, tutorial, Python API,
|
|
8
|
+
command line, web app/REST, file formats, troubleshooting. Start here.
|
|
9
|
+
- **[How It Works Inside](docs/HOW_IT_WORKS.md)** — the design in plain language
|
|
10
|
+
(canonical form, query planning, content-addressed persistence) and future plans.
|
|
11
|
+
- `docs/SWARM_DESIGN.md`, `docs/SEMANTIC_CODES.md` — engineering design documents.
|
|
12
|
+
|
|
13
|
+
See also **[ontodag-fs](https://github.com/petfold/ontodag-fs)**: any OntoDAG
|
|
14
|
+
store can be browsed as a filesystem — paths are category queries, files are
|
|
15
|
+
classified objects stored on Swarm, FUSE-mountable (`odag-fs`, which shares
|
|
16
|
+
odag's store settings).
|
|
17
|
+
|
|
18
|
+
## Specification
|
|
19
|
+
|
|
20
|
+
A Directed Acyclic Graph (DAG) associative storage and category manager in Python. You can store items into a ontodag and recall items from it. To store or "put" an item into a ontodag, you give it a name and a set of other names of already existing items that are its supercategories. To recall or "get", you specify a set of item names to get all items that are subcategories of all these items.
|
|
21
|
+
|
|
22
|
+
## Roadmap
|
|
23
|
+
|
|
24
|
+
- [x] Implement the basic DAG data structure (put, remove)
|
|
25
|
+
- [x] Simplify definitions not to include unnecessary links (e.g. bird under animal, animal is not needed)
|
|
26
|
+
- During put keep a dictionary of 'done' nodes of the inserted item and all its super categories
|
|
27
|
+
- Insert a link only to nodes which are not 'done'
|
|
28
|
+
- Increment counter only for items which are not 'done'
|
|
29
|
+
- [x] Save/load data structure into/from file (try PKL)
|
|
30
|
+
- [x] Load ontology from file (e.g. OWL)
|
|
31
|
+
- [x] Visualize graph (with python library - Graphviz)
|
|
32
|
+
- [x] More extensive test cases
|
|
33
|
+
- [x] Select suitable ontology for importing (to serve as the basis of the DAG)
|
|
34
|
+
- [x] Sub-class of OntoDAG with counters (for statistics)
|
|
35
|
+
- [ ] Predicated (parametric) items. Dealing with items not stored in the graph (e.g. numbers, intervals, geo coordinates, areas; general, hierarchical types (types stored in the graph))
|
|
36
|
+
- [ ] Implement space and time calculation for graph items (e.g. century, GPS bounding box)
|
|
37
|
+
- categories for item types, e.g. point in time, time interval, geo coordinates, geo area, url
|
|
38
|
+
- way to handle non-stored numerical types (time intervals, geo coordinates, areas, numbers, arbitrary types)
|
|
39
|
+
- way to store and retrieve ordered values (photo with exact time in response to "last week")
|
|
40
|
+
- ways to define (partial) ordering function
|
|
41
|
+
- file types (hierarchical, e.g. image, png)
|
|
42
|
+
- [ ] Name usage across different instances of OntoDAG:
|
|
43
|
+
- namespaces
|
|
44
|
+
- avoiding confusing names (different language and usage, spelling)
|
|
45
|
+
- ability to merge DAGs with different name usage, using namespaces
|
|
46
|
+
- [ ] Optimize retrieval and storage by choosing subsets of query items and finding existing nodes already stored in the DAG.
|
|
47
|
+
- [ ] Add and remove intermediate nodes to optimize search in the graph
|
|
48
|
+
- [ ] Port implementation to Golang
|
|
49
|
+
- [ ] Implement a REST API for the Golang (or Rust) implementation
|
|
50
|
+
- [ ] Interface with a graph database implementation.
|
|
51
|
+
- [ ] Implement a web interface for the REST API & host it on a website with user profiles
|
|
52
|
+
- [ ] Implement a limited functionality (DAG-only) graph database for Ethereum Swarm
|
|
53
|
+
- [ ] Design a plugin for Ethereum Swarm to store the DAG in a decentralized way
|
|
54
|
+
|
|
55
|
+
## Potential Applications
|
|
56
|
+
* Using the ontology graph for content categorization instead of folders
|
|
57
|
+
* Replace content tags with a more structured ontology
|
|
58
|
+
* Access control (ACT) groups
|
|
59
|
+
* Memberships in organizations and gate content based on membership
|
|
60
|
+
* Communication channel groups defined by the ontology
|
|
61
|
+
* Fostering deals within a universal marketplace for services and goods
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ontodag"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Associative memory and categories based on a directed acyclic graph data structure"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
dependencies = [
|
|
12
|
+
"graphviz",
|
|
13
|
+
"owlready2",
|
|
14
|
+
"recordstore>=0.11",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
[project.optional-dependencies]
|
|
18
|
+
web = ["flask", "dot2tex", "Pillow"]
|
|
19
|
+
# The `swarm:NAME` CLI backend talks to a Bee node via recordstore's
|
|
20
|
+
# BeeBytesStore, which needs `requests` (recordstore's own [bee] extra).
|
|
21
|
+
swarm = ["requests"]
|
|
22
|
+
|
|
23
|
+
[project.scripts]
|
|
24
|
+
odag = "ontodag.__main__:main"
|
|
25
|
+
|
|
26
|
+
[tool.setuptools.packages.find]
|
|
27
|
+
where = ["src"]
|
ontodag-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from ontodag.dag import DAG, OntoDAG, Item, OntoDAGVisualizer
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def __getattr__(name):
|
|
5
|
+
# OWL support needs owlready2; import it only when actually used so the
|
|
6
|
+
# core data structure works without it.
|
|
7
|
+
if name == "OWLOntology":
|
|
8
|
+
from ontodag.owl import OWLOntology
|
|
9
|
+
|
|
10
|
+
return OWLOntology
|
|
11
|
+
# The Swarm adapter is optional persistence; keep plain `import ontodag`
|
|
12
|
+
# free of it (tests/test_boundaries.py, B1).
|
|
13
|
+
if name == "SwarmOntoDAG":
|
|
14
|
+
from ontodag.swarm_adapter import SwarmOntoDAG
|
|
15
|
+
|
|
16
|
+
return SwarmOntoDAG
|
|
17
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|