aboutsummaryrefslogtreecommitdiffstats
path: root/test/extractor/generic/test_constant.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/extractor/generic/test_constant.py')
-rw-r--r--test/extractor/generic/test_constant.py29
1 files changed, 12 insertions, 17 deletions
diff --git a/test/extractor/generic/test_constant.py b/test/extractor/generic/test_constant.py
index 9dbaced..77ee02b 100644
--- a/test/extractor/generic/test_constant.py
+++ b/test/extractor/generic/test_constant.py
@@ -1,10 +1,5 @@
-"""
-Part of the bsie test suite.
-A copy of the license is provided with the project.
-Author: Matthias Baumgartner, 2022
-"""
-# imports
+# standard imports
import unittest
# bsie imports
@@ -20,11 +15,11 @@ class TestConstant(unittest.TestCase):
def test_extract(self):
schema = '''
bse:author rdfs:subClassOf bsfs:Predicate ;
- rdfs:domain bsfs:Entity ;
+ rdfs:domain bsn:Entity ;
rdfs:range xsd:string ;
bsfs:unique "true"^^xsd:boolean .
bse:comment rdfs:subClassOf bsfs:Predicate ;
- rdfs:domain bsfs:Entity ;
+ rdfs:domain bsn:Entity ;
rdfs:range xsd:string ;
bsfs:unique "false"^^xsd:boolean .
'''
@@ -33,33 +28,33 @@ class TestConstant(unittest.TestCase):
(ns.bse.comment, 'the quick brown fox jumps over the lazy dog.'),
]
ext = Constant(schema, tuples)
- node = _node.Node(ns.bsfs.Entity, '') # Blank node
+ node = _node.Node(ns.bsn.Entity, '') # Blank node
p_author = ext.schema.predicate(ns.bse.author)
p_comment = ext.schema.predicate(ns.bse.comment)
- entity = ext.schema.node(ns.bsfs.Node).get_child(ns.bsfs.Entity)
- string = ext.schema.literal(ns.bsfs.Literal).get_child(ns.xsd.string)
+ entity = ext.schema.node(ns.bsfs.Node).child(ns.bsn.Entity)
+ string = ext.schema.literal(ns.bsfs.Literal).child(ns.xsd.string)
# baseline
self.assertSetEqual(set(ext.extract(node, None, (p_author, p_comment))),
{(node, p_author, 'Me, myself, and I'),
(node, p_comment, 'the quick brown fox jumps over the lazy dog.')})
# predicates is respected
- p_foobar = ext.schema.predicate(ns.bsfs.Predicate).get_child(ns.bse.foobar, domain=entity, range=entity)
+ p_foobar = ext.schema.predicate(ns.bsfs.Predicate).child(ns.bse.foobar, domain=entity, range=entity)
self.assertSetEqual(set(ext.extract(node, None, (p_author, p_foobar))),
{(node, p_author, 'Me, myself, and I')})
self.assertSetEqual(set(ext.extract(node, None, (p_comment, p_foobar))),
{(node, p_comment, 'the quick brown fox jumps over the lazy dog.')})
- p_barfoo = ext.schema.predicate(ns.bse.author).get_child(ns.bse.comment, domain=entity, range=string)
+ p_barfoo = ext.schema.predicate(ns.bse.author).child(ns.bse.comment, domain=entity, range=string)
self.assertSetEqual(set(ext.extract(node, None, (p_foobar, p_barfoo))), set())
def test_construct(self):
# schema compliance
schema = '''
bse:author rdfs:subClassOf bsfs:Predicate ;
- rdfs:domain bsfs:Entity ;
+ rdfs:domain bsn:Entity ;
rdfs:range xsd:string ;
bsfs:unique "true"^^xsd:boolean .
bse:comment rdfs:subClassOf bsfs:Predicate ;
- rdfs:domain bsfs:Entity ;
+ rdfs:domain bsn:Entity ;
rdfs:range xsd:string ;
bsfs:unique "false"^^xsd:boolean .
'''
@@ -80,13 +75,13 @@ class TestConstant(unittest.TestCase):
def test_eq(self):
schema_a = '''
bse:author rdfs:subClassOf bsfs:Predicate ;
- rdfs:domain bsfs:Entity ;
+ rdfs:domain bsn:Entity ;
rdfs:range xsd:string ;
bsfs:unique "true"^^xsd:boolean .
'''
schema_b = '''
bse:comment rdfs:subClassOf bsfs:Predicate ;
- rdfs:domain bsfs:Entity ;
+ rdfs:domain bsn:Entity ;
rdfs:range xsd:string ;
bsfs:unique "false"^^xsd:boolean .
'''