Skip to content

Commit

Permalink
Fixed turtle print issue
Browse files Browse the repository at this point in the history
  • Loading branch information
eiglesias34 committed Sep 26, 2023
1 parent 7ae2e33 commit 32c47fe
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 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.3
4.7.2.4
```

## 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.3
4.7.2.4
4 changes: 3 additions & 1 deletion rdfizer/rdfizer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3077,10 +3077,12 @@ def semantify_file(triples_map, triples_map_list, delimiter, output_file_descrip
elif len(triples_map.predicate_object_maps_list) == 1:
if object == None and object_list == []:
output_file_descriptor.write(".\n")
end_turtle = "."
else:
output_file_descriptor.write(";\n")
elif len(triples_map.predicate_object_maps_list) == 0:
output_file_descriptor.write(".\n")
output_file_descriptor.write(".\n")
end_turtle = "."

if end_turtle == ";":
if predicate != None and object != None and subject != None:
Expand Down
12 changes: 10 additions & 2 deletions rdfizer/rdfizer/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,10 @@ def turtle_print(subject, predicate, object, object_list, duplicate_type, predic
if predicate_object_map == triples_map.predicate_object_maps_list[len(triples_map.predicate_object_maps_list)-1]:
if triples_map.subject_map.rdf_class == [None]:
if len(triples_map.predicate_object_maps_list) > 1:
output_file_descriptor.write(" " + predicate + " " + object)
if generated == 0:
output_file_descriptor.write(subject + " " + predicate + " " + object)
else:
output_file_descriptor.write(" " + predicate + " " + object)
else:
output_file_descriptor.write(subject + " " + predicate + " " + object)
if object == list(object_list.keys())[0] and len(object_list) == 1:
Expand Down Expand Up @@ -352,7 +355,12 @@ def turtle_print(subject, predicate, object, object_list, duplicate_type, predic
if predicate_object_map == triples_map.predicate_object_maps_list[len(triples_map.predicate_object_maps_list)-1]:
if triples_map.subject_map.rdf_class == [None]:
if len(triples_map.predicate_object_maps_list) > 1:
output_file_descriptor.write(" " + predicate + " " + object + ".\n\n")
if generated == 0:
output_file_descriptor.write(subject + " " + predicate + " " + object + ".\n\n")
return "."
else:
output_file_descriptor.write(" " + predicate + " " + object + ".\n\n")
return "."
else:
output_file_descriptor.write(subject + " " + predicate + " " + object + ".\n\n")
return "."
Expand Down
4 changes: 3 additions & 1 deletion rdfizer/rdfizer/semantify.py
Original file line number Diff line number Diff line change
Expand Up @@ -3077,10 +3077,12 @@ def semantify_file(triples_map, triples_map_list, delimiter, output_file_descrip
elif len(triples_map.predicate_object_maps_list) == 1:
if object == None and object_list == []:
output_file_descriptor.write(".\n")
end_turtle = "."
else:
output_file_descriptor.write(";\n")
elif len(triples_map.predicate_object_maps_list) == 0:
output_file_descriptor.write(".\n")
output_file_descriptor.write(".\n")
end_turtle = "."

if end_turtle == ";":
if predicate != None and object != None and subject != None:
Expand Down

0 comments on commit 32c47fe

Please sign in to comment.