Skip to content

WOQL: using «update_triple» with three parameters and «and» #119

@fidelthomet

Description

@fidelthomet

Describe the bug
WOQL.update_triple can be used with either three or four parameters. The fourth one represents the old value (oldObjValue) which should be replaced. If the fourth parameter is set to a new variable (e.g. v:oldValue) all existing values are overwritten since the variable matches all of them. The same happens when the fourth parameter is omitted, in the JSON-LD representation a variable AnyObject is introduced.

So far, so good. But what happens when I want update multiple triples at once?

To Reproduce
in the desktop client query interface enter (but don't run) this query

WOQL
  .update_triple('doc:Card', 'scm:x', 100)
  .update_triple('doc:Card', 'scm:y', 150)

looking at the JSON-LD representation, again the variable AnyObject is introduced. For both. Which essentially turns the above query into:

WOQL
  .update_triple('doc:Card', 'scm:x', 100, 'v:AnyObject')
  .update_triple('doc:Card', 'scm:y', 150, 'v:AnyObject')

assuming that the existing values for scm:x and scm:y differ, v:AnyObject will match all values for scm:x but none for scm:y. Therefore scm:x is updated correctly, while an additional value is inserted for scm:y

Expected behavior
running the query should replace existing values for both properties / v:AnyObject should not be reused.

Info (please complete the following information):
Desktop Client Version: 4.2.3

Workaround
provide a fourth parameter with different variable names:

WOQL
  .update_triple('doc:Card', 'scm:x', 100, 'v:oldX')
  .update_triple('doc:Card', 'scm:y', 150, 'v:oldY')

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions