Loading color scheme

FEKL Query Concepts

There are three types of concept to use when creating a FactEngine statement:

- ModelElementName;
- Predicate
- PropertyNodeIdentification

ModelElementName

When querying a database Model Elements are commensurate to Tables, Nodes and Attributes in your database.

- Entity Relationship Diagrams have Entity and Attribute model elements.
- Property Graph Schemas have Node and Property model elements.

Schemas created using Fact-Based Modeling, as used by FactEngine, consist of model elements, such as Entity Types, Value Types and Objectified Fact Types. Role Constraints and Roles, for instance, are also model elements.

So when querying a database you relate the model elements in your conceptual models in FactEngine/Boston to their corresponding model elements within your database. The name of each model element is called a ModelElementName within the syntax descriptions in this documentation. For example, the following FactEngine query has Lecturer, Room, Position, School and Faculty as ModelElementNames.

Suffixes

Note that each ModelElementName can have a suffix, such as in "2" in "Issue 2" as in the following query:

Predicates

As the name suggests, Predicates are the predicates of your conceptual models in Boston.

The query above has the following predicates;

- occupies
- holds
- is in
- works for

Property Node Identification

If you need to identify a particular data item in your database you do that with a PropertyNodeIdentification clause.

In the example query above, (Faculty:'IT') finds a particular row/node in your database that is uniquely identified by the name, 'IT', and where the first unique index of the node/table is used to find the appropriate attribute/property value.

FactEngine Query Language has three standard comparators, Equals, Not Equals and LIKE.

They are implemented as part of the syntax for Property Node Identification.

Equals comparator

The colon, :, is used for equals.

Not Equal/s comparator

The bang, !, symbol is used for Not Equals.

LIKE comparator

The tilde, ~, symbol is used for the LIKE comparator.

 

FEKL Statement Syntax

This section outlines the syntax of the statements that can be made in FEKL. Statements includes queries.

In the current version of FEKL there are the following statements:

1. DESCRIBE Statement;
2. ENUMERATE Statement; and
3. Query Statements; and

CREATE Statement

Boston v5.3 will support the CREATE statement and as below:

The CREATE statement is used to insert new rows/tuples into your database.

 

Syntax

CREATE <NodePropertyIdentification> (THAT <PredicateNodePropertyIdentification> (AND <PredicateNodePropertyIdentification>)*)?

<PredicateNodePropertyIdentification> := <Predicate> <NodePropertyIdentification>

 

Target Model Element

The first not property identification is for the model element that you want to create an instance of in the database. E.g. CREATE (Issue:'1') ... will create an instance of the Issue model element in the database.

NB If the target model element/first node property identification, e.g. '1' in (Issue:'1') has a data type of AutoCounter, regardless of what value you supply if the primary key for the model element is AutoCounter and the model element has one field as the primary key, the next number in sequence for the primary key of that model element will be found and used.

To explicitly specify the value to be used for the primary key of the target model element in a CREATE statement, use the caret symbol, ^, as in (Issue^6).

 

Node Property Identification and the CREATE statement

Unless the caret symbol, ^, is used in a node property identification, the identification value/s will be used to find a value in the primary unique index/key for the specified model element. The subsequent primary key of the instance of the model element will be used when inserting the appropriate value in the database for that model element.

E.g. In the example below, (Person:'Cathy') refers to an instance of the model element, Person. If the primary key value for that instance is  7, say, then 7 will be the value stored against the new Issue instance for the relationship 'was authored by'.
This makes it easy to reference an instance of a model element by its primary unique key value/s. To explicitly specify 7, say, for the instance, use the caret symbol as in (Person^7).

NB If the primary unique index has more than one field, append those with a comma between each identifier in a property node identification. E.g. (Person:'Cathy','Jones').
The order of the identifiers in a property node identification is taken from the ordinal position of the corresponding attribute/s in the corresponding table in the Entity Relationship view of the schema, and similarly the corresponding ordinal position of the corresponding properties for the node in the related Property Graph Schema for the given model element.

 

Example

DESCRIBE Statement

The DESCRIBE statement provides a definition of the attributes/properties of a table/node in your database as it is defined inside Boston and the FactEngine.

Syntax

DESCRIBE <ModelElementName>

Example