Skip to content

Commit

Permalink
Fixed issue with mysql predicates
Browse files Browse the repository at this point in the history
  • Loading branch information
eiglesias34 committed Nov 9, 2023
1 parent 32c47fe commit 5338776
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 38 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ You can easily customize your own configurations from the set of features that S

## Version
```
4.7.2.4
4.7.2.5
```

## RML-Test Cases
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.7.2.4
4.7.2.5
35 changes: 17 additions & 18 deletions rdfizer/rdfizer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3577,25 +3577,24 @@ def semantify_mysql(row, row_headers, triples_map, triples_map_list, output_file
i += 1

for predicate_object_map in triples_map.predicate_object_maps_list:
if predicate == None:
if predicate_object_map.predicate_map.mapping_type == "constant" or predicate_object_map.predicate_map.mapping_type == "constant shortcut":
predicate = "<" + predicate_object_map.predicate_map.value + ">"
elif predicate_object_map.predicate_map.mapping_type == "template":
if predicate_object_map.predicate_map.condition != "":
try:
predicate = "<" + string_substitution_array(predicate_object_map.predicate_map.value, "{(.+?)}", row, row_headers, "predicate",ignore) + ">"
except:
predicate = None
else:
try:
predicate = "<" + string_substitution_array(predicate_object_map.predicate_map.value, "{(.+?)}", row, row_headers, "predicate",ignore) + ">"
except:
predicate = None
elif predicate_object_map.predicate_map.mapping_type == "reference":
predicate = string_substitution_array(predicate_object_map.predicate_map.value, ".+", row, row_headers, "predicate",ignore)
predicate = "<" + predicate[1:-1] + ">"
if predicate_object_map.predicate_map.mapping_type == "constant" or predicate_object_map.predicate_map.mapping_type == "constant shortcut":
predicate = "<" + predicate_object_map.predicate_map.value + ">"
elif predicate_object_map.predicate_map.mapping_type == "template":
if predicate_object_map.predicate_map.condition != "":
try:
predicate = "<" + string_substitution_array(predicate_object_map.predicate_map.value, "{(.+?)}", row, row_headers, "predicate",ignore) + ">"
except:
predicate = None
else:
predicate = None
try:
predicate = "<" + string_substitution_array(predicate_object_map.predicate_map.value, "{(.+?)}", row, row_headers, "predicate",ignore) + ">"
except:
predicate = None
elif predicate_object_map.predicate_map.mapping_type == "reference":
predicate = string_substitution_array(predicate_object_map.predicate_map.value, ".+", row, row_headers, "predicate",ignore)
predicate = "<" + predicate[1:-1] + ">"
else:
predicate = None

if predicate_object_map.object_map.mapping_type == "constant" or predicate_object_map.object_map.mapping_type == "constant shortcut":
if "/" in predicate_object_map.object_map.value:
Expand Down
35 changes: 17 additions & 18 deletions rdfizer/rdfizer/semantify.py
Original file line number Diff line number Diff line change
Expand Up @@ -3577,25 +3577,24 @@ def semantify_mysql(row, row_headers, triples_map, triples_map_list, output_file
i += 1

for predicate_object_map in triples_map.predicate_object_maps_list:
if predicate == None:
if predicate_object_map.predicate_map.mapping_type == "constant" or predicate_object_map.predicate_map.mapping_type == "constant shortcut":
predicate = "<" + predicate_object_map.predicate_map.value + ">"
elif predicate_object_map.predicate_map.mapping_type == "template":
if predicate_object_map.predicate_map.condition != "":
try:
predicate = "<" + string_substitution_array(predicate_object_map.predicate_map.value, "{(.+?)}", row, row_headers, "predicate",ignore) + ">"
except:
predicate = None
else:
try:
predicate = "<" + string_substitution_array(predicate_object_map.predicate_map.value, "{(.+?)}", row, row_headers, "predicate",ignore) + ">"
except:
predicate = None
elif predicate_object_map.predicate_map.mapping_type == "reference":
predicate = string_substitution_array(predicate_object_map.predicate_map.value, ".+", row, row_headers, "predicate",ignore)
predicate = "<" + predicate[1:-1] + ">"
if predicate_object_map.predicate_map.mapping_type == "constant" or predicate_object_map.predicate_map.mapping_type == "constant shortcut":
predicate = "<" + predicate_object_map.predicate_map.value + ">"
elif predicate_object_map.predicate_map.mapping_type == "template":
if predicate_object_map.predicate_map.condition != "":
try:
predicate = "<" + string_substitution_array(predicate_object_map.predicate_map.value, "{(.+?)}", row, row_headers, "predicate",ignore) + ">"
except:
predicate = None
else:
predicate = None
try:
predicate = "<" + string_substitution_array(predicate_object_map.predicate_map.value, "{(.+?)}", row, row_headers, "predicate",ignore) + ">"
except:
predicate = None
elif predicate_object_map.predicate_map.mapping_type == "reference":
predicate = string_substitution_array(predicate_object_map.predicate_map.value, ".+", row, row_headers, "predicate",ignore)
predicate = "<" + predicate[1:-1] + ">"
else:
predicate = None

if predicate_object_map.object_map.mapping_type == "constant" or predicate_object_map.object_map.mapping_type == "constant shortcut":
if "/" in predicate_object_map.object_map.value:
Expand Down

0 comments on commit 5338776

Please sign in to comment.