Skip to content

Commit 88d8822

Browse files
Merge pull request #2 from casework/import_compactpy_fixes
Import compact.py fixes
2 parents c69d0fc + fbc542f commit 88d8822

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

tests/case_file/kb.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
55
"uco-core": "https://unifiedcyberontology.org/ontology/uco/core#",
66
"uco-observable": "https://unifiedcyberontology.org/ontology/uco/observable#",
7-
"uco-types": "https://unifiedcyberontology.org/ontology/uco/types#"
7+
"uco-types": "https://unifiedcyberontology.org/ontology/uco/types#",
8+
"xsd": "http://www.w3.org/2001/XMLSchema#"
89
},
910
"@graph": [
1011
{

tests/src/compact.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ def _accrue_local_context(doc_object):
6464
_logger.debug("total_context = %r." % total_context)
6565

6666
compacted = pyld.jsonld.compact(doc, total_context)
67+
68+
# Add xsd prefix back in to context dictionary. .compact() removes it, and this causes some xsd definitions like xsd:long to no longer resolve in SPARQL queries.
69+
compacted["@context"]["xsd"] = "http://www.w3.org/2001/XMLSchema#"
70+
6771
out_fh.write(json.dumps(compacted, indent=4))
6872

6973
if __name__ == "__main__":

0 commit comments

Comments
 (0)