aboutsummaryrefslogtreecommitdiffstats
path: root/bsie/apps
diff options
context:
space:
mode:
Diffstat (limited to 'bsie/apps')
-rw-r--r--bsie/apps/__init__.py2
-rw-r--r--bsie/apps/index.py25
-rw-r--r--bsie/apps/info.py25
3 files changed, 34 insertions, 18 deletions
diff --git a/bsie/apps/__init__.py b/bsie/apps/__init__.py
index a548c3c..1c3d0f9 100644
--- a/bsie/apps/__init__.py
+++ b/bsie/apps/__init__.py
@@ -4,7 +4,7 @@ Part of the bsie module.
A copy of the license is provided with the project.
Author: Matthias Baumgartner, 2022
"""
-# imports
+# standard imports
import typing
# inner-module imports
diff --git a/bsie/apps/index.py b/bsie/apps/index.py
index 1dbfdd8..21c2318 100644
--- a/bsie/apps/index.py
+++ b/bsie/apps/index.py
@@ -4,16 +4,16 @@ Part of the bsie module.
A copy of the license is provided with the project.
Author: Matthias Baumgartner, 2022
"""
-# imports
+# standard imports
import argparse
import os
import typing
# bsie imports
-from bsie.base import errors
-from bsie.lib import BSIE
-from bsie.tools import builder
-from bsie.utils import bsfs
+from bsie.extractor import ExtractorBuilder
+from bsie.lib import BSIE, PipelineBuilder
+from bsie.reader import ReaderBuilder
+from bsie.utils import bsfs, errors
# exports
__all__: typing.Sequence[str] = (
@@ -44,9 +44,9 @@ def main(argv):
# FIXME: Read reader/extractor configs from a config file
# reader builder
- rbuild = builder.ReaderBuilder({})
+ rbuild = ReaderBuilder()
# extractor builder
- ebuild = builder.ExtractorBuilder([
+ ebuild = ExtractorBuilder([
{'bsie.extractor.generic.path.Path': {}},
{'bsie.extractor.generic.stat.Stat': {}},
{'bsie.extractor.generic.constant.Constant': dict(
@@ -58,9 +58,14 @@ def main(argv):
bsfs:unique "true"^^xsd:boolean .
''',
)},
+ {'bsie.extractor.image.colors_spatial.ColorsSpatial': {
+ 'width': 2,
+ 'height': 2,
+ 'exp': 2,
+ }},
])
# pipeline builder
- pbuild = builder.PipelineBuilder(
+ pbuild = PipelineBuilder(
bsfs.Namespace(args.user + ('/' if not args.user.endswith('/') else '')),
rbuild,
ebuild,
@@ -82,7 +87,9 @@ def main(argv):
# index input paths
for path in args.input_file:
- if os.path.isdir(path) and args.recursive:
+ if not os.path.exists(path):
+ pass # FIXME: notify the user
+ elif os.path.isdir(path) and args.recursive:
for dirpath, _, filenames in os.walk(path, topdown=True, followlinks=args.follow):
for filename in filenames:
for node, pred, value in bsie.from_file(os.path.join(dirpath, filename)):
diff --git a/bsie/apps/info.py b/bsie/apps/info.py
index eaf1f71..64a4eba 100644
--- a/bsie/apps/info.py
+++ b/bsie/apps/info.py
@@ -4,15 +4,16 @@ Part of the bsie module.
A copy of the license is provided with the project.
Author: Matthias Baumgartner, 2022
"""
-# imports
+# standard imports
import argparse
import sys
import typing
# bsie imports
-from bsie.base import errors
-from bsie.tools import builder
-from bsie.utils import bsfs
+from bsie.extractor import ExtractorBuilder
+from bsie.lib import PipelineBuilder
+from bsie.reader import ReaderBuilder
+from bsie.utils import bsfs, errors
# exports
__all__: typing.Sequence[str] = (
@@ -25,15 +26,15 @@ __all__: typing.Sequence[str] = (
def main(argv):
"""Show information from BSIE."""
parser = argparse.ArgumentParser(description=main.__doc__, prog='info')
- parser.add_argument('what', choices=('predicates', ),
+ parser.add_argument('what', choices=('predicates', 'schema'),
help='Select what information to show.')
args = parser.parse_args(argv)
# FIXME: Read reader/extractor configs from a config file
# reader builder
- rbuild = builder.ReaderBuilder({})
+ rbuild = ReaderBuilder()
# extractor builder
- ebuild = builder.ExtractorBuilder([
+ ebuild = ExtractorBuilder([
{'bsie.extractor.generic.path.Path': {}},
{'bsie.extractor.generic.stat.Stat': {}},
{'bsie.extractor.generic.constant.Constant': dict(
@@ -45,9 +46,14 @@ def main(argv):
bsfs:unique "true"^^xsd:boolean .
''',
)},
+ {'bsie.extractor.image.colors_spatial.ColorsSpatial': {
+ 'width': 2,
+ 'height': 2,
+ 'exp': 2,
+ }},
])
# pipeline builder
- pbuild = builder.PipelineBuilder(
+ pbuild = PipelineBuilder(
bsfs.Namespace('http://example.com/me/'), # not actually used
rbuild,
ebuild,
@@ -61,6 +67,9 @@ def main(argv):
# show predicates
for pred in pipeline.schema.predicates():
print(pred.uri)
+ elif args.what == 'schema':
+ # show schema
+ print(bsfs.schema.to_string(pipeline.schema))
else:
# args.what is already checked by argparse
raise errors.UnreachableError()