chenejac / VIVOTestMigrationJIRA

0 stars 0 forks source link

VIVO-898: Changing an object property URI messes up inverse relationship #888

Closed chenejac closed 6 years ago

chenejac commented 9 years ago

Jon Corson-Rikert (Migrated from VIVO-898) said:

I have encountered this now repeatedly both in the climate change VIVO site and in using Vitro. When you change the URI of an object property (A) with an inverse (B), the old URI (A) is still what the inverse property (B) points back to, while both the new URI (C) and old URI (A) point to the same inverse (B). When you try and delete the original object property (A), that should no longer exist but does, the inverse (B) is deleted as well, and all you are left with is (C). Since the Vitro ontology editor doesn't allow you to add an inverse to an object property except when it's first created, the property has to be deleted and recreated (losing all the statements that may exist).

chenejac commented 9 years ago

tlw72 said:

I was not able to re-create this in a VIVO instance. I updated the URI of an object property, then checked its inverse property. The inverse was pointing to the correct, updated URI. I also dumped the asserted tbox model and there was no entry for the original original URI.

chenejac commented 9 years ago

Jon Corson-Rikert said:

Tim, I may have described the problem inadequately. When I've seen this is when there have been a significant number of statements using the property, and I suspect what happens is that the property URI in the inverse statements doesn't get changed correctly, leading to some of the confusing behavior observed.

chenejac commented 9 years ago

Jon Corson-Rikert said:

I have been able to reproduce the problem in a copy of the current dev branch of VIVO, though the problem is likely in the Vitro code.

  1. Add a new object property with the domain Person and range Person, in the VIVO core ontology, and call it vivo:isTallerThan with an inverse vivo:isShorterThan
  2. Populate 4-5 instances of the property and see that statements are populated in both directions
  3. Go to the vivo:isTallerThan property and change the URI to vivo:isLargerThan (change the label, too, to help avoid confusion).
  4. Similarly change the URI of the vivo:isShorterThan property to vivo:isSmallerThan (and the label).
  5. Try adding some more statements for either of the newly renamed properties (in either direction).
  6. I started seeing the old label again (see attached picture), and the strange behavior where one property will be linked to an inverse property, but that inverse does not link back to the same property, but to the original name of the first property.

I can demonstrate if that would be helpful.

chenejac commented 9 years ago

tlw72 said:

Following the steps above, after I add four statements using the two new properties, I get these predicates:

http://vivoweb.org/ontology/core#isShorterThan http://vivoweb.org/ontology/core#isShorterThan http://vivoweb.org/ontology/core#isShorterThan http://vivoweb.org/ontology/core#isShorterThan http://vivoweb.org/ontology/core#isTallerThan http://vivoweb.org/ontology/core#isTallerThan http://vivoweb.org/ontology/core#isTallerThan http://vivoweb.org/ontology/core#isTallerThan

After changing the URIs, the predicates are updated correctly with four additional being added to the inference graph:

http://vivoweb.org/ontology/core#isLargerThan http://vivoweb.org/ontology/core#isLargerThan http://vivoweb.org/ontology/core#isLargerThan http://vivoweb.org/ontology/core#isLargerThan http://vivoweb.org/ontology/core#isSmallerThan http://vivoweb.org/ontology/core#isSmallerThan http://vivoweb.org/ontology/core#isSmallerThan http://vivoweb.org/ontology/core#isSmallerThan http://vivoweb.org/ontology/core#isSmallerThan (vitro-kb-inf) http://vivoweb.org/ontology/core#isSmallerThan (vitro-kb-inf) http://vivoweb.org/ontology/core#isSmallerThan (vitro-kb-inf) http://vivoweb.org/ontology/core#isSmallerThan (vitro-kb-inf)

Here are the predicates after adding two additional statements with each property. Note the reappearance of the original, pre-URI change predicates (marked by **).

http://vivoweb.org/ontology/core#isLargerThan http://vivoweb.org/ontology/core#isLargerThan http://vivoweb.org/ontology/core#isLargerThan http://vivoweb.org/ontology/core#isLargerThan http://vivoweb.org/ontology/core#isLargerThan http://vivoweb.org/ontology/core#isSmallerThan http://vivoweb.org/ontology/core#isSmallerThan http://vivoweb.org/ontology/core#isSmallerThan http://vivoweb.org/ontology/core#isSmallerThan http://vivoweb.org/ontology/core#isSmallerThan http://vivoweb.org/ontology/core#isSmallerThan http://vivoweb.org/ontology/core#isTallerThan http://vivoweb.org/ontology/core#isLargerThan (vitro-kb-inf) http://vivoweb.org/ontology/core#isShorterThan (vitro-kb-inf) http://vivoweb.org/ontology/core#isShorterThan (vitro-kb-inf) http://vivoweb.org/ontology/core#isSmallerThan (vitro-kb-inf) http://vivoweb.org/ontology/core#isSmallerThan (vitro-kb-inf) http://vivoweb.org/ontology/core#isSmallerThan (vitro-kb-inf) http://vivoweb.org/ontology/core#isSmallerThan (vitro-kb-inf) http://vivoweb.org/ontology/core#isTallerThan (vitro-kb-inf)

If I start completely over following the same steps as above, but re-start Tomcat before adding the four additional statements, the predicates do not include the pre-URI change predicates:

http://vivoweb.org/ontology/core#isLargerThan http://vivoweb.org/ontology/core#isLargerThan http://vivoweb.org/ontology/core#isLargerThan http://vivoweb.org/ontology/core#isLargerThan http://vivoweb.org/ontology/core#isLargerThan http://vivoweb.org/ontology/core#isLargerThan http://vivoweb.org/ontology/core#isSmallerThan http://vivoweb.org/ontology/core#isSmallerThan http://vivoweb.org/ontology/core#isSmallerThan http://vivoweb.org/ontology/core#isSmallerThan http://vivoweb.org/ontology/core#isSmallerThan http://vivoweb.org/ontology/core#isSmallerThan http://vivoweb.org/ontology/core#isSmallerThan (vitro-kb-inf) http://vivoweb.org/ontology/core#isSmallerThan (vitro-kb-inf) http://vivoweb.org/ontology/core#isSmallerThan (vitro-kb-inf) http://vivoweb.org/ontology/core#isSmallerThan (vitro-kb-inf)

chenejac commented 9 years ago

Jim Blake said:

Following Jon's instructions, with 2 taller/shorter relationships

Changed vivo:isTallerThan to vivo:isLargerThan, got these two messages: 2015-03-23 11:25:38,877 WARN [SimpleReasoner] The subject and object of the inverseOf statement are not both object properties. No inferencing will be performed. property 1: http://vivoweb.org/ontology/core#isTallerThan property 2:http://vivoweb.org/ontology/core#isShorterThan 2015-03-23 11:25:38,983 WARN [SimpleReasoner] The subject and object of the inverseOf statement are not both object properties. No inferencing will be performed. property 1: http://vivoweb.org/ontology/core#isShorterThan property 2:http://vivoweb.org/ontology/core#isTallerThan

But everything worked fine. Went on to change the label.

On changing isShorterThan to isSmallerThan, got this one message: 2015-03-23 11:26:36,740 WARN [SimpleReasoner] The subject and object of the inverseOf statement are not both object properties. No inferencing will be performed. property 1: http://vivoweb.org/ontology/core#isLargerThan property 2:http://vivoweb.org/ontology/core#isShorterThan

