Skip to content

Commit 43e7ce3

Browse files
committed
add deps to bench script
1 parent c7c3741 commit 43e7ce3

File tree

1 file changed

+28
-19
lines changed

1 file changed

+28
-19
lines changed

benches/python/bench.py

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# /// script
2+
# dependencies = [
3+
# "rdflib",
4+
# "brickschema[allegro]",
5+
# "owlready2",
6+
# "owlrl",
7+
# "reasonable",
8+
# ]
9+
# ///
110
import rdflib
211
import glob
312
import brickschema
@@ -37,25 +46,25 @@ def load_file(g, f):
3746
}
3847

3948

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)})
5968

6069

6170
# OWLRL

0 commit comments

Comments
 (0)