forked from ucoProject/UCO
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding initial testing for issue ucoProject#423
- Loading branch information
1 parent
a278da6
commit b2742c1
Showing
2 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
{ | ||
"@graph": [ | ||
{ | ||
"@id": "kb:action-1", | ||
"@type": "action:Action", | ||
"rdfs:comment": "This node is some action that has some ObservableObjects as results. By the ontology, the results need to be some UcoObject or subclass of UcoObject. They are serialized here as ObservableObjects, and are redundantly assigned types of some of their superclasses. For completeness-tracking, let the id slug's number be a binary number tracking which superclasses are present, 2^0=core:UcoObject, 2^1=core:Item, 2^2=observable:Observable.", | ||
"action:result": [ | ||
{ | ||
"@id": "kb:node-0" | ||
}, | ||
{ | ||
"@id": "kb:node-1" | ||
}, | ||
{ | ||
"@id": "kb:node-2" | ||
}, | ||
{ | ||
"@id": "kb:node-3" | ||
}, | ||
{ | ||
"@id": "kb:node-4" | ||
}, | ||
{ | ||
"@id": "kb:node-5" | ||
}, | ||
{ | ||
"@id": "kb:node-6" | ||
}, | ||
{ | ||
"@id": "kb:node-7" | ||
} | ||
] | ||
}, | ||
{ | ||
"@id": "kb:node-0", | ||
"@type": "observable:ObservableObject" | ||
}, | ||
{ | ||
"@id": "kb:node-1", | ||
"@type": [ | ||
"core:UcoObject", | ||
"observable:ObservableObject" | ||
] | ||
}, | ||
{ | ||
"@id": "kb:node-2", | ||
"@type": [ | ||
"core:Item", | ||
"observable:ObservableObject" | ||
] | ||
}, | ||
{ | ||
"@id": "kb:node-3", | ||
"@type": [ | ||
"core:UcoObject", | ||
"core:Item", | ||
"observable:ObservableObject" | ||
] | ||
}, | ||
{ | ||
"@id": "kb:node-4", | ||
"@type": [ | ||
"observable:Observable", | ||
"observable:ObservableObject" | ||
] | ||
}, | ||
{ | ||
"@id": "kb:node-5", | ||
"@type": [ | ||
"core:UcoObject", | ||
"observable:Observable", | ||
"observable:ObservableObject" | ||
] | ||
}, | ||
{ | ||
"@id": "kb:node-6", | ||
"@type": [ | ||
"core:Item", | ||
"observable:Observable", | ||
"observable:ObservableObject" | ||
] | ||
}, | ||
{ | ||
"@id": "kb:node-7", | ||
"@type": [ | ||
"core:UcoObject", | ||
"core:Item", | ||
"observable:Observable", | ||
"observable:ObservableObject" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!python | ||
|
||
import json | ||
import rdflib | ||
import sys | ||
import subprocess | ||
|
||
test_file = "action_result_NO_CONTEXT.json" | ||
output_file = "temp_cntxt.json" | ||
# Execute Context builder | ||
cmd = "python ../../src/uco_jsonld_context_builder.py --output " + output_file | ||
print(cmd) | ||
subprocess.run(cmd.split()) | ||
with open(output_file, 'r') as file: | ||
tmp_c = json.load(file) | ||
# print(tmp_c) | ||
graph = rdflib.Graph() | ||
graph.parse(test_file, format="json-ld") | ||
graph.serialize("test_out_no_cntxt.json-ld", format="json-ld") | ||
graph2 = rdflib.Graph() | ||
graph2.parse(test_file, format="json-ld", context_data=tmp_c) | ||
graph.serialize("test_out_cntxt.json-ld", context_data=tmp_c, format="json-ld", auto_compact=True) | ||
# graph2.parse("../tests/uco_monolithic.ttl", format="turtle", context_data=tmp_c) | ||
# graph2.parse("../tests/uco_monolithic.ttl", format="turtle") | ||
# graph.serialize("__uco_monolithic.json-ld", context_data=tmp_c, format="json-ld", auto_compact=False) | ||
# graph2.serialize("__uco_monolithic.json-ld", context_data=tmp_c, format="json-ld", auto_compact=True) | ||
#graph2.serialize("__uco_monolithic.json-ld", context_data=tmp_c, format="json-ld", auto_compact=True) | ||
# graph2.serialize("__uco_monolithic.json-ld", format="json-ld", auto_compact=True) | ||
sys.exit() |