Skip to content

Commit

Permalink
fixes issue with resourceinstancelist datatype causing big O n issue,…
Browse files Browse the repository at this point in the history
… re #11572
  • Loading branch information
apeters committed Oct 24, 2024
1 parent d0395e1 commit dea5332
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions arches/app/datatypes/concept_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,12 +489,17 @@ def get_rdf_uri(self, node, data, which="r"):

def to_rdf(self, edge_info, edge):
g = Graph()
c = ConceptDataType()
cdt = ConceptDataType()
if edge_info["range_tile_data"]:
for r in edge_info["range_tile_data"]:
c = ConceptValue(str(r))
concept_info = edge_info.copy()
concept_info["range_tile_data"] = r
g += c.to_rdf(concept_info, edge)
concept_info["r_uri"] = cdt.get_rdf_uri(None, r)
g.add((concept_info["r_uri"], RDF.type, URIRef(edge.rangenode.ontologyclass)))
g.add(
(concept_info["d_uri"], URIRef(edge.ontologyproperty), concept_info["r_uri"])
)
g.add((concept_info["r_uri"], URIRef(RDFS.label), Literal(c.value)))
return g

def from_rdf(self, json_ld_node):
Expand Down
4 changes: 2 additions & 2 deletions arches/app/utils/data_management/resources/formats/rdffile.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def add_edge_to_graph(graph, domainnode, rangenode, edge, tile, graph_info):
mpkg = pkg.copy()
for d in pkg["d_uri"]:
mpkg["d_uri"] = d
if type(pkg["r_uri"]) == list:
if type(pkg["r_uri"]) == list and not rng_dt.collects_multiple_values():
npkg = mpkg.copy()
for r in pkg["r_uri"]:
# compute matrix of n * m
Expand All @@ -229,7 +229,7 @@ def add_edge_to_graph(graph, domainnode, rangenode, edge, tile, graph_info):
else:
# iterate loop on m * 1
graph += rng_dt.to_rdf(mpkg, edge)
elif type(pkg["r_uri"]) == list:
elif type(pkg["r_uri"]) == list and not rng_dt.collects_multiple_values():
npkg = pkg.copy()
for r in pkg["r_uri"]:
# compute matrix of 1 * m
Expand Down

0 comments on commit dea5332

Please sign in to comment.