Skip to content

Commit 9cb1a7d

Browse files
committed
Adding parent and child map to join execution for RML-Views
1 parent ea3d850 commit 9cb1a7d

5 files changed

Lines changed: 347 additions & 49 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ You can easily customize your own configurations from the set of features that S
8484

8585
## Version
8686
```
87-
4.7.5.13.1
87+
4.7.5.13.2
8888
```
8989

9090
## RML-Test Cases

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.7.5.13.1
1+
4.7.5.13.2

rdfizer/rdfizer/__init__.py

Lines changed: 67 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,8 +1844,16 @@ def mapping_parser(mapping_file):
18441844
?_source rml:leftJoin ?left_join .
18451845
?left_join rml:parentLogicalView ?left_join_parent .
18461846
?left_join rml:joinCondition ?left_join_condition .
1847-
?left_join_condition rml:parent ?left_parent .
1848-
?left_join_condition rml:child ?left_child .
1847+
OPTIONAL{?left_join_condition rml:parent ?left_parent .}
1848+
OPTIONAL{?left_join_condition rml:parentMap ?left_parent_map .
1849+
OPTIONAL{?left_parent_map rml:reference ?left_parent_reference}
1850+
OPTIONAL{?left_parent_map rml:template ?left_parent_template}
1851+
OPTIONAL{?left_parent_map rml:constant ?left_parent_constant}}
1852+
OPTIONAL{?left_join_condition rml:child ?left_child .}
1853+
OPTIONAL{?left_join_condition rml:childMap ?left_child_map .
1854+
OPTIONAL{?left_child_map rml:reference ?left_child_reference}
1855+
OPTIONAL{?left_child_map rml:template ?left_child_template}
1856+
OPTIONAL{?left_child_map rml:constant ?left_child_constant}}
18491857
?left_join rml:field ?left_join_field .
18501858
?left_join_field rml:fieldName ?left_join_name .
18511859
?left_join_field rml:reference ?left_join_value .
@@ -1855,8 +1863,16 @@ def mapping_parser(mapping_file):
18551863
?_source rml:innerJoin ?inner_join .
18561864
?inner_join rml:parentLogicalView ?inner_join_parent .
18571865
?inner_join rml:joinCondition ?inner_join_condition .
1858-
?inner_join_condition rml:parent ?inner_parent .
1859-
?inner_join_condition rml:child ?inner_child .
1866+
OPTIONAL{?inner_join_condition rml:parent ?inner_parent .}
1867+
OPTIONAL{?inner_join_condition rml:parentMap ?inner_parent_map .
1868+
OPTIONAL{?inner_parent_map rml:reference ?inner_parent_reference}
1869+
OPTIONAL{?inner_parent_map rml:template ?inner_parent_template}
1870+
OPTIONAL{?inner_parent_map rml:constant ?inner_parent_constant}}
1871+
OPTIONAL{?inner_join_condition rml:child ?inner_child .}
1872+
OPTIONAL{?inner_join_condition rml:childMap ?inner_child_map .
1873+
OPTIONAL{?inner_child_map rml:reference ?inner_child_reference}
1874+
OPTIONAL{?inner_child_map rml:template ?inner_child_template}
1875+
OPTIONAL{?inner_child_map rml:constant ?inner_child_constant}}
18601876
?inner_join rml:field ?inner_join_field .
18611877
?inner_join_field rml:fieldName ?inner_join_name .
18621878
?inner_join_field rml:reference ?inner_join_value .
@@ -2636,21 +2652,64 @@ def mapping_parser(mapping_file):
26362652
attr_row["type"] = "inner_join"
26372653
attr_row["value"] = str(attr_view.inner_join_value)
26382654
attr_row["parent_view"] = str(attr_view.inner_join_parent)
2639-
attr_row["parent_condition"] = str(attr_view.inner_parent)
2640-
attr_row["child_condition"] = str(attr_view.inner_child)
2655+
2656+
if str(attr_view.inner_parent_reference) != "None":
2657+
attr_row["parent_condition"] = str(attr_view.inner_parent_reference)
2658+
elif str(attr_view.inner_parent_template) != "None":
2659+
attr_row["parent_condition"] = {"value":str(attr_view.inner_parent_template), "type":"template"}
2660+
elif str(attr_view.inner_parent_constant) != "None":
2661+
attr_row["parent_condition"] = {"value":str(attr_view.inner_parent_constant), "type":"constant"}
2662+
else:
2663+
attr_row["parent_condition"] = str(attr_view.inner_parent)
2664+
2665+
if str(attr_view.inner_child_reference) != "None":
2666+
attr_row["child_condition"] = str(attr_view.inner_child_reference)
2667+
elif str(attr_view.inner_child_template) != "None":
2668+
attr_row["child_condition"] = {"value":str(attr_view.inner_child_template), "type":"template"}
2669+
elif str(attr_view.inner_child_constant) != "None":
2670+
attr_row["child_condition"] = {"value":str(attr_view.inner_child_constant), "type":"constant"}
2671+
else:
2672+
attr_row["child_condition"] = str(attr_view.inner_child)
2673+
26412674
attr_row["name"] = str(attr_view.inner_join_name)
26422675
elif attr_view.left_join is not None:
26432676
attr_row["type"] = "left_join"
26442677
attr_row["value"] = str(attr_view.left_join_value)
26452678
attr_row["parent_view"] = str(attr_view.left_join_parent)
2646-
attr_row["parent_condition"] = str(attr_view.left_parent)
2647-
attr_row["child_condition"] = str(attr_view.left_child)
2679+
2680+
if str(attr_view.left_parent_reference) != "None":
2681+
attr_row["parent_condition"] = str(attr_view.left_parent_reference)
2682+
elif str(attr_view.left_parent_template) != "None":
2683+
attr_row["parent_condition"] = {"value":str(attr_view.left_parent_template), "type":"template"}
2684+
elif str(attr_view.left_parent_constant) != "None":
2685+
attr_row["parent_condition"] = {"value":str(attr_view.left_parent_constant), "type":"constant"}
2686+
else:
2687+
attr_row["parent_condition"] = str(attr_view.left_parent)
2688+
2689+
if str(attr_view.left_child_reference) != "None":
2690+
attr_row["child_condition"] = str(attr_view.left_child_reference)
2691+
elif str(attr_view.left_child_template) != "None":
2692+
attr_row["child_condition"] = {"value":str(attr_view.left_child_template), "type":"template"}
2693+
elif str(attr_view.left_child_constant) != "None":
2694+
attr_row["child_condition"] = {"value":str(attr_view.left_child_constant), "type":"constant"}
2695+
else:
2696+
attr_row["child_condition"] = str(attr_view.left_child)
2697+
26482698
attr_row["name"] = str(attr_view.left_join_name)
26492699

26502700
if attr_row != {}:
26512701
if attr_row["name"] not in seen_view:
26522702
attr_list.append(attr_row)
26532703
seen_view.append(attr_row["name"])
2704+
else:
2705+
for attr in attr_list:
2706+
if attr_row["name"] == attr["name"]:
2707+
if isinstance(attr["parent_condition"],list):
2708+
attr["parent_condition"].append(attr_row["parent_condition"])
2709+
attr["child_condition"].append(attr_row["child_condition"])
2710+
else:
2711+
attr["parent_condition"] = [attr["parent_condition"],attr_row["parent_condition"]]
2712+
attr["child_condition"] = [attr["child_condition"],attr_row["child_condition"]]
26542713

26552714
if result_triples_map.data_view is not None:
26562715
if result_triples_map.ref_form is None:

0 commit comments

Comments
 (0)