On changing the label, got this exception: 2015-03-23 11:27:05,512 ERROR [ObjectPropertyDaoJena] com.hp.hpl.jena.ontology.ConversionException: Cannot convert node http://vivoweb.org/ontology/core#isShorterThan to OntProperty com.hp.hpl.jena.ontology.ConversionException: Cannot convert node http://vivoweb.org/ontology/core#isShorterThan to OntProperty at com.hp.hpl.jena.ontology.impl.OntPropertyImpl$1.wrap(OntPropertyImpl.java:64) at com.hp.hpl.jena.enhanced.EnhNode.convertTo(EnhNode.java:152) at com.hp.hpl.jena.enhanced.EnhNode.convertTo(EnhNode.java:31) at com.hp.hpl.jena.enhanced.Polymorphic.asInternal(Polymorphic.java:62) at com.hp.hpl.jena.enhanced.EnhNode.as(EnhNode.java:107) at com.hp.hpl.jena.ontology.impl.OntResourceImpl$SubjectAsMapper.map1(OntResourceImpl.java:1676) at com.hp.hpl.jena.ontology.impl.OntResourceImpl$SubjectAsMapper.map1(OntResourceImpl.java:1670) at com.hp.hpl.jena.util.iterator.Map1Iterator.next(Map1Iterator.java:45) at com.hp.hpl.jena.ontology.impl.OntPropertyImpl.getInverse(OntPropertyImpl.java:753) at com.hp.hpl.jena.ontology.impl.ObjectPropertyImpl.getInverse(ObjectPropertyImpl.java:134) at edu.cornell.mannlib.vitro.webapp.dao.jena.ObjectPropertyDaoJena.propertyFromOntProperty(ObjectPropertyDaoJena.java:110) at edu.cornell.mannlib.vitro.webapp.dao.jena.ObjectPropertyDaoJena.getAllObjectProperties(ObjectPropertyDaoJena.java:261) at edu.cornell.mannlib.vitro.webapp.controller.edit.PropertyRetryController.populateOptionMap(PropertyRetryController.java:234) at edu.cornell.mannlib.vitro.webapp.controller.edit.PropertyRetryController.doPost(PropertyRetryController.java:140) at edu.cornell.mannlib.vitro.webapp.controller.edit.PropertyRetryController.doGet(PropertyRetryController.java:205) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at edu.cornell.mannlib.vedit.controller.EditFrontController.doPost(EditFrontController.java:63) at edu.cornell.mannlib.vedit.controller.EditFrontController.doGet(EditFrontController.java:84) But the screen came up, and I was able to make the change.

From the Object Property Control Panel, if I repeatedly click "Go to Inverse Property", I go this way: isSmallerThan => isLargerThan => isShorterThan => isTallerThan => isShorterThan => etc.

And when doing this, I see messages like this: 2015-03-23 11:32:38,611 ERROR [PropertyDaoJena] Failed to get super-properties for http://vivoweb.org/ontology/core#isShorterThan java.lang.NullPointerException at edu.cornell.mannlib.vitro.webapp.dao.jena.PropertyDaoJena.getSuperPropertyURIs(PropertyDaoJena.java:194) at edu.cornell.mannlib.vitro.webapp.controller.edit.PropertyEditController.doPost(PropertyEditController.java:205) at edu.cornell.mannlib.vitro.webapp.controller.edit.PropertyEditController.doGet(PropertyEditController.java:246)

2015-03-23 11:33:00,808 ERROR [PropertyDaoJena] Failed to get super-properties for http://vivoweb.org/ontology/core#isTallerThan java.lang.NullPointerException at edu.cornell.mannlib.vitro.webapp.dao.jena.PropertyDaoJena.getSuperPropertyURIs(PropertyDaoJena.java:194) at edu.cornell.mannlib.vitro.webapp.controller.edit.PropertyEditController.doPost(PropertyEditController.java:205) at edu.cornell.mannlib.vitro.webapp.controller.edit.PropertyEditController.doGet(PropertyEditController.java:246)

chenejac commented 9 years ago

Jim Blake said:

One problem appears to be that no edit event is generated when the URI is changed, so the TBoxReasoner is not triggered until the label is changed. Why is that a problem?

chenejac commented 9 years ago

Jim Blake said:

Another problem is a stupid typo in TBoxChanges.