<jupyter_start><jupyter_text>Requirements/Libraries<jupyter_code>from owlready2 import *<jupyter_output>* Owlready2 * Warning: optimized Cython parser module 'owlready2_optimized' is not available, defaulting to slower Python implementation<jupyter_text>Load an ontology and print 5 classes<jupyter_code>#Load ontology
num_entities_to_print=5
urionto="http://protege.stanford.edu/ontologies/pizza/pizza.owl"

#Method from owlready
print("Loading ontology...")
onto = get_ontology(urionto).load()

#Print 5 entities

print("Classes in Pizza ontology: " + str(len(list(onto.classes()))))
print("Printing " + str(num_entities_to_print) + " classes.")
i=0
for cls in onto.classes():
    i+=1
    print(" "+cls.iri)
    print("\t"+cls.name)
    print("\t"+str(cls.label))
    if i==num_entities_to_print:
        break<jupyter_output>Loading ontology...
Classes in Pizza ontology: 99
Printing 5 classes.
 http://www.co-ode.org/ontologies/pizza/pizza.owl#Pizza
	Pizza
	['Pizza']
 http://www.co-ode.org/ontologies/pizza/pizza.owl#PizzaBase
	PizzaBase
	['BaseDaPizza', 'PizzaBase']
 http://www.co-ode.org/ontologies/pizza/pizza.owl#Food
	Food
	['Food']
 http://www.co-ode.org/ontologies/pizza/pizza.owl#Spiciness
	Spiciness
	['Spiciness', 'Tempero']
 http://www.co-ode.org/ontologies/pizza/pizza.owl#PizzaTopping
	PizzaTopping
	['CoberturaDaPizza', 'PizzaTopping']<jupyter_text>Print Object and Data Properties<jupyter_code>print("Object properties in Pizza ontology: " + str(len(list(onto.object_properties()))))
print("Printing " + str(num_entities_to_print) + " object properties.")
i=0
for oprop in onto.object_properties():
    i+=1
    print(" "+oprop.iri)
    print("\t"+oprop.name)
    print("\t"+str(oprop.label))
    if i==num_entities_to_print:
        break
print("Data properties in Pizza ontology: " + str(len(list(onto.data_properties()))))
#print("Printing " + str(num_entities_to_print) + " data properties.")
i=0
for dprop in onto.data_properties():
    i+=1
    print(" "+dprop.iri)
    print("\t"+dprop.name)
    print("\t"+str(dprop.label))
    if i==num_entities_to_print:
        break<jupyter_output>Data properties in Pizza ontology: 0<jupyter_text>Printing individuals<jupyter_code>print("Individuals in Pizza ontology: " + str(len(list(onto.individuals()))))
print("Printing " + str(num_entities_to_print) + " individuals.")
i=0
for indiv in onto.individuals():
    i+=1
    print(" "+indiv.iri)
    print("\t"+indiv.name)
    print("\t"+str(indiv.label))
    if i==num_entities_to_print:
        break<jupyter_output>Individuals in Pizza ontology: 5
Printing 5 individuals.
 http://www.co-ode.org/ontologies/pizza/pizza.owl#America
	America
	[]
 http://www.co-ode.org/ontologies/pizza/pizza.owl#England
	England
	[]
 http://www.co-ode.org/ontologies/pizza/pizza.owl#France
	France
	[]
 http://www.co-ode.org/ontologies/pizza/pizza.owl#Germany
	Germany
	[]
 http://www.co-ode.org/ontologies/pizza/pizza.owl#Italy
	Italy
	[]
{'fraction_non_alphanumeric': 0.1539768864717879, 'fraction_numerical': 0.006798096532970768, 'mean_word_length': 4.9574898785425106, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 10, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '300630', 'license': 'Apache-2.0', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1074, 'n_words': 178, 'path': 'lab2/solution/SolutionExercise2_8.ipynb', 'repo_name': 'CheckYac4/python-2022', 'size': '2942'}