cozodb / cozo

A transactional, relational-graph-vector database that uses Datalog for query. The hippocampus for AI!
https://cozodb.org
Mozilla Public License 2.0
3.36k stars 100 forks source link

Possible bug in `:rm` operation #220

Closed aramallo closed 7 months ago

aramallo commented 9 months ago

I have an issue with the :rm syntax. I consider this a bug, but maybe this was a design decision?

Asumming I have a stored relationship called graph defined as:

:create graph { subject: string, predicate: string, object: any, name: string => }

The following script works to remove a row:

?[subject, predicate, object, name] <- ['a', 'b', 100, 'g1']
:rm graph { subject, predicate, object, name }

But the following two alternatives will not work

Alt 1:

:rm graph { subject: 'a', predicate: 'b', object: 100, name: 'g1}

Returns "The query parser has encountered unexpected input / end of input at 21..21"

:rm graph { 'a', 'b',  100, 'g1'}

Returns "The query parser has encountered unexpected input / end of input at 12..12"

Is this a bug, or :rm was designed to only work with variable bindings?

Volland commented 9 months ago

you need a ?[] part to be present in rm . only create allow form without query statement

Volland commented 9 months ago

it is a part of documented bechavior

aramallo commented 9 months ago

Thanks @Volland !!!