Skip to content

Commit

Permalink
Merge pull request #76 from dice-group/issues-solving
Browse files Browse the repository at this point in the history
Removed unused jar files
  • Loading branch information
Demirrr authored Oct 1, 2024
2 parents 172cbd0 + 023b1c6 commit 70fad7c
Show file tree
Hide file tree
Showing 33 changed files with 104 additions and 1 deletion.
Binary file not shown.
Binary file removed owlapy/jar_dependencies/commons-codec-1.10.jar
Binary file not shown.
Binary file not shown.
Binary file removed owlapy/jar_dependencies/fluent-hc-4.5.5.jar
Binary file not shown.
Binary file removed owlapy/jar_dependencies/httpclient-4.5.2.jar
Binary file not shown.
Binary file removed owlapy/jar_dependencies/httpclient-cache-4.5.2.jar
Binary file not shown.
Binary file removed owlapy/jar_dependencies/httpclient-osgi-4.5.5.jar
Binary file not shown.
Binary file removed owlapy/jar_dependencies/httpcore-4.4.4.jar
Binary file not shown.
Binary file removed owlapy/jar_dependencies/httpcore-nio-4.4.5.jar
Binary file not shown.
Binary file removed owlapy/jar_dependencies/httpcore-osgi-4.4.5.jar
Binary file not shown.
Binary file removed owlapy/jar_dependencies/httpmime-4.5.5.jar
Binary file not shown.
Binary file removed owlapy/jar_dependencies/j2objc-annotations-1.1.jar
Binary file not shown.
Binary file not shown.
Binary file removed owlapy/jar_dependencies/jackson-core-2.9.7.jar
Binary file not shown.
Binary file removed owlapy/jar_dependencies/jackson-databind-2.9.7.jar
Binary file not shown.
Binary file removed owlapy/jar_dependencies/jaxb-api-2.3.0.jar
Binary file not shown.
Binary file removed owlapy/jar_dependencies/jsonld-java-0.12.0.jar
Binary file not shown.
Binary file removed owlapy/jar_dependencies/jsr305-3.0.2.jar
Binary file not shown.
Binary file removed owlapy/jar_dependencies/rdf4j-rio-binary-2.3.2.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed owlapy/jar_dependencies/rdf4j-rio-n3-2.3.2.jar
Binary file not shown.
Binary file removed owlapy/jar_dependencies/rdf4j-rio-nquads-2.3.2.jar
Binary file not shown.
Binary file removed owlapy/jar_dependencies/rdf4j-rio-ntriples-2.3.2.jar
Binary file not shown.
Binary file removed owlapy/jar_dependencies/rdf4j-rio-rdfjson-2.3.2.jar
Binary file not shown.
Binary file removed owlapy/jar_dependencies/rdf4j-rio-rdfxml-2.3.2.jar
Binary file not shown.
Binary file removed owlapy/jar_dependencies/rdf4j-rio-trig-2.3.2.jar
Binary file not shown.
Binary file removed owlapy/jar_dependencies/rdf4j-rio-trix-2.3.2.jar
Binary file not shown.
Binary file removed owlapy/jar_dependencies/rdf4j-rio-turtle-2.3.2.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions owlapy/owlapi_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def __init__(self, ontology: _SO):
bidi_provider = BidirectionalShortFormProviderAdapter(self.manager, ontology_set, SimpleShortFormProvider())
entity_checker = ShortFormEntityChecker(bidi_provider)
bidi_provider.add(self.manager.getOWLDataFactory().getOWLNothing())
bidi_provider.add(self.manager.getOWLDataFactory().getOWLThing())
self.parser = ManchesterOWLSyntaxClassExpressionParser(self.manager.getOWLDataFactory(), entity_checker)
self.renderer = ManchesterOWLSyntaxOWLObjectRendererImpl()

Expand Down Expand Up @@ -508,6 +509,10 @@ def _(self, e):
java_list.add(self.map_(item))
return java_list

@map_.register(Stream)
def _(self, e):
return self.to_list(e)

@staticmethod
def to_list(stream_obj):
"""Converts Java Stream object to Python list"""
Expand Down
2 changes: 1 addition & 1 deletion owlapy/scripts/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def main():
sync_reasoner.infer_axioms_and_save(output_path=args.out_ontology,
output_format=args.output_type,
inference_types=it)
print("Finished inferring axioms \nOutput filename: '{}'".format(args.out_ontology))
print("\nFinished inferring axioms \nOutput filename: '{}'".format(args.out_ontology))


if __name__ == '__main__':
Expand Down
98 changes: 98 additions & 0 deletions tests/test_owlapy_command.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import subprocess
import sys
import unittest

from owlapy.class_expression import OWLClass, OWLNothing
from owlapy.iri import IRI
from owlapy.owl_axiom import OWLSymmetricObjectPropertyAxiom, OWLReflexiveObjectPropertyAxiom
from owlapy.owl_ontology_manager import SyncOntologyManager
from owlapy.owl_property import OWLObjectProperty
from owlapy.owl_reasoner import SyncReasoner


class TestOwlapyCommand(unittest.TestCase):

def test_owlapy_entry_point(self):
result = subprocess.run([sys.executable,
'-m',
'owlapy.scripts.run',
'--path_ontology',
'KGs/Family/family-benchmark_rich_background.owl'
])

self.assertEqual(result.returncode, 0)

onto = SyncOntologyManager().load_ontology("inferred_axioms_ontology.owl")

ops = onto.object_properties_in_signature()
self.assertEqual(list(ops), [OWLObjectProperty(IRI('http://www.benchmark.org/family#', 'hasChild')),
OWLObjectProperty(IRI('http://www.benchmark.org/family#', 'hasParent')),
OWLObjectProperty(IRI('http://www.benchmark.org/family#', 'hasSibling')),
OWLObjectProperty(IRI('http://www.benchmark.org/family#', 'married')),
OWLObjectProperty(IRI('http://www.w3.org/2002/07/owl#', 'topObjectProperty'))])

reasoner = SyncReasoner(onto)
mapper = reasoner.mapper
from org.semanticweb.owlapi.model import AxiomType
symetrical_axioms = mapper.map_(
onto.get_owlapi_ontology().getAxioms(AxiomType.SYMMETRIC_OBJECT_PROPERTY).stream())

reflexive_axioms = mapper.map_(
onto.get_owlapi_ontology().getAxioms(AxiomType.REFLEXIVE_OBJECT_PROPERTY).stream())

self.assertEqual(mapper.map_(symetrical_axioms[0]),
OWLSymmetricObjectPropertyAxiom(OWLObjectProperty(IRI('http://www.w3.org/2002/07/owl#',
'topObjectProperty')), []))

self.assertEqual(mapper.map_(reflexive_axioms[0]),
OWLReflexiveObjectPropertyAxiom(OWLObjectProperty(IRI('http://www.w3.org/2002/07/owl#',
'topObjectProperty')), []))

classes = onto.classes_in_signature()
self.assertEqual(list(classes), [OWLClass(IRI('http://www.benchmark.org/family#', 'Brother')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Child')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Daughter')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Father')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Female')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Grandchild')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Granddaughter')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Grandfather')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Grandmother')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Grandparent')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Grandson')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Male')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Mother')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Parent')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Person')),
OWLClass(IRI('http://www.benchmark.org/family#', 'PersonWithASibling')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Sister')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Son')),
OWLClass(IRI('http://www.w3.org/2002/07/owl#', 'Nothing')),
OWLClass(IRI('http://www.w3.org/2002/07/owl#', 'Thing'))])

disjoint_of_owl_nothing = reasoner.disjoint_classes(OWLNothing)
self.assertCountEqual(list(disjoint_of_owl_nothing),
[OWLClass(IRI('http://www.benchmark.org/family#', 'Grandchild')),
OWLClass(IRI('http://www.w3.org/2002/07/owl#', 'Thing')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Person')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Grandparent')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Grandfather')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Male')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Son')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Grandson')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Female')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Granddaughter')),
OWLClass(IRI('http://www.benchmark.org/family#', 'PersonWithASibling')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Sister')),
OWLClass(IRI('http://www.w3.org/2002/07/owl#', 'Nothing')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Grandmother')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Daughter')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Brother')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Mother')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Child')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Father')),
OWLClass(IRI('http://www.benchmark.org/family#', 'Parent'))])

len_inds = len(list(onto.individuals_in_signature()))
self.assertEqual(len_inds, 202)

0 comments on commit 70fad7c

Please sign in to comment.