Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/306 em trigger lazy loading #307

Merged

Conversation

luxbe
Copy link
Contributor

@luxbe luxbe commented Jan 10, 2025

This PR fixes #306 by triggering lazy loading when EntityManagerImpl is presented with a LazyLoadingProxy in the contains and remove methods.

@luxbe
Copy link
Contributor Author

luxbe commented Jan 10, 2025

The build fails because the following test DeleteOperationsRunner.removeTriggersLazyLoading fails only with the DeleteOperationsTest of the OWLApi implementation.

Executing the following statement:

((EntityManagerImpl) em).createNativeQuery("SELECT ?p WHERE {?s ?p ?o}", String.class).setParameter("s", entityA.getUri()).getResultList()

before and after the remove call within the removeTriggersLazyLoading test reveals, that before the remove call, there are 4 statments left from entityA:

0 = "http://www.w3.org/2002/07/owl#topDataProperty"
1 = "https://onto.fel.cvut.cz/ontologies/jopa/attributes#A-stringAttribute"
2 = "http://www.w3.org/2002/07/owl#topObjectProperty"
3 = "http://www.w3.org/2002/07/owl#topObjectProperty"

while after the remove call, there are still 2 statements left:

0 = "http://www.w3.org/2002/07/owl#topObjectProperty"
1 = "http://www.w3.org/2002/07/owl#topObjectProperty"

In the RDF4J and the Jena implementation, all statements are properly removed. Therefore, I believe that this is a bug in the OWL implementation.

@ledsoft
Copy link
Contributor

ledsoft commented Jan 15, 2025

This is not a bug in the OWLAPI implementation, it's how OWL works.

OWL is a modeling language with a bunch of built-in concepts, so even an empty ontology is not completely empty. I suggest modifying the OWLAPI-based version of the test to take this into account.

…tegration tests to account for implementation differences
@luxbe
Copy link
Contributor Author

luxbe commented Jan 15, 2025

Thanks for the info! I lacked the right understanding of OWL. The newest changes implement your suggestion

Copy link
Contributor

@ledsoft ledsoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ledsoft ledsoft merged commit 80e41a1 into kbss-cvut:development Jan 18, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EntityManager should trigger LazyLoading when presented with LazyLoadingProxies
2 participants