Last active
February 17, 2022 13:02
-
-
Save anatoly-scherbakov/6deac9b7540ecacc723603d83d2d9cee to your computer and use it in GitHub Desktop.
OWL RL & RDFLib profiling
This file contains hidden or 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
import cProfile | |
import sys | |
from pstats import SortKey, Stats | |
import owlrl | |
from owlrl import OWLRL_Extension | |
import rdflib | |
def test_profile_owlrl(): | |
print(f'Python: {sys.version}') | |
print(f'RDFLib: {rdflib.__version__}') | |
print(f'OWL RL: {owlrl.__version__}') | |
graph = rdflib.Graph().parse( | |
'https://schema.org/version/latest/schemaorg-current-https.jsonld', | |
format='json-ld', | |
) | |
with cProfile.Profile() as profiler: | |
owlrl.DeductiveClosure(OWLRL_Extension).expand(graph) | |
Stats(profiler).strip_dirs().sort_stats(SortKey.TIME).print_stats(10) | |
if __name__ == '__main__': | |
test_profile_owlrl() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output