Querying for attribute values

In Molecule we simply use the namespace name and add the attribute names:

// Molecule
Community.name.url.category

Datalog has a :find and :where section similar to select and where in the SQL world. The :find section defines which values to return and the where section defines one or more clauses filtering the result set.

In this case we asked for the values of variable ?b, ?c and ?d each one bound in its where clause. With molecule we use the three attribute names all associated to the Community namespace.

Querying by attribute values

Note how we add an underscore to the type attribute to tell Molecule that we want to omit returning this value in the result set (since it will have the value “twitter” for all returned entities).

Since the type attribute is defined as en enumeration Molecule checks the “twitter” value at compile time against the defined enumeration values that we have definied in our schema for the Community namespace to ensure that “twitter” is one of the enums. If it is not, our molecule won’t compile and we’ll get an error showing the available enum values.

For a many-cardinality attribute like category Datalog applies logical OR with Datalog rules: