Skip to content

Commit 67e33df

Browse files
committed
patches on shared.py
1 parent c571c73 commit 67e33df

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/shared.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,16 @@ def replace_uri_in_graph(graph, old_uri_str, new_uri_str):
9797
return g
9898

9999

100+
def _uses_https_schema(graph: rdflib.Graph) -> bool:
101+
for s, p, o in graph.triples((None, None, None)):
102+
for term in (s, p, o):
103+
if isinstance(term, rdflib.URIRef) and str(term).startswith(
104+
"https://schema.org/"
105+
):
106+
return True
107+
return False
108+
109+
100110
def do_entity_test(
101111
rocrate_path: Union[Path, str],
102112
requirement_severity: models.Severity,
@@ -152,6 +162,12 @@ def do_entity_test(
152162
if rocrate_entity_mod_sparql is not None:
153163
rocrate_graph = load_graph_and_preserve_relative_ids(rocrate)
154164

165+
if _uses_https_schema(rocrate_graph):
166+
rocrate_entity_mod_sparql = rocrate_entity_mod_sparql.replace(
167+
"http://schema.org/",
168+
"https://schema.org/",
169+
)
170+
155171
rocrate_graph.update(rocrate_entity_mod_sparql)
156172

157173
# save the updated RO-Crate metadata

0 commit comments

Comments
 (0)