An XQuery Data Model Syntax for SWOL Here is a way of providing a syntax for the Semantic Web Ontology Language (SWOL). The document also indicates semantic conditions or mappings for the constructs, but this is not a semantics document. The specification uses the XQuery 1.0 and XPath 2.0 Data Model (henceforth Data Model) to define syntax. The process of creating the Data Model nodes that are used as input here is outside the scope of this document. However, it is expected that the normal method of creation will start with an XML document and proceed through XML parsing and XML Schema validation to produce one or more Data Model documents. These documents would then be analyzed to determine which other XML documents are needed, potentially requiring one or more extra rounds of parsing, validation, and analysis. Finally all non-relevant information, such as document nodes, would be removed. The final result of this pre-processing is a SWOL knowledge base (KB), in the form of an unordered collection of Data Model fragments, each of which has an element node as its root. Note: Throughout this document Data Model nodes will be given as if they were concrete data types with positional arguments. This is not how they are really defined, but makes the syntax much easier to present. The syntax of SWOL is then defined on these nodes. The only interesting and relevant nodes are ELEMENT nodes, which have a name, attributes, and children; ATTRIBUTE nodes, which have a name, a text value, and an optional type; and TEXT nodes, which have a text value and an optional type. Each non-root node has a implicit parent, which is shown as |parent|. The node itself is shown as |self|. Each node also has an expansion mapping for qualified names, Q. Unfortunately, XML is lacking in syntactic constructs, and thus the non-RDF parts of the syntax have to be distinguished by the presence of reserved words. As the syntactical constructions that use these reserved words often look like RDF constructs, this makes the grammar ambiguous. The intent, although it is not formally specified, is that the productions that involve descriptions have precedence over those that don't. Also, productions for RDF syntactical attributes (rdf:ID, rdf:about, and rdf:resource) have precedence over all other productions. Note: As of now, not all RDF abbreviated syntaxes are handled here. Note: The semantic conditions here require a slight addition to the semantics. An extended interpretation of a collection of fragments provides a mapping, I, from each ELEMENT node in the collection to R. Literal occurences are attribute nodes and text nodes. Note: The construction rdf:name refers to the QName with local part name and URI http://www.w3.org/1999/02/22-rdf-syntax-ns The construction rdfs:name refers to the QName with local part name and URI http://www.w3.org/???? The construction swol:name refers to the QName with local part name and URI http://www.w3.org/???? Syntax Semantic Conditions kb ::= resourceElement* resourceElement ::= ELEMENT(name,{propertyAttribute*},{propertyElement*}) I(|self|) in CEXT(I(name)) valueNode ::= TEXT(text,type) I(|self|) = LV(type)(text) | TEXT(text) I(|self|) in LV(text) propertyAttribute ::= ATTRIBUTE(rdf:ID,id) I(|parent|) = I(Q(id)) | ATTRIBUTE(rdf:about,id) I(|parent|) = I(Q(id)) | ATTRIBUTE(name,text) < I(|parent|) , I(|self|) > in EXT(I(name)) I(|self|) > in LV(text) | ATTRIBUTE(name,text,type) < I(|parent|) , I(|self|) > in EXT(I(name)) I(|self|) = LV(type)(text) propertyElement ::= ELEMENT(rdf:type,{},{desc}) I(|parent|) in ID(desc) | ELEMENT(rdfs:subClassOf,{},{desc}) ID(|parent|) <= ID(desc) | ELEMENT(swol:sameClassAs,{},{desc}) ID(|parent|) = ID(desc) | ELEMENT(swol:disjointFrom,{},{desc}) ID(|parent|) ^ ID(desc) = {} | ELEMENT(rdfs:domain,{},{desc}) IR(|parent|) <= ID(desc) x (RuV) | ELEMENT(rdfs:range,{},{desc}) IR(|parent|) <= R x IC(desc) | ELEMENT(name,{rdf:resource,id},{}) < I(|parent|),I(Q(id)) > in IR(name) | ELEMENT(name,{},{resourceElement}) < I(|parent|),I(resourceElement) > in IR(name) | ELEMENT(name,{},{valueNode}) < I(|parent|),I(valueNode) > in IR(name) Description Extension(ID) desc ::= ELEMENT(swol:Class,{ATTRIBUTE(rdf:about,id)}) CEXT(I(Q(id))) ^ R | ELEMENT(swol:Thing) R | ELEMENT(swol:Nothing) { } | ELEMENT(swol:unionOf,{desc+}) ID(desc1) v ... v ID(descn) | ELEMENT(swol:intersectionOf,{desc+}) ID(desc1) ^ ... ^ ID(descn) | ELEMENT(swol:complementOf,{desc}) r \ ID(desc) | ELEMENT(swol:oneOf,{resourceElement*}) { I(resourceElement1), ..., I(resourceElementn) } | ela(swol:toClass,swol:property=prop,swol:class=desc}) { x : in EXT(prop) implies y in CEXT(desc) } | ela(swol:hasValue,swol:property=prop,swol:value=obj}) { x : in EXT(prop) } | ela(swol:hasClass,swol:property=prop,swol:class=desc}) { x : exists y in EXT(prop) and y in CEXT(desc) } | ela(swol:minCardinality,swol:property=prop,swol:count=obj}) { x : >=obj y in EXT(prop) } | ela(swol:maxCardinality,swol:property=prop,swol:count=obj}) { x : <=obj y in EXT(prop) } | ela(swol:cardinality,swol:property=prop,swol:count=obj}) { x : =obj y in EXT(prop) } | ela(swol:minCardinality,swol:property=prop,swol:count=obj,swol:class=desc}) { x : >=obj y in EXT(prop) and y in CEXT(desc) } | ela(swol:maxCardinality,swol:property=prop,swol:count=obj,swol:class=desc}) { x : <=obj y in EXT(prop) and y in CEXT(desc) } | ela(swol:cardinality,swol:property=prop,swol:count=obj,swol:class=desc}) { x : =obj y in EXT(prop) and y in CEXT(desc) } prop ::= resourceElement obj ::= resourceElement | valueNode Shorthands: ela(name,arg=category,...) is a shorthand for ELEMENT(name,{ATTRIBUTE(argi,id), ATTRIBUTE(argi,text), ATTRIBUTE(argi,text,type), ...}, {ELEMENT(argi,{ATTRIBUTE(rdf:resource,id)}), ELEMENT(argi,{categoryi}), ...}) where each arg=category shows up in exactly one of the five ways above and no other attributes or children show up. Also the id versions are only for desc and prop, and the text versions are only for obj. The denotation and conditions for the five forms are: Syntactic Form Denotation Semantic Conditions ATTRIBUTE(argi,id) I(Q(id)) ATTRIBUTE(rdf:resource,id) I(Q(id)) ATTRIBUTE(argi,text) I(|self|) I(|self|) in LV(text) ATTRIBUTE(argi,text,value) I(|self|) I(|self|) = LV(type)(text) category I(category) References: XQuery 1.0 and XPath 2.0 Data Model (W3C Working Draft 7 June 2001) http://www.w3.org/TR/2001/WD-query-datamodel-2001-6-7/