An Expression is a resource that associates a value to a list of operand values. Complex expressions specify an operator and a list of operand terms. For a complex expression defined by an operator and a list of terms, the value associated with the expression is obtained by 1) evaluating the value associated with the operands to every term and 2) by applying the operator to the set of values obtained this way.
The Expression Ontology allows to describe numerical expressions in rdf. The following concepts are formalized: - **Operator** - is a predicate, associating a value to a list of values, the operands - **Built-in** - is an Operator provided by the rule language (e.g. `math:sum`) - **Expression**: - is a resource, identified by an IRI - is an Operator like other built-in's - is specified with the Expression ontology - by an Operator and an ExpressionTerms - so only with statements, without new rule - **ExpressionTerms**: - provides a list of Terms for the Expression - defining the set of operands provided to the Operator - **Terms**: - is a list of Terms - **Term** - a Term of an Expression specifies an operand for the Operator of the Expression - the following Term types are provided - literals - implicitly for Datatype - explicitly with **RawValue** - parameters of the Expression - subexpressions ```mermaid classDiagram class Operator class Expression Operator <|-- Expression class BuiltIn:::owl class List:::owl class Datatype:::owl Operator <|-- BuiltIn Expression --> "1" ExpressionTerms : terms ExpressionTerms <|-- Terms List <|-- Terms ExpressionTerms <-- AllParams: type Terms --> "0..*" Term : member class Term { +Number eval(operands) } Term <-- Param0: type Term <-- Param1: type class Param { +Integer param } class RawValue { rawValue } Expression --> "1" Operator : operator Term <|-- Param Term <|-- RawValue Term <|-- Datatype Term <|-- Expression classDef default fill:#f96,color:black classDef owl fill:#e9edc9,color:black ```
The Expression Ontology
The Expression ontology is a vocabulary for describing symbolic expressions, composed of operators, operands, parameters. An expression can be evaluated to a value, when all its parameters have received a value. The Expression ontology allows to define new functions, without the usage of rules. Such expression will then be usable with any rule language, provided that the semantics of the expression ontology is implemented in the targeted rule language.
Any list of subterms of the Expression (from an arbitrary Term to then end), empty list included
Provides Terms to the Expression (functional)
An Expression is an Operator, specified by an (other) Operator and a set of Terms, that produce a value for a set of operands by first evaluating every term and second by applying the (other) operator. An Expression is a also a Term, so can be reused in a outter Expression
An Operator is a predicate stating that the object value is the result of applying the operator to the subject list of operands
A Param is a Term that returns the value of some operand
A RawValue is a Term that returns the raw value associated to it
A term in an Expression, that will be first evaluated, and whose result will be passed to the Operator
Operand
A list of Terms
Evaluates to the list of Params