Section 8. Built-Ins


8. A Proposed Taxonomy of Built-Ins

The proposed hierarchy of built-ins for SWRL is motivated by a modular approach that will allow further extensions in future releases of SWRL. At the same time, it will provide the flexibility for various implementations to select the level of hierarchy to be support with each version of SWRL.

SWRL's built-ins approach is also based on the reuse of existing built-ins in XQuery and XPath, themselves derived from XML data types part 2 built-ins. Some other built-ins are specific to SWRL, OWL, and RuleML, dealing with fact and rule prioritization.

This system of built-ins should also help in the interoperation of SWRL with other Web formalisms by providing an extensible, modular built-ins infrastructure for Semantic Web Languages, Web Services, and Web applications.

While we suggest to have a top level distinction between the following two categories:

the SWRL language will only provide support for side-effect free built-ins.

Even though the taxonomy may appear to be quite large, users only need to load the relevant ones.

8.1. Built-Ins for Handling XML Data Types

Like in OWL, our approach is to integrate XML Schema Part 2: Datatypes and reuse operators and functions from XQuery 1.0 and XPath 2.0

8.2. Math Operators and Functions

The swrl presentation and XML/RDF syntax defines an abstraction layer on top of operators and functions. Comparison operators should be singled out as they return boolean values. They are defined as predicates in OWL.


Comparison predicates:

Built-In Functions:

8.3. Built-In Functions and Operators over Boolean Values

"fn:not" is a function built-in where fn:not(true) returns false and fn:not(false) returns true.

One operator and one function are proposed:

8.4. Built-In Functions on Strings

The following built-in functions are proposed:

8.5. Built-In Functions and Operators on Date, Time and Duration

The following set of built-ins is directly imported from XQuery. They are built-in operations on the date and time types as defined in XML Schema Part 2 Datatypes.

Details on each operation can be found here

Base Operators:

Accessors for Date, Time and Duration:

Advanced Built-In Operators

Advanced Built-In Functions

8.6. Built-In Functions for URIs

Here is a list of proposed operators and functions:

We are also adding a URI constructor from the individual components and a default base that, for example, would allow us to express the following:
         http://www.w3.org/* owl:sameAs http://www.w3c.org/*.

NOTE:QNames built-ins are left out in this release.

8.7. Built-Ins for Lists

There are three basic operators:

Built-ins functions for lists:

8.8. Built-ins for module handling

The following functions may be introduced to manipulate modules in SWRL:

8.9. Other Possible Built-Ins

This section focuses on built-ins extensions including, as listed below, various classes of built-ins, some of them outside the SWRL Kernel, and others are implementation and API level built-ins.

It could also be allowed to extend the Taxonomy by defining further built-ins on the level of the implementation language of the SWRL built-ins.

NOTE: Built-ins for sequences and nodes are not currently supported in SWRL. They can be left as optional for the specification implementations.