diff options
author | Matthias Baumgartner <dev@igsor.net> | 2023-01-13 10:16:37 +0100 |
---|---|---|
committer | Matthias Baumgartner <dev@igsor.net> | 2023-01-13 10:16:37 +0100 |
commit | b6a57a3a84bc4ea0b5db33e6c82b30944fad7e54 (patch) | |
tree | 287ca03d330c27d6127897bfe393164bbf361b17 | |
parent | 52fa64513dae60c3ed410622502f8c2369c1a348 (diff) | |
download | tagit-b6a57a3a84bc4ea0b5db33e6c82b30944fad7e54.tar.gz tagit-b6a57a3a84bc4ea0b5db33e6c82b30944fad7e54.tar.bz2 tagit-b6a57a3a84bc4ea0b5db33e6c82b30944fad7e54.zip |
load bsfs storage
-rw-r--r-- | tagit/apps/desktop.py | 24 | ||||
-rw-r--r-- | tagit/apps/port-config.yaml | 5 | ||||
-rw-r--r-- | tagit/apps/port-schema.nt | 62 | ||||
-rw-r--r-- | tagit/windows/__init__.py | 10 |
4 files changed, 98 insertions, 3 deletions
diff --git a/tagit/apps/desktop.py b/tagit/apps/desktop.py index 65501ad..f30b504 100644 --- a/tagit/apps/desktop.py +++ b/tagit/apps/desktop.py @@ -13,6 +13,8 @@ from kivy.app import App from kivy.uix.settings import SettingsWithSidebar # tagit imports +from tagit import config +from tagit.utils import bsfs from tagit.windows import desktop # exports @@ -38,11 +40,23 @@ class TagitApp(App): #from tagit.config.loader import load_settings, TAGITRC #cfg = load_settings(TAGITRC, 0) - from tagit.config import Settings - cfg = Settings.Open(os.path.join(os.path.dirname(__file__), 'port-config.yaml')) + cfg = config.Settings.Open(os.path.join(os.path.dirname(__file__), 'port-config.yaml')) + + # FIXME: mb/port/bsfs + # open BSFS storage + store = bsfs.Open(cfg('session', 'bsfs')) + # check storage schema + # FIXME: Move somewhere else?! + with open(os.path.join(os.path.dirname(__file__), 'port-schema.nt'), 'rt') as ifile: + required_schema = bsfs.schema.from_string(ifile.read()) + + # FIXME: Since the store isn't persistent, we migrate to the required one here. + #if not required_schema <= store.schema: + # raise Exception('') + store.migrate(required_schema) # create widget - return desktop.MainWindow(cfg, None, None) # FIXME: expects cfg, stor, log arguments + return desktop.MainWindow(cfg, store, None) # FIXME: expects cfg, stor, log arguments def on_start(self): # trigger startup operations @@ -55,6 +69,10 @@ def main(argv): app = TagitApp() app.run() +## config + +config.declare(('session', 'bsfs'), config.Any(), {}, + __name__, 'bsfs config', 'Configuration to connect to a BSFS storage.') ## main ## diff --git a/tagit/apps/port-config.yaml b/tagit/apps/port-config.yaml index d5c45e9..76fc580 100644 --- a/tagit/apps/port-config.yaml +++ b/tagit/apps/port-config.yaml @@ -2,6 +2,11 @@ session: first_start: false paths: searchlog: ~/.tagit.log + bsfs: # FIXME: rename to storage, but that space is currently polluted + Graph: + backend: + SparqlStore: {} + user: 'http://example.com/me' storage: index: preview_size: diff --git a/tagit/apps/port-schema.nt b/tagit/apps/port-schema.nt new file mode 100644 index 0000000..ec111d4 --- /dev/null +++ b/tagit/apps/port-schema.nt @@ -0,0 +1,62 @@ +# common external prefixes +prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> +prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> +prefix xsd: <http://www.w3.org/2001/XMLSchema#> +prefix schema: <http://schema.org/> + +# common bsfs prefixes +prefix bsfs: <http://bsfs.ai/schema/> +prefix bse: <http://bsfs.ai/schema/Entity#> +prefix bst: <http://bsfs.ai/schema/Tag#> + +# essential nodes +bsfs:Entity rdfs:subClassOf bsfs:Node . +bsfs:File rdfs:subClassOf bsfs:Entity . +bsfs:Tag rdfs:subClassOf bsfs:Node . +bsfs:Group rdfs:subClassOf bsfs:Node . + +# common definitions +bsfs:Number rdfs:subClassOf bsfs:Literal . +bsfs:Time rdfs:subClassOf bsfs:Literal . +xsd:string rdfs:subClassOf bsfs:Literal . +xsd:integer rdfs:subClassOf bsfs:Number . + +bse:filename rdfs:subClassOf bsfs:Predicate ; + rdfs:domain bsfs:File ; + rdfs:range xsd:string ; + rdfs:label "File name"^^xsd:string ; + schema:description "Filename of entity in some filesystem."^^xsd:string ; + bsfs:unique "false"^^xsd:boolean . + +bse:filesize rdfs:subClassOf bsfs:Predicate ; + rdfs:domain bsfs:File ; + rdfs:range xsd:integer ; + rdfs:label "File size"^^xsd:string ; + schema:description "File size of entity in some filesystem."^^xsd:string ; + bsfs:unique "false"^^xsd:boolean . + +bse:tag rdfs:subClassOf bsfs:Predicate ; + rdfs:domain bsfs:File ; + rdfs:range bsfs:Tag ; + bsfs:unique "false"^^xsd:boolean . + +bst:label rdfs:subClassOf bsfs:Predicate ; + rdfs:domain bsfs:Tag ; + rdfs:range xsd:string ; + bsfs:unique "true"^^xsd:boolean . + +bse:author rdfs:subClassOf bsfs:Predicate ; + rdfs:domain bsfs:Entity ; + rdfs:range xsd:string ; + bsfs:unique "true"^^xsd:boolean . + +bse:comment rdfs:subClassOf bsfs:Predicate ; + rdfs:domain bsfs:Node ; + rdfs:range xsd:string ; + bsfs:unique "false"^^xsd:boolean . + +bse:group rdfs:subClassOf bsfs:Predicate ; + rdfs:domain bsfs:Entity ; + rdfs:range bsfs:Group ; + bsfs:unique "false"^^xsd:boolean . + diff --git a/tagit/windows/__init__.py b/tagit/windows/__init__.py new file mode 100644 index 0000000..c3ec3c0 --- /dev/null +++ b/tagit/windows/__init__.py @@ -0,0 +1,10 @@ +""" + +Part of the tagit module. +A copy of the license is provided with the project. +Author: Matthias Baumgartner, 2022 +""" +# inner-module imports +from .desktop import MainWindow + +## EOF ## |