Skip to content

Commit 0e816f9

Browse files
committed
add back owlready2 and move files
1 parent bda6091 commit 0e816f9

File tree

109 files changed

+22
-22
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+22
-22
lines changed

benches/python/bench.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,42 +20,42 @@ def load_file(g, f):
2020
# "../../example_models/small1.n3",
2121
# "../../example_models/soda_hall.n3",
2222
# ]
23-
data_files = glob.glob("mortarmodels/*.ttl")
23+
data_files = glob.glob("buildings/*.ttl")
2424
data_sizes = {}
2525
for f in data_files:
2626
g = rdflib.Graph()
2727
g.parse(f, format='ttl')
2828
data_sizes[f] = len(g)
2929

30-
N = 10
30+
N = 1
3131

3232
all_samples = {
3333
'owlrl': {},
3434
'allegro': {},
35-
# 'owlready2': {},
35+
'owlready2': {},
3636
'reasonable': {},
3737
}
3838

3939

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

6060

6161
# OWLRL
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)