aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tagit/apps/desktop.py41
-rw-r--r--tagit/apps/port-config.yaml67
-rw-r--r--tagit/apps/port-schema.nt10
-rw-r--r--tagit/utils/bsfs.py5
4 files changed, 89 insertions, 34 deletions
diff --git a/tagit/apps/desktop.py b/tagit/apps/desktop.py
index f30b504..1412da9 100644
--- a/tagit/apps/desktop.py
+++ b/tagit/apps/desktop.py
@@ -14,7 +14,8 @@ from kivy.uix.settings import SettingsWithSidebar
# tagit imports
from tagit import config
-from tagit.utils import bsfs
+from tagit.utils import bsfs, ns
+from tagit.utils.bsfs import URI
from tagit.windows import desktop
# exports
@@ -49,12 +50,48 @@ class TagitApp(App):
# 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)
+ # FIXME: debug: add some data to the storage
+ t_hello = store.node(ns.bsfs.Tag, URI('http://example.com/me/tag#hello')).set(ns.bst.label, 'hello')
+ t_world = store.node(ns.bsfs.Tag, URI('http://example.com/me/tag#world')).set(ns.bst.label, 'world')
+ t_foobar = store.node(ns.bsfs.Tag, URI('http://example.com/me/tag#foobar')).set(ns.bst.label, 'foobar')
+ grp = store.node(ns.bsfs.Group, URI('http://example.com/me/group#1234'))
+
+ n0 = store.node(ns.bsfs.File, URI('http://example.com/me/entity#01')) \
+ .set(ns.bse.filename, 'textfile.t') \
+ .set(ns.bse.filesize, 100) \
+ .set(ns.bse.tag, t_hello) \
+ .set(ns.bse.tag, t_foobar) \
+ .set(ns.bse.group, grp)
+ n1 = store.node(ns.bsfs.File, URI('http://example.com/me/entity#02')) \
+ .set(ns.bse.filename, 'document.pdf') \
+ .set(ns.bse.filesize, 200) \
+ .set(ns.bse.author, 'me') \
+ .set(ns.bse.tag, t_world) \
+ .set(ns.bse.tag, t_foobar) \
+ .set(ns.bse.group, grp)
+ n2 = store.node(ns.bsfs.File, URI('http://example.com/me/entity#03')) \
+ .set(ns.bse.filename, 'document.odt') \
+ .set(ns.bse.filesize, 300) \
+ .set(ns.bse.author, 'you') \
+ .set(ns.bse.tag, t_world)
+ n3 = store.node(ns.bsfs.File, URI('http://example.com/me/entity#04')) \
+ .set(ns.bse.filename, 'image.jpg') \
+ .set(ns.bse.comment, 'some image') \
+ .set(ns.bse.tag, t_hello) \
+ .set(ns.bse.tag, t_foobar) \
+ .set(ns.bse.group, grp)
+ n4 = store.node(ns.bsfs.File, URI('http://example.com/me/entity#05')) \
+ .set(ns.bse.filename, 'image.png') \
+ .set(ns.bse.comment, 'another image') \
+ .set(ns.bse.tag, t_hello)
+
+ grp.set(ns.bsg.represented_by, n0)
+
# create widget
return desktop.MainWindow(cfg, store, None) # FIXME: expects cfg, stor, log arguments
diff --git a/tagit/apps/port-config.yaml b/tagit/apps/port-config.yaml
index d5bad35..35f524a 100644
--- a/tagit/apps/port-config.yaml
+++ b/tagit/apps/port-config.yaml
@@ -2,7 +2,7 @@ session:
first_start: false
paths:
searchlog: ~/.tagit.log
- bsfs: # FIXME: rename to storage, but that space is currently polluted
+ bsfs: # FIXME: mb/port: rename to storage, but that space is currently polluted
Graph:
backend:
SparqlStore: {}
@@ -18,7 +18,26 @@ storage:
- 400
ui:
standalone:
- #plane: browsing
+ plane: browsing
+ keytriggers:
+ - MoveCursorUp
+ - MoveCursorDown
+ - MoveCursorLeft
+ - MoveCursorRight
+ - MoveCursorLast
+ - MoveCursorFirst
+ - NextPage
+ - PreviousPage
+ - ScrollDown
+ - ScrollUp
+ - ZoomIn
+ - ZoomOut
+ - Select
+ - SelectAll
+ - SelectNone
+ - SelectMulti
+ - SelectRange
+ - ShowHelp
browser:
maxcols: 8
maxrows: 8
@@ -31,14 +50,15 @@ ui:
- AddToken
#- CreateGroup
#- DissolveGroup
- #- SelectAll
- #- SelectNone
- #- SelectInvert
- #- SelectAdditive
- #- SelectSubtractive
- #- SelectSingle
- #- SelectMulti
- #- SelectRange
+ - SelectAll
+ - SelectNone
+ - SelectInvert
+ - SelectAdditive
+ - SelectSubtractive
+ - SelectSingle
+ - SelectMulti
+ - SelectRange
+ - ShellDrop
filter:
- AddToken
- EditToken
@@ -48,9 +68,9 @@ ui:
- ShowHelp
- ShowConsole
- ShowBrowsing
- # browser:
- # - ZoomIn
- # - ZoomOut
+ browser:
+ - ZoomIn
+ - ZoomOut
# clipboard:
# - ClipboardCopy
# - ClipboardPaste
@@ -65,18 +85,15 @@ ui:
# search:
# - ShowSelected
# - RemoveSelected
- # select:
- # - SelectAll
- # - SelectNone
- # - SelectInvert
- # - SelectSingle
- # - SelectMulti
- # - SelectRange
- # - SelectAdditive
- # - SelectSubtractive
- # session:
- # - ItemExport
- # - ImportObjects
+ select:
+ - SelectAll
+ - SelectNone
+ - SelectInvert
+ - SelectSingle
+ - SelectMulti
+ - SelectRange
+ - SelectAdditive
+ - SelectSubtractive
# tagging:
# - AddTag
# - EditTag
diff --git a/tagit/apps/port-schema.nt b/tagit/apps/port-schema.nt
index c3bf237..b18a6ad 100644
--- a/tagit/apps/port-schema.nt
+++ b/tagit/apps/port-schema.nt
@@ -27,14 +27,14 @@ bse:filename rdfs:subClassOf bsfs:Predicate ;
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 .
+ bsfs:unique "true"^^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 .
+ bsfs:unique "true"^^xsd:boolean .
bse:mime rdfs:subClassOf bsfs:Predicate ;
rdfs:domain bsfs:File ;
@@ -48,8 +48,7 @@ bse:orientation rdfs:subClassOf bsfs:Predicate ; # FIXME: shouldn't this be part
bse:tag rdfs:subClassOf bsfs:Predicate ;
rdfs:domain bsfs:File ;
- rdfs:range bsfs:Tag ;
- bsfs:unique "false"^^xsd:boolean .
+ rdfs:range bsfs:Tag .
bst:label rdfs:subClassOf bsfs:Predicate ;
rdfs:domain bsfs:Tag ;
@@ -63,8 +62,7 @@ bse:author rdfs:subClassOf bsfs:Predicate ;
bse:comment rdfs:subClassOf bsfs:Predicate ;
rdfs:domain bsfs:Node ;
- rdfs:range xsd:string ;
- bsfs:unique "false"^^xsd:boolean .
+ rdfs:range xsd:string .
bse:group rdfs:subClassOf bsfs:Predicate ;
rdfs:domain bsfs:Entity ;
diff --git a/tagit/utils/bsfs.py b/tagit/utils/bsfs.py
index d80efe0..3c2b826 100644
--- a/tagit/utils/bsfs.py
+++ b/tagit/utils/bsfs.py
@@ -9,15 +9,18 @@ import typing
# bsfs imports
from bsfs import schema, Open
-from bsfs.query import ast
from bsfs.namespace import Namespace
+from bsfs.query import ast
+from bsfs.utils import URI, uuid
# exports
__all__: typing.Sequence[str] = (
'Namespace',
'Open',
+ 'URI',
'ast',
'schema',
+ 'uuid'
)
## EOF ##