Skip to content
Snippets Groups Projects
Commit db4ac5a7 authored by Romin's avatar Romin :eye:
Browse files

Allow for more lenient unions

parent f8bd9373
No related branches found
No related tags found
No related merge requests found
...@@ -685,19 +685,17 @@ class QueryResult: ...@@ -685,19 +685,17 @@ class QueryResult:
def union(self, files: list[FileObject], attribute: property, column: str) -> list[FileObject]: def union(self, files: list[FileObject], attribute: property, column: str) -> list[FileObject]:
""" """
Computes the union between a list of files, a file (coscine.FileObject)
property and the property reflected in the SPARQL query result
identified via the column it appears in.
""" """
result = [] result = []
column_index = self.headers.index(column) column_index = self.headers.index(column)
for row in self.rows: for row in self.rows:
found = False
for f in files: for f in files:
if f.match(attribute, row[column_index]): if f.match(attribute, row[column_index]):
result.append(f) result.append(f)
found = True
break break
if not found:
print(f"Not found for {row[column_index]}")
assert len(result) == len(self.rows)
return result return result
def files(self, column: int) -> list[FileObject]: def files(self, column: int) -> list[FileObject]:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment