aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Baumgartner <dev@igsor.net>2023-01-16 20:55:13 +0100
committerMatthias Baumgartner <dev@igsor.net>2023-01-16 20:55:13 +0100
commit02bbad817077e9a23f7b24b82845fcde24de63a9 (patch)
tree1a4e76d1eb0a297098e1c37fb5b7ee6e8c494286
parentbffe6bb52d00e60665b4e8e2144ab91e4465173e (diff)
downloadbsie-02bbad817077e9a23f7b24b82845fcde24de63a9.tar.gz
bsie-02bbad817077e9a23f7b24b82845fcde24de63a9.tar.bz2
bsie-02bbad817077e9a23f7b24b82845fcde24de63a9.zip
image feature integration test
-rw-r--r--bsie/apps/index.py10
-rw-r--r--test/apps/test_index.py14
-rw-r--r--test/apps/testdir/testimage.jpgbin0 -> 349264 bytes
3 files changed, 23 insertions, 1 deletions
diff --git a/bsie/apps/index.py b/bsie/apps/index.py
index 7cf94d3..25e006f 100644
--- a/bsie/apps/index.py
+++ b/bsie/apps/index.py
@@ -44,7 +44,10 @@ def main(argv):
# FIXME: Read reader/extractor configs from a config file
# reader builder
- rbuild = ReaderBuilder({})
+ rbuild = ReaderBuilder({
+ 'bsie.reader.image.Image': {
+ 'cfg': {}}, # FIXME: cfg should be optional!
+ })
# extractor builder
ebuild = ExtractorBuilder([
{'bsie.extractor.generic.path.Path': {}},
@@ -58,6 +61,11 @@ def main(argv):
bsfs:unique "true"^^xsd:boolean .
''',
)},
+ {'bsie.extractor.image.colors_spatial.ColorsSpatial': {
+ 'width': 2,
+ 'height': 2,
+ 'exp': 2,
+ }},
])
# pipeline builder
pbuild = PipelineBuilder(
diff --git a/test/apps/test_index.py b/test/apps/test_index.py
index 6fc3335..c3960b8 100644
--- a/test/apps/test_index.py
+++ b/test/apps/test_index.py
@@ -77,6 +77,14 @@ class TestIndex(unittest.TestCase):
(rdflib.URIRef(prefix + 'd803187cbf3676ae9d38126270a6152c60431589aa3bb3824baf8954e9c097f1'), rdflib.URIRef(ns.bse.author), rdflib.Literal('Me, myself, and I', datatype=rdflib.XSD.string)),
(rdflib.URIRef(prefix + 'd803187cbf3676ae9d38126270a6152c60431589aa3bb3824baf8954e9c097f1'), rdflib.URIRef(ns.bse.filename), rdflib.Literal('td_second', datatype=rdflib.XSD.string)),
(rdflib.URIRef(prefix + 'd803187cbf3676ae9d38126270a6152c60431589aa3bb3824baf8954e9c097f1'), rdflib.URIRef(ns.bse.filesize), rdflib.Literal('703', datatype=rdflib.XSD.integer)),
+ (rdflib.URIRef(prefix + 'accb115d266ad60c53cd01a7f7130f245886ce8eaf69bc85319febc11d9fe089'), rdflib.RDF.type, rdflib.URIRef(ns.bsfs.File)),
+ (rdflib.URIRef(prefix + 'accb115d266ad60c53cd01a7f7130f245886ce8eaf69bc85319febc11d9fe089'), rdflib.URIRef(ns.bse.author), rdflib.Literal('Me, myself, and I', datatype=rdflib.XSD.string)),
+ (rdflib.URIRef(prefix + 'accb115d266ad60c53cd01a7f7130f245886ce8eaf69bc85319febc11d9fe089'), rdflib.URIRef(ns.bse.filename), rdflib.Literal('testimage.jpg', datatype=rdflib.XSD.string)),
+ (rdflib.URIRef(prefix + 'accb115d266ad60c53cd01a7f7130f245886ce8eaf69bc85319febc11d9fe089'), rdflib.URIRef(ns.bse.filesize), rdflib.Literal('349264', datatype=rdflib.XSD.integer)),
+ (rdflib.URIRef(prefix + 'accb115d266ad60c53cd01a7f7130f245886ce8eaf69bc85319febc11d9fe089'), rdflib.URIRef('http://bsfs.ai/schema/Entity/colors_spatial#0658f2234a054e1dd59a14462c89f7733e019160419c796356aa831498bd0a04'),
+ rdflib.Literal(
+ '(91, 127, 121, 94, 138, 167, 163, 134, 190, 138, 170, 156, 121, 142, 159)',
+ datatype=rdflib.URIRef('http://ie.bsfs.ai/schema/Feature/ColorsSpatial#0658f2234a054e1dd59a14462c89f7733e019160419c796356aa831498bd0a04'))),
}))
# NOTE: we don't check ns.bsm.t_created since it depends on the execution time. Triples would look like this:
@@ -91,6 +99,7 @@ class TestIndex(unittest.TestCase):
# (rdflib.URIRef(prefix + 'b8fd7fba818254166a6043195004138ebda6923e012442f819a2c49671136c70'), rdflib.URIRef(ns.bsm.t_created), rdflib.Literal('1670..........', datatype=rdflib.XSD.integer)),
# (rdflib.URIRef(prefix + 'd43758ace82154a1cc10ca0dfef63cb20dd831f9c87edd6dc06539eefe67371d'), rdflib.URIRef(ns.bsm.t_created), rdflib.Literal('1670..........', datatype=rdflib.XSD.integer)),
# (rdflib.URIRef(prefix + 'd803187cbf3676ae9d38126270a6152c60431589aa3bb3824baf8954e9c097f1'), rdflib.URIRef(ns.bsm.t_created), rdflib.Literal('1670..........', datatype=rdflib.XSD.integer)),
+ # (rdflib.URIRef(prefix + 'accb115d266ad60c53cd01a7f7130f245886ce8eaf69bc85319febc11d9fe089'), rdflib.URIRef(ns.bsm.t_created), rdflib.Literal('1670..........', datatype=rdflib.XSD.integer)),
# instead, we simply check if there's such a predicate for each file
self.assertSetEqual({sub for sub, _ in bsfs._backend._graph.subject_objects(rdflib.URIRef(ns.bsm.t_created))}, {
rdflib.URIRef(prefix + '2f4109b40107cc50e0884755a1a961ed126887e49b8dbaf0e146b2e226aa6647'),
@@ -104,6 +113,7 @@ class TestIndex(unittest.TestCase):
rdflib.URIRef(prefix + 'b8fd7fba818254166a6043195004138ebda6923e012442f819a2c49671136c70'),
rdflib.URIRef(prefix + 'd43758ace82154a1cc10ca0dfef63cb20dd831f9c87edd6dc06539eefe67371d'),
rdflib.URIRef(prefix + 'd803187cbf3676ae9d38126270a6152c60431589aa3bb3824baf8954e9c097f1'),
+ rdflib.URIRef(prefix + 'accb115d266ad60c53cd01a7f7130f245886ce8eaf69bc85319febc11d9fe089'),
})
def test_print(self):
@@ -150,6 +160,10 @@ class TestIndex(unittest.TestCase):
f'Node(http://bsfs.ai/schema/File, http://example.com/me/file#d803187cbf3676ae9d38126270a6152c60431589aa3bb3824baf8954e9c097f1) Predicate({ns.bse.author}) Me, myself, and I',
f'Node(http://bsfs.ai/schema/File, http://example.com/me/file#d803187cbf3676ae9d38126270a6152c60431589aa3bb3824baf8954e9c097f1) Predicate({ns.bse.filename}) td_second',
f'Node(http://bsfs.ai/schema/File, http://example.com/me/file#d803187cbf3676ae9d38126270a6152c60431589aa3bb3824baf8954e9c097f1) Predicate({ns.bse.filesize}) 703',
+ f'Node(http://bsfs.ai/schema/File, http://example.com/me/file#accb115d266ad60c53cd01a7f7130f245886ce8eaf69bc85319febc11d9fe089) Predicate({ns.bse.filesize}) 349264',
+ f'Node(http://bsfs.ai/schema/File, http://example.com/me/file#accb115d266ad60c53cd01a7f7130f245886ce8eaf69bc85319febc11d9fe089) Predicate({ns.bse.author}) Me, myself, and I',
+ f'Node(http://bsfs.ai/schema/File, http://example.com/me/file#accb115d266ad60c53cd01a7f7130f245886ce8eaf69bc85319febc11d9fe089) Predicate({ns.bse.filename}) testimage.jpg',
+ f'Node(http://bsfs.ai/schema/File, http://example.com/me/file#accb115d266ad60c53cd01a7f7130f245886ce8eaf69bc85319febc11d9fe089) Predicate(http://bsfs.ai/schema/Entity/colors_spatial#0658f2234a054e1dd59a14462c89f7733e019160419c796356aa831498bd0a04) (91, 127, 121, 94, 138, 167, 163, 134, 190, 138, 170, 156, 121, 142, 159)',
})
diff --git a/test/apps/testdir/testimage.jpg b/test/apps/testdir/testimage.jpg
new file mode 100644
index 0000000..c80bb48
--- /dev/null
+++ b/test/apps/testdir/testimage.jpg
Binary files differ