I am trying to set up a project with autoNumbered predicates. I couldn't use the lang:autoNumbered option in .logic files as it gave me the error that it expected a constraint or a lang:ordered.
So I rewrote my code in a .lb file, which worked. The code is as follows:
create --unique
addblock <doc>
node(n), node_id(n:id) -> int(id).
lang:autoNumbered(`node_id).
cons_node[] = n -> node(n).
lang:constructor(`cons_node).
node_has_label[l] = n -> string(l), node(n).
node_attribute[n, k] = v -> node(n), string(k), string(v).
node_attribute_id(id, att, val) <- node_id(n: id), node_attribute[n, att] = val.
</doc>
exec <doc>
+node(n), +cons_node[] = n,
+node_attribute[n, "label"] = "Person",
+node_attribute[n, "name"] = "Alice".
</doc>
echo --- node_att_table:
print node_attribute_id
close --destroy
Now I want to move this into a node.logic and a separate data file. How do I do this while keeping the lang:autoNumbered and lang:constructor commands?
EDIT:
This is the code that I have tried to run:
block(`node) {
export(`{
node(n), node_id(n:id) -> int(id).
lang:autoNumbered(`node_id).
cons_node[] = n -> node(n).
lang:constructor(`cons_node).
node_attribute(n, k; v) -> node(n), string(k), string(v).
})
} <-- .
And I get the error
error parsing block: expected a constraint or lang:ordering pragma (Error BLOCK_PARSE)
on the lang:autoNumbered and lang:constructor lines when I run lb config && make.
Extra info: I use Vagrant to run logicblox and am basing my examples on these blogs: https://developer.logicblox.com/2014/01/structuring-and-compiling-logicblox-applications/