|
| 1 | +# /// script |
| 2 | +# dependencies = [ |
| 3 | +# "rdflib", |
| 4 | +# "brickschema[allegro]", |
| 5 | +# "owlready2", |
| 6 | +# "owlrl", |
| 7 | +# "reasonable", |
| 8 | +# ] |
| 9 | +# /// |
1 | 10 | import rdflib |
2 | 11 | import glob |
3 | 12 | import brickschema |
@@ -37,25 +46,25 @@ def load_file(g, f): |
37 | 46 | } |
38 | 47 |
|
39 | 48 |
|
40 | | -# owlready2 |
41 | | -import owlready2 |
42 | | -for data_file in data_files: |
43 | | - print(f"Benching owlready2 on {data_file}") |
44 | | - all_samples['owlready2'][data_file] = [] |
45 | | - for i in range(N): |
46 | | - g = rdflib.Graph() |
47 | | - load_file(g, data_file) |
48 | | - for ont_file in ontology_files: |
49 | | - load_file(g, ont_file) |
50 | | - g.serialize("_owlready2_input.ttl", format="ttl") |
51 | | - world = owlready2.World() |
52 | | - onto = world.get_ontology(f"file://./_owlready2_input.ttl").load() |
53 | | - t0 = time.time() |
54 | | - owlready2.sync_reasoner(world, infer_property_values =True) |
55 | | - G = world.as_rdflib_graph() |
56 | | - t1 = time.time() |
57 | | - print(f" owlready2: {data_file} took {t1-t0}") |
58 | | - all_samples['owlready2'][data_file].append({'duration': t1-t0, 'triples': len(G)}) |
| 49 | +## owlready2 |
| 50 | +#import owlready2 |
| 51 | +#for data_file in data_files: |
| 52 | +# print(f"Benching owlready2 on {data_file}") |
| 53 | +# all_samples['owlready2'][data_file] = [] |
| 54 | +# for i in range(N): |
| 55 | +# g = rdflib.Graph() |
| 56 | +# load_file(g, data_file) |
| 57 | +# for ont_file in ontology_files: |
| 58 | +# load_file(g, ont_file) |
| 59 | +# g.serialize("_owlready2_input.ttl", format="ttl") |
| 60 | +# world = owlready2.World() |
| 61 | +# onto = world.get_ontology(f"file://./_owlready2_input.ttl").load() |
| 62 | +# t0 = time.time() |
| 63 | +# owlready2.sync_reasoner(world, infer_property_values =True) |
| 64 | +# G = world.as_rdflib_graph() |
| 65 | +# t1 = time.time() |
| 66 | +# print(f" owlready2: {data_file} took {t1-t0}") |
| 67 | +# all_samples['owlready2'][data_file].append({'duration': t1-t0, 'triples': len(G)}) |
59 | 68 |
|
60 | 69 |
|
61 | 70 | # OWLRL |
|
0 commit comments