Skip to content

Commit

Permalink
adapting tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dachafra committed Jun 7, 2024
1 parent bf3caa4 commit b48127f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
14 changes: 7 additions & 7 deletions test/projects/TEC/mapping.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
];
rr:subjectMap [
a rr:SubjectMap;
rr:template "ecfo_instance:CF_{id}";
rr:template "https://w3id.org/ecfkg/i/UK/BEIS/2016/CF_{id}";
];
rr:predicateObjectMap [
rr:predicateMap [
Expand Down Expand Up @@ -172,7 +172,7 @@
];
rr:objectMap [
a rr:ObjectMap;
rr:template "ecfo_instance:applicablePeriod/{valid_from}/{valid_to}";
rr:template "https://w3id.org/ecfkg/i/UK/BEIS/2016/applicablePeriod/{valid_from}/{valid_to}";
rr:termType rr:IRI
];
];
Expand Down Expand Up @@ -265,7 +265,7 @@
];
rr:subjectMap [
a rr:SubjectMap;
rr:template "ecfo_instance:applicablePeriod/{valid_from}/{valid_to}/start";
rr:template "https://w3id.org/ecfkg/i/UK/BEIS/2016/applicablePeriod/{valid_from}/{valid_to}/start";
];
rr:predicateObjectMap [
rr:predicateMap [
Expand Down Expand Up @@ -299,7 +299,7 @@
];
rr:subjectMap [
a rr:SubjectMap;
rr:template "ecfo_instance:applicablePeriod/{valid_from}/{valid_to}/end";
rr:template "https://w3id.org/ecfkg/i/UK/BEIS/2016/applicablePeriod/{valid_from}/{valid_to}/end";
];
rr:predicateObjectMap [
rr:predicateMap [
Expand Down Expand Up @@ -333,7 +333,7 @@
];
rr:subjectMap [
a rr:SubjectMap;
rr:template "ecfo_instance:applicablePeriod/{valid_from}/{valid_to}";
rr:template "https://w3id.org/ecfkg/i/UK/BEIS/2016/applicablePeriod/{valid_from}/{valid_to}";
];
rr:predicateObjectMap [
rr:predicateMap [
Expand All @@ -352,7 +352,7 @@
];
rr:objectMap [
a rr:ObjectMap;
rr:template "ecfo_instance:applicablePeriod/{valid_from}/{valid_to}/start";
rr:template "https://w3id.org/ecfkg/i/UK/BEIS/2016/applicablePeriod/{valid_from}/{valid_to}/start";
rr:termType rr:IRI
];
];
Expand All @@ -363,7 +363,7 @@
];
rr:objectMap [
a rr:ObjectMap;
rr:template "ecfo_instance:applicablePeriod/{valid_from}/{valid_to}/end";
rr:template "https://w3id.org/ecfkg/i/UK/BEIS/2016/applicablePeriod/{valid_from}/{valid_to}/end";
rr:termType rr:IRI
];
].
Expand Down
2 changes: 1 addition & 1 deletion test/r2rml/INVERSETC-0005/mapping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ mappings:
s: http://example.com/Patient/$(ID)
po:
- [rdf:type, foaf:Person]
- [http://example.com/$(last_name), $(LastName), xsd:string]
- [ex:$(last_name), $(LastName), xsd:string]
- [ex:height, http://example.com/$(Height)]
10 changes: 6 additions & 4 deletions test/r2rml/INVERSETC-0005/test_inversetc0005.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
__email__ = "[email protected]"
__name__ = "INVERSETC-0005 based on YARRRMLTC-0013"


import os
from ruamel.yaml import YAML
import yatter
from rdflib.graph import Graph
from deepdiff import DeepDiff

R2RML_URI = 'http://www.w3.org/ns/r2rml#'


Expand All @@ -21,12 +21,14 @@ def test_inversetc0005():
expected_mapping = yaml.load(file)

input_mapping = Graph()
mapping_path = input_mapping.parse(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'mapping.ttl'), format="ttl")
mapping_path = input_mapping.parse(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'mapping.ttl'),
format="ttl")
translated_mapping = yaml.load(str(yatter.inverse_translation(mapping_path, mapping_format=R2RML_URI)))

ddiff = DeepDiff(expected_mapping['mappings'], translated_mapping['mappings'], ignore_order=True)

print(expected_mapping['mappings'])
print(translated_mapping['mappings'])
if ddiff:
assert False
else:
assert True
assert True

0 comments on commit b48127f

Please sign in to comment.