Ticket #536 (closed Defect: duplicate)

Opened 11 years ago

Last modified 11 years ago

simple and empty topic update alters topic uri

Reported by: Malte Owned by: jri
Priority: Major Milestone:
Component: DeepaMehta Standard Distribution Version: 4.1.2
Keywords: Cc:
Complexity: 3 Area: Application Framework / API
Module: deepamehta-core

Description

This bug occurred to me as a result of a workaround I use to deal with #510, manually updating the most upper topics modification timestamp to be able to see the already (to the DB) written changes directly with my browser.

dms.updateTopic(new TopicModel(courseTopic.getId()), null); // fixme: with this call our topic URI get's altered!

Change History

comment:1 Changed 11 years ago by jri

Yes, this is a serious known bug. See #311.

As a(nother) workaround try to include the topic URI in the TopicModel? constructor:

new TopicModel(courseTopic.getId(), courseTopic.getUri(), null, null, null)

I have to fix this as well as #510.

Thanks for reminding!

comment:2 follow-up: ↓ 3 Changed 11 years ago by Malte

For the record:

I tried this but it did not work. Including the URI in the TopicModel? there seems to alter the topics type URI while the topics instance URI still gets cleared.

Alternatively trying to update the topic with just providing the topics instance URI and the type URI, also does not work, leading to the following message (indicating that updating a topic through just providing it's URI and type will currently never work):

// Caused by: org.neo4j.graphdb.NotFoundException: Node[-1]

In the end, the following update code did the trick for me:

JSONObject object = new JSONObject();
           object.put("id", courseTopic.getId());
           object.put("uri", courseTopic.getUri());
           object.put("type_uri", courseTopic.getTypeUri());
dms.updateTopic(new TopicModel(object), null);

comment:3 in reply to: ↑ 2 Changed 11 years ago by jri

Replying to Malte:

I tried this but it did not work. Including the URI in the TopicModel? there seems to alter the topics type URI while the topics instance URI still gets cleared.

Sorry, I can't believe that. Are you sure you used the 5-arg constructor as I told you:

new TopicModel(courseTopic.getId(), courseTopic.getUri(), null, null, null)

If you would have used the 2-arg version -- dropping the null arguments -- result would be as you describe. Have a look at the TopicModel? constructor API.

Alternatively trying to update the topic with just providing the topics instance URI and the type URI, also does not work, leading to the following message (indicating that updating a topic through just providing it's URI and type will currently never work):

// Caused by: org.neo4j.graphdb.NotFoundException: Node[-1]

I believe this :-) There must be a topic ID involved in an update request.

In the end, the following update code did the trick for me:

JSONObject object = new JSONObject();
           object.put("id", courseTopic.getId());
           object.put("uri", courseTopic.getUri());
           object.put("type_uri", courseTopic.getTypeUri());
dms.updateTopic(new TopicModel(object), null);

The 5-arg TopicModel? constructor mentioned above would be more efficient.

comment:4 Changed 11 years ago by Malte

No, you're right - I actually thought there might be a TopicModel? constructor receiving just these 2 args (id and uri), so I made wrong use of the constructor. Thanks for the clarification.

comment:5 Changed 11 years ago by jri

You are welcome!
It's good to see you find new tricks anyway :-)

Do we want close this ticket in favor of #311?

comment:6 Changed 11 years ago by Malte

  • Status changed from new to closed
  • Resolution set to duplicate

I found a new case and there I cannot deploy these kind of tricks anymore: Topicmaps. And yes, we can close this ticket in favor of #311. I will post my new insights there.

Note: See TracTickets for help on using tickets.