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

Triggering an update of the cached edges in OWLGraphWrapper #49

Open
ShahimEssaid opened this issue Feb 2, 2015 · 7 comments
Open

Triggering an update of the cached edges in OWLGraphWrapper #49

ShahimEssaid opened this issue Feb 2, 2015 · 7 comments

Comments

@ShahimEssaid
Copy link

From TheITGuy...@gmail.com on February 06, 2013 06:13:25

Additions/removal of OWLSubClassOfAxiom in an ontology are not seen by the OWLGraphWrapper container. Might be nice to add a method to trigger an update of the cached edges.

Example:

OWLSubClassOfAxiom ax = factory.getOWLSubClassOfAxiom(myOWLClass1, myOWLClass2);
AddAxiom addAx = new AddAxiom(myWrapper.getSourceOntology(), ax);
myWrapper.getManager().applyChange(addAx);
for (OWLGraphEdge edge: myWrapper.getCompleteEdgesBetween(myClass, myClass2)) {
System.out.println(edge);//no edges found here
}
//force an update, but throw checked Exceptions, and looks like a hack.
myWrapper = new OWLGraphWrapper(myWrapper.getSourceOntology());
for (OWLGraphEdge edge: myWrapper.getCompleteEdgesBetween(myClass, myClass2)) {
System.out.println(edge);//the edge is correctly displayed
}

Original issue: http://code.google.com/p/owltools/issues/detail?id=49

@ShahimEssaid
Copy link
Author

From TheITGuy...@gmail.com on February 06, 2013 06:17:34

Of note, cacheEdges() does not trigger an update of the cached edges.

@ShahimEssaid
Copy link
Author

From HDie...@lbl.gov on February 07, 2013 09:09:19

There is now a new method clearCachedEdges() in OWLGraphWrapper, see r1122 .

Please, can you verify that this is sufficient for your tasks.
Are there any other caches you want to be able to clear?

Status: Started

@ShahimEssaid
Copy link
Author

From TheITGuy...@gmail.com on February 07, 2013 15:16:45

It does not seem to work :/

Of note, my previous sample code was incorrect, to reproduce the problem, getEdgesBetween must have been called before the creation of a new relation.

So, by introducing the new clearCachedEdges() method, the sample code becomes:

myWrapper.getEdgesBetween(myClass, myClass2);//just to trigger the cache

OWLSubClassOfAxiom ax = factory.getOWLSubClassOfAxiom(myClass, myClass2);
AddAxiom addAx = new AddAxiom(myWrapper.getSourceOntology(), ax);
myWrapper.getManager().applyChange(addAx);

for (OWLGraphEdge edge: myWrapper.getEdgesBetween(myClass, myClass2)) {
System.out.println(edge);//no edges found here
}
myWrapper.clearCachedEdges();//test the new methd
for (OWLGraphEdge edge: myWrapper.getEdgesBetween(myClass, myClass2)) {
System.out.println(edge);//still nothing :(
}
//force an update, but throw checked Exceptions, and looks like a hack.
myWrapper = new OWLGraphWrapper(myWrapper.getSourceOntology());
for (OWLGraphEdge edge: myWrapper.getEdgesBetween(myClass, myClass2)) {
System.out.println(edge);//the edge is correctly displayed
}

@ShahimEssaid
Copy link
Author

From HDie...@lbl.gov on February 07, 2013 16:11:11

Thank you for testing.
I have updated the method to clear all caches and added a test case.
Please, see revision r1131 .

@ShahimEssaid
Copy link
Author

From TheITGuy...@gmail.com on February 07, 2013 16:21:13

Now it works, thank you.
(not a priority, but an option to disable the caching would be handy, when you build/modify an ontology)

@ShahimEssaid
Copy link
Author

From HDie...@lbl.gov on February 07, 2013 16:27:43

Hello,

there is the Config object for OWLGraphWrapper#getConfig()
It has the boolean field: isCacheClosure You could set that to false.
BUT at the moment this is not used in all of the caching methods. This needs to be changed soon.

@ShahimEssaid
Copy link
Author

From TheITGuy...@gmail.com on February 07, 2013 16:30:02

Oh OK, thank you for the info. I guess I will use clearCachedEdges() until then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant