W3C W3C Member Submission

OWLlink:
HTTP/S-Expression Binding

W3C Member Submission 1 July 2010

This version:
http://www.w3.org/Submission/2010/SUBM-owllink-httpsexpr-binding-20100701/
Latest version:
http://www.w3.org/Submission/owllink-httpsexpr-binding/
Author:
Michael Wessel, Racer Systems GmbH & Co. KG
Contributors: (in alphabetic order)
Thorsten Liebig, derivo GmbH (formerly Ulm University)
Marko Luther, DOCOMO Euro-Labs, Munich
Ralf Möller, Hamburg University of Technology
Olaf Noppens, derivo GmbH (formerly Ulm University)

Earlier drafts of the OWLlink specification have been published by the informal OWLlink working group at http://www.owllink.org.

This document is available under the W3C Document License. See the W3C Intellectual Rights Notice and Legal Disclaimers for additional information.


Abstract

The OWLlink interface provides an implementation-neutral mechanism for accessing OWL reasoner functionality. This document defines the OWLlink HTTP/S-Expression Binding as a syntactic variant of the [OWLlink HTTP/Functional Binding]. Its syntax is close to that of functional programming languages such as Common Lisp, which are still very popular implementation languages for OWL 2 reasoners and related tools. The S-Expression Binding can also be considered as a modern variant of the (nowadays slightly outdated) classic [KRSS Specification].

Status of this Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications can be found in the W3C technical reports index at http://www.w3.org/TR/.

This document is a part of the OWLllink Submission which comprises eight documents:

  1. OWLlink: Structural Specification
  2. OWLlink: HTTP/XML Binding
  3. OWLlink: HTTP/Functional Binding
  4. OWLlink: HTTP/S-Expression Binding (this document)
  5. OWLlink Extension: Retraction
  6. OWLlink Extension: Retraction HTTP/XML Binding
  7. OWLlink Extension: Retraction HTTP/Functional Binding
  8. OWLlink Extension: Retraction HTTP/S-Expression Binding

By publishing this document, W3C acknowledges that the Submitting Members have made a formal Submission request to W3C for discussion. Publication of this document by W3C indicates no endorsement of its content by W3C, nor that W3C has, is, or will be allocating any resources to the issues addressed by it. This document is not the product of a chartered W3C group, but is published as potential input to the W3C Process. A W3C Team Comment has been published in conjunction with this Member Submission. Publication of acknowledged Member Submissions at the W3C site is one of the benefits of W3C Membership. Please consult the requirements associated with Member Submissions of section 3.3 of the W3C Patent Policy. Please consult the complete list of acknowledged W3C Member Submissions.


Table of Contents


1. Preliminaries

This document presents an S-Expression syntax for OWLlink and thus a concrete syntax for OWLlink which is convenient for Lisp-based OWLlink implementations, e.g. [Common Lisp], acknowledging the fact that functional programming languages such as Common Lisp are still very popular implementation languages for OWL 2 reasoners and related tools. The OWLlink HTTP/S-Expression binding, or OWLlink S-Expression for short, can be seen as a syntactic variant of the [OWLlink HTTP/Functional Binding]. Moreover, the S-Expression binding could be considered as a modern variant of the (nowadays slightly outdated) classic [KRSS Specification]. S-Expressions can be directly consumed and produced by Lisp-like languages; thus, no further machinery is required to process these messages.

The OWLlink S-Expression binding, likewise to the OWLlink Functional binding, employs [HTTP/1.1] as the underlying transport protocol. As such, standard notions and features from the HTTP protocol apply (e.g., sessions, content encoding and compression, etc.), and are used in the HTTP 1.1 sense in this document.

The abstract set and syntax of OWLlink messages is specified in the [OWLlink Structural Specification] in terms of UML. The most important design criteria for the concrete S-Expression syntax specified in this document is Lisp-readabilty. This means that messages must be parsable by the Common Lisp function read without requiring additional frameworks or additional machinery such as XML parsers etc.

1.1 Example Request

To exemplify this, consider the following OWLlink message in the OWLlink HTTP/XML binding, which adds an OWL 2 ClassAssertion axiom to a freshly created knowledge base http://www.owllink.org/KB_1, and asks for the instances of the Father class:

<RequestMessage xmlns="http://www.owllink.org/owllink#" 
  xmlns:owl="http://www.w3.org/2002/07/owl#"
  xmlns:racer="http://www.racer-systems.com/owllink/ext/racer#"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.owllink.org/owllink#
    http://www.w3.org/Submission/2010/SUBM-owllink-httpxml-binding-20100701/owllink.xsd">
  <racer.FullReset/>
  <CreateKB kb="http://www.owllink.org/KB_1">
    <Prefix name="family" fullIRI="http://www.family.com/"/>
  </CreateKB>
  <Tell kb="http://www.owllink.org/KB_1">
    <owl:ClassAssertion>
      <owl:Class IRI="http://www.family.com/Father"/>
      <owl:NamedIndividual abbreviatedIRI="family:John"/>
    </owl:ClassAssertion>
  </Tell>
  <GetInstances kb="http://www.owllink.org/KB_1">
    <owl:Class abbreviatedIRI="family:Father"/>
  </GetInstances>
  <ReleaseKB kb="http://www.owllink.org/KB_1"/>
</RequestMessage>

This message takes the following form in the OWLlink S-Expression binding:

(NamespacePrefix () racer |http://www.racer-systems.com/owllink/ext/racer#|)
(RequestMessage ()
  (racer.FullReset ())
  (CreateKB (:kb |http://www.owllink.org/KB_1|)
    (Prefix (:name family :fullIRI |http://www.family.com/|)))
  (Tell (:kb |http://www.owllink.org/KB_1|)
    (ClassAssertion
      |http://www.family.com/Father|
      |family:John|))
  (GetInstances (:kb |http://www.owllink.org/KB_1|)
    |family:Father|)
  (ReleaseKB (:kb |http://www.owllink.org/KB_1|)))

1.2 Namespaces

Like in the [OWLlink HTTP/Functional Binding], the NamespacePrefix message is used in order to emulate XML namespaces.

1.3 Escaping and Attribute Handling

Since the OWL 2 functional-syntax for full URIs is unreadable by Lisp, the S-Expression binding uses simple symbols for the representation of URIs. In addition, an implementation should also accept strings for IRIs, for fullIRIs as well as for abbreviated IRIs, but only if they are used as attribute values and not at functor position (i.e., do not appear as the first element in a list or S-Expression).

According the Common Lisp syntax rules, all symbols which contain special, non-alphanumerical characters or whitespaces, e.g. the colon, whitespaces, period or hash quote etc., have to be enclosed in bars (character "|"). OWLlink messages are read in a case-sensitive mode. That is, (eq (readtable-case *readtable*) :preserve) is assumed when OWLlink S-Expression messages are consumed. This implies that no surrounding bars must be used for symbols such as GetInstances.

Another syntax problem regarding Lisp-readability is caused by the OWL2 functional syntax for owl.typedLiteral elements. Therefore, the S-Expression syntax for the typed literal "John Doe"^^xsd:string is (OWLLiteral "John Doe" "xsd:string").

Whenever the OWLlink specification accepts an (UML) argument of type string, either a Common Lisp string or a Common Lisp symbol may be used to ensure good human readabilty. Moreover, boolean arguments may be supplied as t and nil, as it is standard in Common Lisp.

As for the OWLlink Functional syntax, the standard namespace prefixes are assumed to be predefined (rdf, rdfs, xsd, owl, ol).

To specify arguments, a standard Common Lisp argument-passing style using a list of so-called keyword value pairs. Hence, OWLlink messages can be directly processed by Common Lisp macros (see Section 4 for implementation hints), which is a big benefit since no additional message parsers are required. The empty argument lists of OWL 2 elements like ClassAssertion is omitted. However, the omission of empty argument lists for OWLlink messages is prohibited to ensure backwards compatibilty of existing OWLlink messages in case additional arguments are added to future versions of these messages (otherwise, old messages would have to be rewritten to be acceptable by the extended OWLlink parser).

As for OWLlink Functional, implementors can reuse their existing OWL 2 functional-style parsers to parse OWLlink S-Expression terms by implementing some simple syntax transformations which are specified in Section 2.

1.4 Example Response

Consider the valid OWLlink XML/HTTP response to the request given above:

<ResponseMessage xmlns="http://www.owllink.org/owllink#" 
  xmlns:owl="http://www.w3.org/2002/07/owl#"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.owllink.org/owllink#
    http://www.w3.org/Submission/2010/SUBM-owllink-httpxml-binding-20100701/owllink.xsd">
  <OK/>
  <KB kb="http://www.owllink.org/KB_1"/>
  <OK/>
  <SetOfIndividualSynsets>
    <IndividualSynset>
      <owl:NamedIndividual abbreviatedIRI="family:John"/>
    </IndividualSynset>
  </SetOfIndividualSynsets>
  <OK/>
</ResponseMessage>

In OWLlink S-Expression, this message takes the following form:

(ResponseMessage
  (KB (:kb |http://www.owllink.org/KB_1|))
  (OK ())
  (SetOfIndividualSynsets ()
    (IndividualSynset () |family:John|))
  (OK ()))

The same syntax rules and conventions as for the request messages also apply for the response messages. The S-Expression response messages can easily be further processed by standard Common Lisp macros (see below), given the Common Lisp reader is set up properly (see Section 4).

2. S-Expression Binding

Whereas the syntax of the OWLlink Functional is readable, it is verbose and has the drawback that it cannot directly be processed by some functional programming languages such a Common Lisp. OWLlink S-Expression is designed in such a way that parsing and processing of the messages becomes straight forward in standard Lisp dialects such as Common Lisp, without requiring additional heavy-weight machinery or frameworks such as XML parsers, resulting also in a less verbose syntax.

To ensure the consumption of OWLlink messages in the S-Expression syntax by the Lisp function read, certain derivations from the standard OWL 2 functional-style syntax have to be accepted. For example, owl.fullIRIs must be specified as Common Lisp strings or as Common Lisp symbols enclosed in bars, e.g. <http://www.w3.org/2002/07/owl#ClassAssertion> is not readable by read and thus, if no abbreviated variant is used, either "http://www.w3.org/2002/07/owl#ClassAssertion" or |http://www.w3.org/2002/07/owl#ClassAssertion| have to be used instead. Whereas both strings and symbols are acceptable for such IRIs at argument or keyword value position in an S-Expression message, only the symbol representation is possible if IRIs are used at functor position, in order to ensure that such message can directly be used as function or macro calls. A standard Common Lisp argument-passing style is adopted. As a result of these design decissions, OWLlink message handlers ("parsers") can directly be implemented through simple Common Lisp macros (see Section 4 for implementation hints).

As in Section '2.2 XML Schema' [OWLlink HTTP/XML Binding], the concrete S-Expression syntax is given by specifying two syntax translation functions: T and AT. If i is a direct OWLlink instance (message) or OWL 2 instance (message) of type (UML class) c in the object graph, and i has attribute values v_1, ..., v_n for the attributes a_1, ..., a_n of types t_1, ..., t_n (n may be zero), and also has associations ac_1, ..., ac_m to further instances (messages) i_1, ..., i_m (m may be zero) of types c_1, ..., c_m (the ranges of the associations), and if i is itself possibly the source individual of some association ac (ac is nil in case i is a root individual of the object graph), then the concrete syntax of i is given by T(i,c,ac), where T is the translation function specified below. Note that, if i is a root node and thus c is either RequestMessage or a ResponseMessage, then the OWLlink functional-style concrete syntax is given by T(i,c,nil). In general, T(i,c,ac) is specified as follows (note that terminal content is specified in double quotes in this binding).

  1. If c is owl.IRI and ac is not nil, then T(i,c,ac) is given as
          ":IRI" i' 
        
    

    and i' is either a Common Lisp string or symbol. A symbol has to use the surrounding bars syntax (character "|") if the symbol contains non-alphanumeric characters or whitespaces. For mixed-case symbols, no enclosing bars are required since it is assumed that (eq (readtable-case *read-table*) :preserve) holds during reading of the OWLlink S-Expression message. More details on symbol and string syntax can be found in the [CLtL2].

  2. If c is owl.fullIRI, then T(i,c,ac) is given as
          ":"ac i' 
        
    

    and i' is rendered as in the previous case. Unlike in the OWL 2 functional-style syntax, IRIs are not enclosed in sharp parentheses (characters "<", ">").

  3. If c denotes an OWL 2 element / UML class (i.e., those prefixed with owl. in the [OWLlink Specification]), but not owl.FullIRI nor owl.IRI, then T(i,c,ac) is given as
          S(i')
        
    

    where i' is specified in the [OWL 2 Specification] and S(i') is the result of applying the following transformation function S to i', converting the functional message into an S-Expression in the obvious way:

  4. Otherwise, i is an OWLlink message. The result of T(i,c,ac) is thus
          "(" c' 
    
             "(" TA(v_1,a_1)
                    ... 
                 TA(v_n,a_n) 
             ")"
    
             T(i_1,c_1,ac_1) 
                   ...
             T(i_m,c_m,ac_m) 
          ")"
        
    

    where either c'=|nsprefix.postfix| if some namespace prefix nsprefix is defined for the namespace namespace such that c is the concatenation of namespace and postfix, or c' is |c| if no such namespace prefix nsprefix is declared, or the implementation does not support namespace prefixes. Moreover, if nsprefix is one of ol, rdf, rdfs, xsd, owl, then postfix may be used for c'. The same comments from item 5, Section '2 Functional Binding' [OWLlink HTTP/Functional Binding] apply regarding usage and declaration of namespace prefixes and scope of these declarations apply here. Only the syntax differs, since Common Lisp symbols containing periods have to be enclosed in bars (character "|"), and sharp parantheses may not be used.

    The same comments regarding the order of the associated / referenced instances i_1 ... t_m apply here. This order is specified in Section '2.2 XML Schema' [OWLlink HTTP/XML Binding] and adopted here.

    Again, TA is the attribute translation function. If v is an attribute value (e.g., the string "true") for attribute a (e.g., result) of type t (e.g., string), then TA(v,a) is specified as follows:

          ":"ac v' 
        
    

    and v' is thus either a Common Lisp string, integer, or boolean. The strings "true" and "false" may be used for the Common Lisp booleans t and nil as well. In all caes, the empty attribute list () is equivalent to nil.

The NamespacePrefix message takes the following form in the OWLlink S-Expression binding.

(NamespacePrefix () nsprefix fullIRI)

nsprefix is either a Common Lisp string or a symbol (which has to be enclosed in bars, character "|" in case it contains whitespaces or non-alphanumeric characters. Prefixes do not necessarily, but may end with colons. fullIRI is either a Common Lisp string or a symbol. The same conventions for specifying full IRIs as strings or symbols as already discussed above apply, as well as the comments regarding scope and standard namespace prefixes.

A set of rendering options may appear in the header of a RequestMessage, similar to the NamespacePrefix message. The syntax is the following:

(RenderingOption () renderingOption boolean)

where renderingOption is one of

and the boolean is specified either as a Common Lisp boolean (t, nil) or Common Lisp string ("true", "false").

These scope of these rendering options is the current OWLlink request-response pair and effects response generation. The effect of these switches is described as follows:

Since the S-Expression response is still verbose, it is possible to further strip down the verbosity by specifying a set of rendering options. For example, by putting

(RenderingOption () removeEmptyArgumentLists t)

(RenderingOption () flattenStructuringElements t)

(RenderingOption () simplifyAtomicMessages t)

in the header of the S-Expression request message, the following much less verbose and more Lisp-like result will be returned instead:

(ResponseMessage
  (KB (:kb |http://www.owllink.org/KB_1|))
  OK
  ((|family:John|))
  OK)

Note that rendering options are only available in OWLlink S-Expression, not in OWLlink Functional.

3. Examples

This Section present the example request and response messages from Section '4 Examples' [OWLlink HTTP/XML Binding] in S-Expression Syntax.

3.1 Introspecting Reasoner Capabilities

GetDescription request.

(RequestMessage ()
  (GetDescription ()))

GetDescription response.

(ResponseMessage ()
  (Description (:name "MyOwnReasoner")
    (ProtocolVersion (:major 1 :minor 0))
    (ReasonerVersion (:major 1 :minor 0 :build 0))
    (Setting (:key "selectedProfile")
      (OneOf (:type "xsd:string")
        (Literal (:value "OWL DL"))
        (Literal (:value "OWL 2 EL")))
      (Literal (:value "OWL 2 EL")))
    (Property (:key "appliedSemantics")
      (OneOf (:type "xsd:string")
        (Literal (:value "RDF-based")))
      (Literal (:value "RDF-based")))
    (Property (:key "supportedDatatypes")
      (List (:type "xsd:anyURI"))
      (Literal (:value "http://www.w3.org/2001/XMLSchema#long"))
      (Literal (:value "http://www.w3.org/2001/XMLSchema#int"))
      (Literal (:value "http://www.w3.org/2001/XMLSchema#nonPositiveInteger"))
      (Literal (:value "http://www.w3.org/2001/XMLSchema#nonNegativeInteger"))
      (Literal (:value "http://www.w3.org/2001/XMLSchema#short"))
      (Literal (:value "http://www.w3.org/2002/07/owl#real")))
    (Setting (:key "abbreviatesIRIs")
      (Datatype (:IRI |xsd:boolean|))
      (Literal (:value "true")))
    (Property (:key "ignoresAnnotations")
      (Datatype (:IRI |xsd:boolean|))
      (Literal (:value "true")))
    (Property (:key "ignoresDeclarations")
      (Datatype (:IRI |xsd:boolean|))
      (Literal (:value "true")))
    (Setting (:key "uniqueNameAssumption")
      (Datatype (:IRI |xsd:boolean|))
      (Literal (:value "true")))
    (SupportedExtension (:identifier "http://www.owllink.org/ext/retraction"))
    (SupportedExtension (:identifier "http://www.owllink.org/ext/told"))
    (PublicKB (:kb |http://www.owllink.org/examples/KB_1| :name "Test KB 1"))
    (PublicKB (:kb |http://www.owllink.org/examples/KB_2| :name "Test KB 2"))))

3.2 Creating Knowledge Bases

CreateKB request.

(RequestMessage ()
  (CreateKB (:kb |http://www.owllink.org/examples/KB_1|))
  (Tell (:kb |http://www.owllink.org/examples/KB_1|)
    (SubClassOf
      |http://www.owllink.org/examples/myOntology#A|
      |http://www.owllink.org/examples/myOntology#B|)
    (SubClassOf
      |http://www.owllink.org/examples/myOntology#B|
      |http://www.owllink.org/examples/myOntology#C|))
  (IsClassSatisfiable (:kb |http://www.owllink.org/examples/KB_1|)
    |http://www.owllink.org/examples/myOntology#A|)
  (ReleaseKB (:kb |http://www.owllink.org/examples/KB_1|)))

CreateKB response.

(ResponseMessage ()
  (KB (:kb |http://www.owllink.org/examples/KB_1|))
  (OK ())
  (BooleanResponse (:result "true"))
  (OK ()))

3.3 Retrieving Settings

GetSettings request.

(RequestMessage ()
  (CreateKB (:kb |http://www.owllink.org/examples/KB_1| :name "KB 1"))
  (GetSettings (:kb |http://www.owllink.org/examples/KB_1|))
  (ReleaseKB (:kb |http://www.owllink.org/examples/KB_1|)))

GetSettings response.

(ResponseMessage ()
  (KB (:kb |http://www.owllink.org/examples/KB_1|))
  (Settings ()
    (Setting (:key "selectedProfile")
      (OneOf (:type "xsd:string")
        (Literal (:value "OWL 2 QL"))
        (Literal (:value "OWL 2 RL")))
      (Literal (:value "OWL 2 RL")))
    (Setting (:key "abbreviatesIRIs")
      (Datatype (:type "xsd:boolean"))
      (Literal (:value "false"))))
  (OK ()))

3.4 Changing Settings

Set request.

(RequestMessage ()
  (CreateKB (:kb |http://www.owllink.org/examples/KB_1| :name "KB 1"))
  (Set (:kb |http://www.owllink.org/examples/KB_1| :key "abbreviatesIRIs")
    (Literal (:value "true")))
  (GetSettings (:kb |http://www.owllink.org/examples/KB_1|))
  (ReleaseKB (:kb |http://www.owllink.org/examples/KB_1|)))

Set response.

(ResponseMessage ()
  (KB (:kb |http://www.owllink.org/examples/KB_1|))
  (OK ())
  (Settings ()
    (Setting (:key "selectedProfile")
      (OneOf (:type "xsd:string")
        (Literal (:value "OWL 2 QL"))
        (Literal (:value "OWL 2 RL")))
      (Literal (:value "OWL 2 RL")))
    (Setting (:key "abbreviatesIRIs")
      (Datatype (:IRI "xsd:boolean"))
      (Literal (:value "true"))))
  (OK ()))

3.5 Declaring Prefixes

Prefix request.

(RequestMessage ()
  (CreateKB (:kb |http://www.owllink.org/examples/KB_2|)
    (Prefix (:name "test" :fullIRI |http://www.owllink.org/test/ont#|))
    (Prefix (:name "myOnt" :fullIRI |http://www.owllink.org/examples/myOntology#|)))
  (Tell (:kb |http://www.owllink.org/examples/KB_2|)
    (SubClassOf |test:A| |myOnt:A|))
  (Set (:kb |http://www.owllink.org/examples/KB_2| :key "abbreviatesIRIs")
    (Literal (:value "false")))
  (GetSubClasses (:kb |http://www.owllink.org/examples/KB_2| :direct "false")
    |http://www.owllink.org/examples/myOntology#A|)
  (GetSubClasses (:kb |http://www.owllink.org/examples/KB_2| :direct "false")
    |myOnt:A|)
  (Set (:kb |http://www.owllink.org/examples/KB_2| :key "abbreviatesIRIs")
    (Literal (:value "true")))
  (GetSubClasses (:kb |http://www.owllink.org/examples/KB_2| :direct "false")
    |http://www.owllink.org/examples/myOntology#A|)
  (GetSubClasses (:kb |http://www.owllink.org/examples/KB_2| :direct "false")
    A)
  (GetPrefixes (:kb |http://www.owllink.org/examples/KB_2|))
  (ReleaseKB (:kb |http://www.owllink.org/examples/KB_2|)))

Prefix response. Please note that the fourth GetSubclass request raises an error, since it refers to the unqualified class A which relies on the XML base xml:base="http://www.owllink.org/examples/myOntology#" in the corresponding HTTP/XML example. Since there is no such feature in the OWLlink S-Expression binding, A cannot be resolved to http://www.owllink.org/examples/myOntology#A.

(ResponseMessage ()
  (KB (:kb |http://www.owllink.org/examples/KB_2|))
  (OK ())
  (OK ())
  (SetOfClassSynsets ()
    (ClassSynset () |http://www.owllink.org/test/ont#A|)
    (ClassSynset () |http://www.w3.org/2002/07/owl#Nothing|))
  (SetOfClassSynsets ()
    (ClassSynset () |http://www.owllink.org/test/ont#A|)
    (ClassSynset () |http://www.w3.org/2002/07/owl#Nothing|))
  (OK ())
  (SetOfClassSynsets ()
    (ClassSynset () |test:A|)
    (ClassSynset () |owl:Nothing|))
  (SyntaxError (:error "A ist not a valid IRI."))
  (Prefixes ()
    (Prefix (:name "rdf" :fullIRI |http://www.w3.org/1999/02/22-rdf-syntax-ns#|))
    (Prefix (:name "rdfs" :fullIRI |http://www.w3.org/2000/01/rdf-schema#|))
    (Prefix (:name "xsd" :fullIRI |http://www.w3.org/2001/XMLSchema|))
    (Prefix (:name "owl" :fullIRI |http://www.w3.org/2002/07/owl#|))
    (Prefix (:name "test" :fullIRI |http://www.owllink.org/test/ont#|))
    (Prefix (:name "myOnt" :fullIRI |http://www.owllink.org/examples/myOntology#|)))
  (OK ()))

3.6 Loading Ontologies

LoadOntologies request.

(RequestMessage ()
  (CreateKB (:kb |http://www.owllink.org/examples/families|)
    (Prefix (:name "families" :fullIRI |http://example.com/owl/families/|))
    (Prefix (:name "otherOnt" :fullIRI |http://example.org/otherOntologies/families/|)))
  (LoadOntologies (:kb |http://www.owllink.org/examples/families|)
    (OntologyIRI (:IRI |http://www.owllink.org/ontologies/primer.owl|)))
  (GetInstances (:kb |http://www.owllink.org/examples/families|)
    |families:Person|)
  (GetTypes (:kb |http://www.owllink.org/examples/families| :direct "false")
    |families:John|)
  (Tell (:kb |http://www.owllink.org/examples/families|)
    (SubClassOf
      |families:HappyPerson|
      |families:Person|)
    (SubClassOf
      |otherOnt:ExcitedPerson|
      |families:HappyPerson|))
  (GetSuperClasses (:kb |http://www.owllink.org/examples/families| :direct "false")
    |otherOnt:ExcitedPerson|)
  (GetObjectPropertySources (:kb |http://www.owllink.org/examples/families|)
    |families:hasWife|
    |families:Mary|)
  (ReleaseKB (:kb |http://www.owllink.org/examples/families|)))

LoadOntologies response.

(ResponseMessage ()
  (KB (:kb |http://www.owllink.org/examples/families|))
  (OK ())
  (SetOfIndividualSynsets ()
    (IndividualSynset ()
      |families:Jack|)
    (IndividualSynset ()
      |families:Mary|
      |otherOnt:MaryBrown|)
    (IndividualSynset ()
      |families:John|
      |otherOnt:JohnBrown|))
  (ClassSynsets ()
    (ClassSynset ()
      |families:Father|)
    (ClassSynset ()
      |families:Man|)
    (ClassSynset ()
      |families:Human|
      |families:Person|)
    (ClassSynset ()
      |owl:Thing|
      |families:NarcisticPerson|)
    (ClassSynset ()
      |families:Parent|)
    (ClassSynset ()
      |families:MyBirthdayGuests|))
  (OK ())
  (SetOfClassSynsets ()
    (ClassSynset ()
      |families:HappyPerson|)
    (ClassSynset ()
      |families:Parent|)
    (ClassSynset ()
      |owl:Thing|
      |families:NarcisticPerson|)
    (ClassSynset ()
      |families:Human|
      |families:Person|))
  (SetOfIndividualSynsets ()
    (IndividualSynset ()
      |families:John|
      |otherOnt:JohnBrown|))
  (OK ()))

3.7 Pooling Requests

Pooling request.

(RequestMessage ()
  (CreateKB (:kb |http://www.owllink.org/examples/KB_1|))
  (Tell (:kb |http://www.owllink.org/examples/KB_1|)
    (SubClassOf
      |http://www.owllink.org/examples/myOntology#B|
      |http://www.owllink.org/examples/myOntology#A|)
    (SubClassOf
      |http://www.owllink.org/examples/myOntology#C|
      |http://www.owllink.org/examples/myOntology#A|)
    (EquivalentClasses
      |http://www.owllink.org/examples/myOntology#D|
      |http://www.owllink.org/examples/myOntology#E|)
    (ClassAssertion
      |http://www.owllink.org/examples/myOntology#A|
      |http://www.owllink.org/examples/myOntology#iA|)
    (SubClassOf
      |http://www.owllink.org/examples/myOntology#C|
      |http://www.owllink.org/examples/myOntology#A|))
  (GetAllClasses (:kb |http://www.owllink.org/examples/KB_1|))
  (GetEquivalentClasses (:kb |http://www.owllink.org/examples/KB_1|)
    |http://www.owllink.org/examples/myOntology#D|)
  (IsEntailedDirect (:kb |http://www.owllink.org/examples/KB_1|)
    (SubClassOf
      |owl:Thing|
      |owl:Nothing|))
  (GetSubClasses (:kb |http://www.owllink.org/examples/KB_1|)
    |http://www.owllink.org/examples/myOntology#C|)
  (CreateKB (:kb |http://www.owllink.org/examples/KB_2| :name "MyKB_2"))
  (Tell (:kb |http://www.owllink.org/examples/KB_2|)
    (SubClassOf
      |http://www.owllink.org/examples/myOntology#A|
      |http://www.owllink.org/examples/myOntology#B|))
  (ReleaseKB (:kb |http://www.owllink.org/examples/KB_2|))
  (ReleaseKB (:kb |http://www.owllink.org/examples/KB_1|))
  (GetAllClasses (:kb |http://www.owllink.org/examples/KB_1|)))

Pooling response.

(ResponseMessage ()
  (KB (:kb |http://www.owllink.org/examples/KB_1|))
  (OK (:warning "Duplicate axiom ignored"))
  (SetOfClasses ()
    |http://www.owllink.org/examples/myOntology#A|
    |http://www.owllink.org/examples/myOntology#B|
    |http://www.owllink.org/examples/myOntology#C|
    |http://www.owllink.org/examples/myOntology#D|
    |http://www.owllink.org/examples/myOntology#E|)
  (SetOfClasses ()
    |http://www.owllink.org/examples/myOntology#D|
    |http://www.owllink.org/examples/myOntology#E|)
  (BooleanResponse (:result "false"))
  (SetOfClassSynsets ()
    (ClassSynset () |owl:Nothing|))
  (KB (:kb |http://www.owllink.org/examples/KB_2|))
  (OK ())
  (OK ())
  (OK ())
  (KBError (:error "http://www.owllink.org/examples/KB_1 does not exist!")))

3.8 Retrieving Taxonomies

Taxonomy request.

(RequestMessage ()
  (CreateKB (:kb |http://www.owllink.org/examples/KB_1|))
  (CreateKB (:kb |http://www.owllink.org/examples/KB_2|))
  (Tell (:kb |http://www.owllink.org/examples/KB_2|)
    (SubClassOf
      |http://www.owllink.org/examples/myOntology#A|
      |owl:Thing|))
  (CreateKB (:kb |http://www.owllink.org/examples/KB_3|))
  (Tell (:kb |http://www.owllink.org/examples/KB_3|)
    (SubClassOf
      |http://www.owllink.org/examples/myOntology#A|
      |owl:Thing|)
    (SubClassOf
      |http://www.owllink.org/examples/myOntology#B|
      |http://www.owllink.org/examples/myOntology#A|)
    (SubClassOf
      |http://www.owllink.org/examples/myOntology#D|
      |http://www.owllink.org/examples/myOntology#A|))
  (CreateKB (:kb |http://www.owllink.org/examples/KB_4|))
  (Tell (:kb |http://www.owllink.org/examples/KB_4|)
    (EquivalentClasses
      |http://www.owllink.org/examples/myOntology#A|
      |owl:Thing|)
    (EquivalentClasses 
      |http://www.owllink.org/examples/myOntology#C|
      |owl:Nothing|)
    (SubClassOf
      |http://www.owllink.org/examples/myOntology#B|
      |owl:Thing|))
  (GetSubClassHierarchy (:kb |http://www.owllink.org/examples/KB_1|))
  (GetSubClassHierarchy (:kb |http://www.owllink.org/examples/KB_2|))
  (GetSubClassHierarchy (:kb |http://www.owllink.org/examples/KB_3|))
  (GetSubClassHierarchy (:kb |http://www.owllink.org/examples/KB_4|))
  (ReleaseKB (:kb |http://www.owllink.org/examples/KB_1|))
  (ReleaseKB (:kb |http://www.owllink.org/examples/KB_2|))
  (ReleaseKB (:kb |http://www.owllink.org/examples/KB_3|))
  (ReleaseKB (:kb |http://www.owllink.org/examples/KB_4|)))

Taxonomy response.

(ResponseMessage ()
  (KB (:kb |http://www.owllink.org/examples/KB_1|))
  (KB (:kb |http://www.owllink.org/examples/KB_2|))
  (OK ())
  (KB (:kb |http://www.owllink.org/examples/KB_3|))
  (OK ())
  (KB (:kb |http://www.owllink.org/examples/KB_4|))
  (OK ())
  (ClassHierarchy ()
    (ClassSynset ()
      |owl:Nothing|))
  (ClassHierarchy ()
    (ClassSynset () |owl:Nothing|)
    (ClassSubClassesPair ()
      (ClassSynset () |owl:Thing|)
      (SubClassSynsets ()
        (ClassSynset () |http://www.owllink.org/examples/myOntology#A|))))
  (ClassHierarchy ()
    (ClassSynset ()
      |owl:Nothing|)
    (ClassSubClassesPair ()
      (ClassSynset () |owl:Thing|)
      (SubClassSynsets ()
        (ClassSynset () |http://www.owllink.org/examples/myOntology#A|)))
    (ClassSubClassesPair ()
      (ClassSynset () |http://www.owllink.org/examples/myOntology#A|)
      (SubClassSynsets ()
        (ClassSynset () |http://www.owllink.org/examples/myOntology#B|)
        (ClassSynset () |http://www.owllink.org/examples/myOntology#D|))))
  (ClassHierarchy ()
    (ClassSynset ()
      |http://www.owllink.org/examples/myOntology#C|
      |owl:Nothing|)
    (ClassSubClassesPair ()
      (ClassSynset ()
        |http://www.owllink.org/examples/myOntology#A|
        |owl:Thing|)
      (SubClassSynsets ()
        (ClassSynset ()
          |http://www.owllink.org/examples/myOntology#B|))))
  (OK ())
  (OK ())
  (OK ())
  (OK ()))

4. Implementation Hints

This Section presents a small dummy Common Lisp implementation that is capable to parse and "process" a small OWLlink S-Expression example message. The example message to be processed is the following:

(NamespacePrefix () ret |http://www.owllink.org/ext/retraction|)
(RequestMessage () 
   (Tell (:kb "http://www.owllink.org/KB") ; note: URI as strings 
         (Prefix (:name "test" :fullIRI |http://www.test.org/|))
         (SubClassOf |test:A| |http://www.owllink.org.test/B|)
         (owl.SubClassOf "test:C" "http://www.owllink.org.test/D"))
   (ret.Retract (:kb |http://www.owllink.org/KB|) ;; note: URI as symbols
         (SubClassOf |test:A| |http://www.owllink.org.test/B|)))

The Common Lisp program given below produces the following output if applied to the above message, thus demonstrating that such messages can be processed with little effort in Lisp-like languages without requiring further heavy weight machinery (e.g., XML parsers):

(|http://www.owllink.org/owllink|::add-implies
   '|http://www.test.org/A| 
   '|http://www.owllink.org.test/B| 
   :kb
   '|http://www.owllink.org/KB|)

(|http://www.owllink.org/owllink|::add-implies
   '|http://www.test.org/C|
   '|http://www.owllink.org.test/D| 
   :kb
   '|http://www.owllink.org/KB|)

(|http://www.owllink.org/owllink|::forget-implies
   '|http://www.test.org/A| 
   '|http://www.owllink.org.test/B| 
   :kb
   '|http://www.owllink.org/KB|)
Here is the program, including some helpful comments. The programm assumes that the example message is stored under the filename "owllink-sexpr-test.lisp":
;;;
;;; Set up some Common Lisp packages 
;;; This package contains the main OWLlink implementation: 
;;; Namespaces correspond to Common Lisp packages
;;; in this implementation
;;; 

(defpackage |http://www.owllink.org/owllink|
  (:use :cl)
  (:nicknames |ol|)
  (:export "RequestMessage"
           "Tell"
           "Prefix"
           "NamespacePrefix"
           "name"
           "kb"
           "fullIRI"
           "owl.SubClassOf"))

;;; 
;;; All elements from OWL reside in this package: 
;;; 

(defpackage |http://www.w3.org/2002/07/owl|
  (:use :cl)
  (:nicknames |owl|)
  (:export "SubClassOf"))

;;; 
;;; Each OWLlink extension 
;;; resides in its own package: 
;;; 

(defpackage |http://www.owllink.org/ext/retraction|
  (:use :cl |ol|)
  (:nicknames |ret|)
  (:export "Retract"))

;;;
;;;
;;;

(in-package "ol")

(defvar *retraction* nil)
(defvar *kb* nil)
(defvar *kb-prefixes* nil)

(defun ensure-symbol (a)
  (if (symbolp a) a (intern (ensure-string a))))

(defun ensure-string (a)
  (if (stringp a) a (format nil "~A" a)))

;;;
;;; Helper functions for dealing with namespace prefixes: 
;;; 

(defun add-kb-prefix (|name| |fullIRI|)
  (let ((prefixes-for-kb
         (assoc *kb* *kb-prefixes*)))
    (if prefixes-for-kb
        (push (list (ensure-symbol |name|) |fullIRI|) (second prefixes-for-kb))
      (push (list *kb* (list (list (ensure-symbol |name|) |fullIRI|))) *kb-prefixes*)))
  nil)

(defun expand-prefix (prefix)
  (second 
   (assoc (ensure-symbol prefix)
          (second (assoc *kb* *kb-prefixes*)))))

(defun expand-name (a)
  (let* ((name (ensure-string a))
         (pos (position #\: name))
         (prefix
          (and pos
               (subseq name 0 pos)))
         (name
          (if pos
              (subseq name (1+ pos))
            name))
         (prefix 
          (expand-prefix prefix)))
    (ensure-symbol
     (if prefix
         (format nil "~A~A" 
                 prefix
                 name)
       a))))

(defun expand-expression (expr)
  (typecase expr
    ((or symbol string)
     (expand-name expr))
    (cons
     (mapcar #'expand-expression expr))
    (otherwise
     expr)))    

;;;
;;; The implementation of the reasoner's native
;;; API functions; for demonstration purpose, 
;;; only a simple output is generated
;;; 
  
(defun implies (a b)
  (if *retraction*
      (pprint `(forget-implies ',a ',b :kb ',*kb*))
    (pprint `(add-implies ',a ',b :kb ',*kb*))))

;;;
;;; Implementation of the OWLlink message handlers 
;;; Each OWLlink message handler / parser is defined 
;;; as a Common Lisp macro which delegates the work 
;;; to the appropriate reasoner API functions, e.g. 
;;; implies, racer-call, ...
;;; 

(defmacro |RequestMessage| (() &body body)
  `(progn ,@body))

(defmacro |Tell| ((&key |kb|) &body body)
  `(let ((*kb* ',(ensure-symbol |kb|)))
     ,@body))


(defmacro |CreateKB| ((&key |kb|) &body body)
  `(let ((*kb* ',(ensure-symbol |kb|)))
     ,@body))

(defmacro |Prefix| ((&key |name| |fullIRI|))
  (add-kb-prefix |name| |fullIRI|))

;;;
;;; Implementation of message handlers / parsers for 
;;; OWL 2 axioms. As mentioned, OWL 2 elements reside
;;; in the OWL package. However, all OWL 2 elements
;;; are also available directly in the OL package
;;; (with the exception of owl:Literal)
;;; 

(defmacro |owl|:|SubClassOf| (first second)
  `(implies ',(expand-expression first)
            ',(expand-expression second)))

;;; namespace convenience: 

(defmacro |SubClassOf| (first second)
  `(|owl|:|SubClassOf| ,first ,second))

(defmacro |owl.SubClassOf| (first second)
  `(|owl|:|SubClassOf| ,first ,second))

;;;
;;; Implementation of the message handlers / parser
;;; for OWLlink extensions: 
;;; 

(defmacro |ret|:|Retract| ((&key |kb|) &body body)
  `(let ((*kb* ',(ensure-symbol |kb|))
         (*retraction* t))
     ,@body))

;;;
;;; Implementation of the NameSpace prefix mechanism. 
;;; Since namespaces correspond to Common Lisp
;;; packages here, a namespace prefix declaration
;;;       (NamespacePrefix nil <prefix> <ns>) 
;;; simply ensure that all external symbols <sym> from 
;;; the package <ns> can be accessed from the the 
;;; current package *package* as <prefix>.<sym>
;;; 

(defun add-package-nickname (name nickname)
  (let ((p (find-package name)))
    (loop for s1 being the external-symbols in p 
          do 
          (let ((s2 (intern (format nil "~A.~A" nickname s1))))
            (if (macro-function s1)
                (setf (macro-function s2) 
                      (macro-function s1))
              (setf (macro-function s2) 
                    (macro-function s1)))))))

(defmacro |NamespacePrefix| (() a b)
  (add-package-nickname b a))

;;;
;;; Set up the reader for processing an 
;;; OWLlink S-Expression message. 
;;; Due to the NamespacePrefix mechanism, each 
;;; Request ist evaluted by binding *package* to 
;;; a temporary package. This is not necessarily 
;;; efficent. 
;;; 

(defvar *owllink-readtable* (copy-readtable *readtable*))

(setf (readtable-case *owllink-readtable*) :preserve)

(unwind-protect 
    (let ((package
           (make-package (gensym)
                         :use '("ol" "owl"))))
    (let ((*package* package)
          (*readtable* *owllink-readtable*))
      (load "owllink-sexpr-test.lisp"))
    (delete-package package)))

5. References

[OWL 2 Specification]
OWL 2 Web Ontology Language: Structural Specification and Functional-Style Syntax Boris Motik, Peter F. Patel-Schneider, Bijan Parsia, eds. W3C Recommendation, 27 October 2009, http://www.w3.org/TR/2009/REC-owl2-syntax-20091027/. Latest version available at http://www.w3.org/TR/owl2-syntax/.
[OWLlink Structural Specification]
OWLlink: Structural Specification Document included in the present W3C Member Submission.
[OWLlink HTTP/XML Binding]
OWLlink: HTTP/XML Binding Document included in the present W3C Member Submission.
[OWLlink HTTP/Functional Binding]
OWLlink: HTTP/Functional Binding Document included in the present W3C Member Submission.
[KRSS Specification]
Description-Logic Knowledge Representation System Specification from the KRSS Group of the ARPA Knowledge Sharing Effort by Peter F. Patel-Schneider and Bill Swartout, 1993, AI Principles Research Department, AT&T Bell Laboratories
[CLtL2]
Common Lisp the Language, 2nd Edition by Guy L. Steele et al., Thinking Machines, Inc., Digital Press, 1990, http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/clm.html.
[HTTP/1.1]
Hypertext Transfer Protocol – HTTP/1.1, Request for Comments 2616. R. Fielding, J. Gettys, J. Mogul, H. Frystyk, L. Masinter, P. Leach, and T. Berners-Lee.