Skip to content

Commit

Permalink
found a bug in the way sh:in lists are handeled: function was never c…
Browse files Browse the repository at this point in the history
…alled
  • Loading branch information
kronmar committed Jan 28, 2025
1 parent da0a441 commit 7c9d739
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,6 @@ cython_debug/
.idea/

.DS_Store

# Test cube for unit tests
/tests/test_cube.ttl
6 changes: 3 additions & 3 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
print(cube)

if not cube_exists(cube_uri=cube.get_iri(), environment="TEST"):
#upload_ttl(filename="./example/mock-cube.ttl", db_file="lindas.ini", environment="TEST")
pass
upload_ttl(filename="./example/mock-cube.ttl", db_file="lindas.ini", environment="TEST")

# upload_ttl(filename="./example/mock-cube.ttl", db_file="lindas.ini", environment="TEST")

modk_df_two_sided = pd.read_csv("tests/test_data.csv")
Expand All @@ -33,4 +33,4 @@
cube_two_sided.write_shape()

cube_two_sided.serialize("./example/mock-cube-two-sided.ttl")
#upload_ttl(filename="./example/mock-cube-two-sided.ttl", db_file="lindas.ini", environment="TEST")
upload_ttl(filename="./example/mock-cube-two-sided.ttl", db_file="lindas.ini", environment="TEST")
5 changes: 2 additions & 3 deletions pylindas/pycube/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,11 @@ def _write_dimension_shape(self, dim_dict: dict, values: pd.Series) -> BNode:
match dim_dict.get("scale-type"):
case "nominal":
self._graph.add((dim_node, QUDT.scaleType, QUDT.NominalScale))
if dim_dict.get("dimension-type") == "Measure Dimension":
if dim_dict.get("dimension-type") == "Key Dimension":
self._add_sh_list(dim_node, values)
case "ordinal":
self._graph.add((dim_node, QUDT.scaleType, QUDT.OrdinalScale))
if dim_dict.get("dimension-type") == "Measure Dimension":
if dim_dict.get("dimension-type") == "Key Dimension":
self._add_sh_list(dim_node, values)
case "interval":
self._graph.add((dim_node, QUDT.scaleType, QUDT.IntervalScale))
Expand Down Expand Up @@ -523,7 +523,6 @@ def _write_annotation(self, annotation_dict: dict) -> BNode:
case "additive":
value = dimension_dict.get("mapping").get("base") + str(value)
case "replace":
print(value)
value = dimension_dict.get("mapping").get("replacements").get(value)

context_node = BNode()
Expand Down
13 changes: 4 additions & 9 deletions tests/test_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def setup_method(self):
environment="TEST", local=True
)
self.cube.prepare_data().write_cube().write_observations().write_shape()
self.cube.serialize("tests/test_cube.ttl")

def test_standard_error(self):
sparql = (
Expand Down Expand Up @@ -151,25 +152,19 @@ def test_annotation_dimension(self):
assert bool(result)

def test_validate_basic_valid(self):
self.cube._graph = Graph().parse("./example/mock/cube.ttl")
result_bool, result_massage = self.cube._validate_base(serialize_results=True)
assert bool(result_bool)

def test_validate_basic_invalid(self):
self.cube._graph = Graph().parse("./tests/turtle/invalid_cube_cube.ttl")
result_bool, result_message = self.cube._validate_base()
assert bool(not result_bool)

def test_validate_visualize_valid(self):
self.cube._graph = Graph().parse("./example/mock/cube.ttl")
result_bool, result_message = self.cube._validate_visualize_profile()
result_bool, result_message = self.cube._validate_visualize_profile(serialize_results=True)
assert bool(result_bool)

def test_validate_opendata_valid(self):
self.cube._graph = Graph().parse("./example/mock/cube.ttl")
result_bool, result_message = self.cube._validate_opendata_profile()
assert bool(result_bool)

# todos: berücksichtige severity
# todos: berücksichtige timestamps - vorher removen, danach setzen

# Tests:
# basic: standalone-cube-constraint + standalone-constraint-constraint + integrity
Expand Down

0 comments on commit 7c9d739

Please sign in to comment.