The r3 Servlet already includes several component languages. All these languages are implemented using the r3 development library. The most relevant languages are the ones that integrate the Prova, Protune, XChange and Xcerpt languages. The definition of the component languages listed here is currently being revised and will change in the near future. Here are a few pointers for the OWL ontologies (and Java classes) that currently define (and implement) these languages together with a short description and examples. You will find some additional information about other languages (not included in the r3 package) in the development page.
Below you will find a brief overview of the support offered by each of these languages (viz. evolp, http, protune, prova, util, xcerpt, xchange, xpath, xquery, xslt), together with some examples.
The evolp Language supplied together with the r3 prototype defines, among other, functors to initialize a rulebase (setProgram), make it evolve (addEvent), ask if a goal holdsInSome (or holdsInAll) models, and reset the rulebase.
You may find some examples of this language below:
<Evaluate
xmlns="http://rewerse.net/I5/NS/2006/r3#"
xml:base="http://rewerse.net/I5/NS/2006/r3/eval/evolp"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<solve>
<Expression><is rdf:resource="#setProgram"/>
<having>
<Parameter><is rdf:resource="#program"/>
<literal rdf:parseType="Literal">
d(1). d(2).
a(1, bam, bang).
a(X, 2, 3) :- d(X), not b(f(X), X, bla).
b(f(X), X, bla) :- d(X), not a(X, 2, 3).
</literal>
</Parameter>
</having>
</Expression>
</solve>
</Evaluate>
<Evaluate
xmlns="http://rewerse.net/I5/NS/2006/r3#"
xml:base="http://rewerse.net/I5/NS/2006/r3/eval/evolp"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<solve>
<Expression><is rdf:resource="#addEvent"/>
<having>
<Parameter><is rdf:resource="#event"/>
<literal rdf:parseType="Literal">
assert(e(X) :-) :- d(X).
</literal>
</Parameter>
</having>
</Expression>
</solve>
</Evaluate>
<Evaluate>
<Expression><is rdf:resource="#holdsInSome"/>
<having>
<Parameter><is rdf:resource="#atom"/>
<literal rdf:parseType="Literal">b(X, Y, Z)</literal>
</Parameter>
</having>
</Expression>
</solve>
<using>
<Substitution>
<binding><Variable><name>X</name></Variable></binding>
<binding><Variable><name>Y</name></Variable></binding>
<binding><Variable><name>Z</name></Variable></binding>
</Substitution>
</using>
</Evaluate>
<Evaluate
xmlns="http://rewerse.net/I5/NS/2006/r3#"
xml:base="http://rewerse.net/I5/NS/2006/r3/eval/evolp"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:log="http://www.semwebtech.org/lang/2006/logic">
<solve>
<Expression><is rdf:resource="#holdsInAll"/>
<having>
<Parameter><is rdf:resource="#atom"/>
<literal rdf:parseType="Literal">a(X, Y, Z)</literal>
</Parameter>
</having>
</Expression>
</solve>
<using>
<Substitution>
<binding><Variable><name>X</name></Variable></binding>
<binding><Variable><name>Y</name></Variable></binding>
<binding><Variable><name>Z</name></Variable></binding>
</Substitution>
</using>
</Evaluate>
<Evaluate
xmlns="http://rewerse.net/I5/NS/2006/r3#"
xml:base="http://rewerse.net/I5/NS/2006/r3/eval/evolp"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:log="http://www.semwebtech.org/lang/2006/logic">
<solve>
<Expression><is rdf:resource="#holdsInAll"/>
<having>
<Parameter><is rdf:resource="#atom"/>
<literal rdf:parseType="Literal">e(1)</literal>
</Parameter>
</having>
</Expression>
</solve>
</Evaluate>
<Evaluate
xmlns="http://rewerse.net/I5/NS/2006/r3#"
xml:base="http://rewerse.net/I5/NS/2006/r3/eval/evolp"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<solve>
<Expression><is rdf:resource="#reset"/></Expression>
</solve>
</Evaluate>
The http Language defines a set of Functors, viz. get, post, put and delete. Any of these constructs uses an absolute request uri and binds a response status and status-reason. Additionally each of put and post uses a literal body. Only textual (viz. text/*) and XML application (viz. application/xml, application/*+xml) response content-types are supported and the response body is returned after being converted into an XML fragment according to the actual content-type (e.g. text/plain and text/html yield an XML text node). Any other response content-type is taken as an error, pretty much like failing to establish a connection or getting an HTTP response status not in the ok (2xx) range (with the exception of "Not Found"/404 and "Gone"/410 that are considered a failure, returning an empty set of results). The extension of these Functors so that each of them binds a set of parameters relating to (the most common) HTTP headers, is being considered (actually, e.g., post already binds a soapaction).
For any of the above constructs, there exists a similar OpaqueConstruct (with the same name prefixed with a `v') that, instead of using a uri, digs a vuri. For these OpaqueConstructs, variables may also be used as URI query parameters (if renamed to properly URI encoded strings prefixed with a non-encoded `=', variable values must not be encoded); or bound to request/response HTTP headers (if renamed to strings that are valid HTTP headers with the addition of a `:' prefix). Unbound query parameters are included in the query without the equal character. Unbound headers are omitted in the request, and bound if present in the response. Bound headers are included in the request and checked (if present) in the response. Beware when using bound general headers (or entity headers in a POST) since these relate to a specific HTTP message (or entity body) and may have different values in the request and in the response causing the construct to fail.
Also available is an opaque construct that digs a literal HTTP request (any included HTTP version is ignored) and binds a response status, status-reason and status-class (status-class is the first digit of status). This construct does not deal with any redirections (3xx), it succeeds for any response status (contrary to the others that only succeed for 2xx response status) and fails if it is not possible to establish a connection or if an invalid response content-type is returned. It uses variables in the same way the other OpaqueConstructs do.
Under consideration is a transform Operator that takes a source body (instead of a literal body), having a behaviour similar to the post and put constructs (to distinguish between them it uses a method parameter: POST, by omission, or PUT). Additionally, a modified uri event (with an optional poll interval) and a modified-since test are also being considered.
You may find some examples of this language below:
<Evaluate
xmlns="http://rewerse.net/I5/NS/2006/r3#"
xml:base="http://rewerse.net/I5/NS/r3/2005/eval/http"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<issuer><Client/></issuer>
<solve><Expression><is rdf:resource="#opaque"/>
<having><Parameter>
<is rdf:resource="#status"/>
<boundTo>Status</boundTo>
</Parameter></having>
<having><Parameter><is rdf:resource="#status-class"/>
<boundTo>StatusClass</boundTo>
</Parameter></having>
<having><Parameter><is rdf:resource="#status-reason"/>
<boundTo>StatusReason</boundTo>
</Parameter></having>
<having><Parameter><is rdf:resource="#literal"/>
<literal rdf:parseType="Literal">
POST http://di150.di.fct.unl.pt:15080/r3/service/prova HTTP/1.1 content-type: text/xml
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body> <request xmlns=""
xmlns:log="http://www.semwebtech.org/lang/2006/logic">
<subject>http://dummy.nop/ddd/solve</subject>
<opaque>a(X,Y)</opaque>
<log:variable-bindings>
<log:tuple>
<log:variable name="X" />
<log:variable name="Y" />
</log:tuple>
</log:variable-bindings>
</request> </soapenv:Body> </soapenv:Envelope>
</literal>
</Parameter></having>
</Expression></solve>
<using><Substitution>
<binding><Variable>
<name>SOAPAction</name><rename>:SOAPAction</rename>
<literal rdf:parseType="Literal"
>"http://rewerse.net/I5/NS/2006/r3#Evaluate"</literal>
</Variable></binding>
<binding><Variable>
<name>Type</name><rename>:Content-Type</rename>
</Variable></binding>
<binding><Variable>
<name>Length</name><rename>:Content-Length</rename>
</Variable></binding>
<binding><Variable><name>Status</name></Variable></binding>
<binding><Variable><name>StatusClass</name></Variable></binding>
<binding><Variable><name>StatusReason</name></Variable></binding>
</Substitution></using>
</Evaluate>
<Evaluate
rdf:about="http://dummy.nop/queries/efetch"
xmlns="http://rewerse.net/I5/NS/2006/r3#"
xml:base="http://rewerse.net/I5/NS/r3/2005/eval/http"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<solve><Expression><is rdf:resource="#vget" />
<with><BoundVariable><name>ID</name><rename>=id</rename></BoundVariable></with>
<with><BoundVariable><name>RT</name><rename>=rettype</rename></BoundVariable></with>
<with><Variable><name>st</name></Variable></with>
<with><Variable><name>tp</name></Variable></with>
<having><Parameter><is rdf:resource="#vuri" />
<literal rdf:parseType="Literal"
>http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed</literal>
</Parameter></having>
<having><Parameter><is rdf:resource="#status" />
<boundTo>st</boundTo>
</Parameter></having>
<having><Parameter><is rdf:resource="#content-type" />
<boundTo>tp</boundTo>
</Parameter></having>
</Expression></solve>
<using><Substitution>
<binding><Variable><name>ID</name><rename>=id</rename>
<literal>17727721</literal></Variable></binding>
<binding><Variable><name>RT</name><rename>=rettype</rename>
<literal>abstract</literal></Variable></binding>
<binding><Variable><name>RM</name><rename>=retmode</rename>
<literal>text</literal></Variable></binding>
<binding><Variable><name>st</name></Variable></binding>
<binding><Variable><name>tp</name></Variable></binding>
</Substitution></using>
<using><Substitution>
<binding><Variable><name>ID</name><rename>=id</rename>
<literal>15980585</literal></Variable></binding>
<binding><Variable><name>RT</name><rename>=rettype</rename>
<literal>citation</literal></Variable></binding>
<binding><Variable><name>RM</name><rename>=retmode</rename>
<literal>text</literal></Variable></binding>
<binding><Variable><name>st</name></Variable></binding>
<binding><Variable><name>tp</name></Variable></binding>
</Substitution></using>
</Evaluate>
The protune Language supplied together with the r3 prototype defines a native rule construct that digs a literal policy (i.e. a Protune rule(set)); a reset functor that clears all loaded policies; and an opaque construct that digs a literal Protune goal (and succeeds or fails accordingly).
Optionally any of the previous constructs has a peer parameter that if present has the form alias@host:port (otherwise it is empty corresponding to the default local peer). The opaque construct performs a 'simple' negotiation, unless the negotiation parameter is explicitly provided with a 'full' value.
You may find some examples of this language below:
<Evaluate
xmlns="http://rewerse.net/I5/NS/2006/r3#"
xml:base="http://net.rewerse/I5/NS/2006/r3/eval/protune"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<solve>
<Expression>
<is rdf:resource="#reset"/>
</Expression>
</solve>
<issuer>
<Client/>
</issuer>
</Evaluate>
<register xmlns:eca="http://www.semwebtech.org/eca/2006/eca-ml">
<subject>http://dummy.nop/rules/local</subject>
<eca:rule><eca:opaque lang="http://net.rewerse/I5/NS/2006/r3/eval/protune#protune">
PREFIX l3s : <http://www.L3S.de/policyFramework#>
execute(xraprov).
execute(xraprov)->explanation:"Predicate \"execute\".".
xraprov->type:provisional.
xraprov->ontology:{l3s:DummyAction}.
xralog(1).
xralog(2).
xralog(X)->explanation:"Predicate \"xralog\".".
xralog(X)->sensitivity:public.
</eca:opaque></eca:rule>
</register>
<Evaluate
xmlns="http://rewerse.net/I5/NS/2006/r3#"
xml:base="http://net.rewerse/I5/NS/2006/r3/eval/protune"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<solve>
<Expression><is rdf:resource="#opaque"/>
<having>
<Parameter><is rdf:resource="#peer"/>
<literal></literal>
</Parameter>
</having>
<having>
<Parameter><is rdf:resource="#literal"/>
<boundTo>G</boundTo>
</Parameter>
</having>
</Expression>
</solve>
<using><Substitution><binding><Variable><name>G</name>
<literal>execute(xraprov)</literal>
</Variable></binding></Substitution></using>
<using><Substitution><binding><Variable><name>G</name>
<literal>execute(xraunk)</literal>
</Variable></binding></Substitution></using>
<using><Substitution><binding><Variable><name>G</name>
<literal>xralog(1)</literal>
</Variable></binding></Substitution></using>
<using><Substitution><binding><Variable><name>G</name>
<literal>xralog(2)</literal>
</Variable></binding></Substitution></using>
<using><Substitution><binding><Variable><name>G</name>
<literal>xralog(3)</literal>
</Variable></binding></Substitution></using>
<using><Substitution><binding><Variable><name>G</name>
<literal>xralog(X)</literal>
</Variable></binding></Substitution></using>
<issuer>
<Client/>
</issuer>
</Evaluate>
The prova Language included in the r3 prototype defines a native construct that digs a literal Prova rule; and an opaque construct that digs a literal Prova goal and generates all the possible bindings (for the involved variables) satisfying the given goal. Variable values are represented as XML elements/documents, when appropriate, or as string values (for what is worth, it should be mentioned that several problems remain unresolved relating to the representation of numbers vs. strings, and also that quotes -single or double- in Prova strings must be balanced and have no escape mechanism).
Any of these prova constructs uses a rulesdb that identifies a particular rulebase (viz. Prova shell) to be used (empty by omission, denoting a default one; if given, it may be an URL to be retrieved for initialization of the rulebase).
No asynchronous functionality is currently provided, but Functors for rcvMsg and sendMsg are under consideration (actually Functors rcvMsg and sendMsg are implemented but restricted to using the Prova self protocol, which does not allow remote messages).
You may find some examples of this language below:
<register>
<subject>http://dummy.nop/ddd/1</subject>
<opaque>
a('1',bbb).
a(2,aaa).
a(3,bbb).
</opaque>
</register>
<request xmlns:log="http://www.semwebtech.org/lang/2006/logic">
<subject>http://dummy.nop/ddd/solve</subject>
<opaque>a(X,Y)</opaque>
<log:variable-bindings>
<log:tuple>
<log:variable name="X" />
<log:variable name="Y" />
</log:tuple>
</log:variable-bindings>
</request>
<deregister>
<subject>http://dummy.nop/ddd/1</subject>
</deregister>
<request xmlns:log="http://www.semwebtech.org/lang/2006/logic">
<subject>http://dummy.nop/ddd/solve</subject>
<Expression
xmlns="http://rewerse.net/I5/NS/2006/r3#"
xml:base="http://rewerse.net/I5/NS/r3/2005/eval/prova"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<is rdf:resource="#opaque" />
<having><Parameter>
<is rdf:resource="#rulesdb" />
<literal>http://rewerse.net/I5/r3/TST/templates.prova</literal>
</Parameter></having>
<having><Parameter>
<is rdf:resource="#literal" />
<literal>a(X)</literal>
</Parameter></having>
</Expression>
<log:variable-bindings>
<log:tuple>
<log:variable name="X" />
</log:tuple>
</log:variable-bindings>
</request>
The xcerpt Language defines a native construct that digs a literal Xcerpt rule; and an opaque construct that digs a literal Xcerpt query (trivially succeeds, if empty) producing several variable bindings. Any of these constructs uses a rulesdb that identifies a particular rulebase to be used (empty by omission, denoting a default one; if given, it may be an URL to be retrieved for initialization of the rulebase).
Additionally opaque uses an Xcerpt construct term to build and return a result for each produced tuple (empty by omission, in which case nothing is returned), and two additional Functors are also available to obtain the Xcerpt term or program corresponding to a given XML document.
Finally, two other constructs are currently under consideration: an eval Aggregator that uses an Xcerpt construct term to build the aggregated result based on the involved variables (if omitted, a tupleset of tuples with the aggregated variables could be returned, for each group); and a transform Operator similar to the opaque construct, but that instead of evaluating a literal query against a rulebase, takes a source Argument and uses an Xcerpt match pattern to filter it (trivially succeeding, if empty) and possibly produce additional variable bindings (an Xcerpt construct term may also be provided to specify a transformation of the source to be returned, defaults to identity).
For further information concerning the installation of the Xcerpt server, please consult the r3 installation page.
You may find some examples of this language below:
<register>
<subject>http://dummy.nop/xcerpt/bib</subject>
<opaque>
CONSTRUCT
bib [
book [
title [ "Dummy33" ],
price [ "33" ]
],
book [
title [ "Dummy44" ],
price [ "44" ]
],
book [
title [ "Dummy55" ],
price [ "55" ]
]
]
END
</opaque>
</register>
<register>
<subject>http://dummy.nop/xcerpt/rev</subject>
<opaque>
CONSTRUCT
reviews [
entry [
title [ "Dummy33" ],
price [ "66" ]
]
]
END
</opaque>
</register>
<request xmlns:log="http://www.semwebtech.org/lang/2006/logic">
<subject>http://dummy.nop/xcerpt?ex=00</subject>
<opaque>
and {
bib {{
book {{
title { var T },
price { var Pa }
}}
}}
,
reviews {{
entry {{
title { var T },
price { var Pb }
}}
}}
}
</opaque>
<log:variable-bindings>
<log:tuple>
<log:variable name="T" />
<log:variable name="Pa" />
<log:variable name="Pb" />
</log:tuple>
</log:variable-bindings>
</request>
<deregister>
<subject>http://dummy.nop/xcerpt/bib</subject>
</deregister>
<deregister>
<subject>http://dummy.nop/xcerpt/rev</subject>
</deregister>
<request xmlns:log="http://www.semwebtech.org/lang/2006/logic">
<subject>http://dummy.nop/xcerpt?ex=01</subject>
<opaque>
in {
resource {"file:bib.xml"},
bib {{
book {{
title { var T },
price { var Pa }
}}
}}
}
</opaque>
<log:variable-bindings>
<log:tuple>
<log:variable name="T" />
<log:variable name="Pa" />
</log:tuple>
</log:variable-bindings>
</request>
<request xmlns:log="http://www.semwebtech.org/lang/2006/logic">
<subject>http://dummy.nop/xcerpt?ex=4</subject>
<Expression
xmlns="http://rewerse.net/I5/NS/2006/r3#"
xml:base="http://rewerse.net/I5/NS/r3/2005/eval/xcerpt"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<is rdf:resource="#opaque" />
<having><Parameter>
<is rdf:resource="#rulesdb" />
<literal>http://rewerse.net/I5/r3/TST/templates.xcerpt</literal>
</Parameter></having>
<having><Parameter>
<is rdf:resource="#construct" />
<literal>
book [
title [ var Title ],
price-a [ var PriceA ],
optional price-b [ var PriceB ]
]
</literal>
</Parameter></having>
<having><Parameter>
<is rdf:resource="#literal" />
<literal>
or {
bib {{
book {{
title { var Title },
price { var PriceA }
}}
}}
,
books-with-prices [[
book-with-prices [
title [ var Title ],
price-a [ var PriceA ],
price-b [ var PriceB ]
]
]]
}
</literal>
</Parameter></having>
</Expression>
<log:variable-bindings>
<log:tuple>
<log:variable name="Title" />
<log:variable name="PriceA" />
<log:variable name="PriceB" />
</log:tuple>
</log:variable-bindings>
</request>
<request xmlns:log="http://www.semwebtech.org/lang/2006/logic">
<subject>http://dummy.nop/xcerpt?ex=5</subject>
<opaque>
in {
resource {"http://rewerse.net/I5/r3/TST/templates.xml"},
templates {{
group {{
attributes {{ name { var G } }},
description { var GD },
template {{
attributes {{ name { var T } }},
description { var TD }
}}
}}
}}
}
</opaque>
<log:variable-bindings>
<log:tuple>
<log:variable name="G" />
<log:variable name="T" />
</log:tuple>
</log:variable-bindings>
</request>
The xchange component Language defines a native construct that digs a literal XChange rule; a detect/on OpaqueConstruct that digs an XChange event/query (event is the XChange body of an atomic query) and signals any events matching it; a raise Functor that uses a recipient and an event body to generate an XChange event (if recipient is omitted it generates a local event); and an execute OpaqueConstruct that digs an XChange transaction and executes it.
Alternatively, mainly for compatibility with ECA-ML, it is also available an opaque construct that digs a literal. This literal may stand for a detect, raise or execute using for this purpose a syntax similar to XChange rules (starting with a line containing ON, RAISE or TRANSACTION, respectively; containing the appropriate XChange term; and ending with a line containing END).
It should be stressed that all these ExpressionConstructs (even if they are only action related, e.g. execute) return their results asynchronously, and so any xchange Client must always provide a notifyTo Interface in order to receive any possible results.
For further information concerning the installation of the XChange server, please consult the r3 installation page.
You may find some examples of this language below:
<register>
<subject>http://dummy.nop/xchange/1</subject>
<opaque>
RAISE
"xchange":event {{
"xchange":recipient { "http://localhost:4711" },
blablub { got { var X }, "in" { var Y } }
}}
ON
var Y -> "xchange":event {{
blablub { var X }
}}
END
</opaque>
</register>
<deregister>
<subject>http://dummy.nop/xchange/1</subject>
</deregister>
<Evaluate
xmlns="http://rewerse.net/I5/NS/2006/r3#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xml:base="http://rewerse.net/I5/NS/r3/2005/eval/xchange"
rdf:about="http://dummy.nop/xchange?id=detect">
<solve><Expression><is rdf:resource="#detect" />
<having><Parameter><is rdf:resource="#query" />
<literal rdf:parseType="Literal">
"xchange":event {{
blablub {{ }}
}}
</literal>
</Parameter></having>
</Expression></solve>
<issuer><Client><notifyTo><Interface>
<target
>http://localhost:8080/r3/service/dumpster</target>
</Interface></notifyTo></Client></issuer>
</Evaluate>
<deregister>
<subject>http://dummy.nop/xchange?id=detect</subject>
</deregister>
<request xmlns:log="http://www.semwebtech.org/lang/2006/logic">
<subject>http://dummy.nop/xchange?id=detect2</subject>
<reply-to>http://localhost:8080/r3/service/dumpster</reply-to>
<opaque>
ON
andthen [
"xchange":event {{
var Ev1 -> blablub {{ }}
}},
"xchange":event {{
var Ev2 -> blablub {{ }}
}}
]
END
</opaque>
<log:variable-bindings>
<log:tuple>
<log:variable name="Ev1"/>
<log:variable name="Ev2"/>
</log:tuple>
</log:variable-bindings>
</request>
<deregister>
<subject>http://dummy.nop/xchange?id=detect2</subject>
</deregister>
<Evaluate
xmlns="http://rewerse.net/I5/NS/2006/r3#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xml:base="http://rewerse.net/I5/NS/r3/2005/eval/xchange"
rdf:about="http://dummy.nop/xchange?id=theevent">
<solve><Expression><is rdf:resource="#raise" />
<having><Parameter><is rdf:resource="#event" />
<literal rdf:parseType="Literal"
>blablub { "o tal do xxx" }</literal>
</Parameter></having>
</Expression></solve>
<issuer><Client><notifyTo><Interface>
<target
>http://localhost:8080/r3/service/dumpster</target>
</Interface></notifyTo></Client></issuer>
</Evaluate>
<Evaluate
xmlns="http://rewerse.net/I5/NS/2006/r3#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xml:base="http://rewerse.net/I5/NS/r3/2005/eval/xchange"
rdf:about="http://dummy.nop/xchange?id=prxevent">
<solve><Expression><is rdf:resource="#raise" />
<having><Parameter><is rdf:resource="#event" />
<literal rdf:parseType="Literal"
>blablub { "o tal do xxx" }</literal>
</Parameter></having>
</Expression></solve>
<issuer><Client><notifyTo><Interface>
<target
>http://localhost:8080/r3/service/dumpster</target>
</Interface></notifyTo></Client></issuer>
</Evaluate>
<request xmlns:log="http://www.semwebtech.org/lang/2006/logic">
<subject>http://dummy.nop/xchange?id=mlevent</subject>
<reply-to>http://localhost:8080/r3/service/dumpster</reply-to>
<opaque>
RAISE
"xchange":event {{
"xchange":recipient { "http://localhost:4711" },
blablub { var X }
}}
END
</opaque>
<log:variable-bindings>
<log:tuple>
<log:variable name="X">o tal do zzz</log:variable>
</log:tuple>
</log:variable-bindings>
</request>
<request xmlns:log="http://www.semwebtech.org/lang/2006/logic">
<subject>http://dummy.nop/xchange?id=upd</subject>
<reply-to>http://localhost:8080/r3/service/dumpster</reply-to>
<opaque>
TRANSACTION
or [
in { resource {"file:travel5.xml"},
travel {{
delete train {{ name{var X} }},
insert name{var X},
currency {"EUR" replaceby "DM"}
}}
},
in { resource {"file:travel5.xml"},
travel {{
delete name{var X},
insert train {{ name{var X} }},
currency {"DM" replaceby "EUR"}
}}
}
]
END
</opaque>
<log:variable-bindings>
<log:tuple>
<log:variable name="X">t1</log:variable>
</log:tuple>
</log:variable-bindings>
</request>
The r3 application also supports XQuery and XPath as component Languages. For each of the two Languages (viz. xquery and xpath) it implements, based on Saxon 8.7, an opaque construct that digs a literal XQuery or XPath query. This construct returns the XML literal results of evaluating the opaque query for all the input Substitutions. XQuery external variable declarations (for all the variables included in the input Substitutions) are added if needed. In xpath, generated variable declarations are always added, whereas in xquery, these are added only if a related error occurs during compilation of the XQuery expression.
Additionally it is also possible to specify a base-uri or a context document. In xpath, any namespace prefix used in the context document is added to the set of static namespace prefixes available.
By default a `raw' format is used and literal results are returned as string values or XML elements (when appropriate); unless one explicitly uses a `wrap' format. In the latter case, each result is always wrapped with Saxon elements (e.g. result:sequence / element / attribute / atomic-value) providing details of its type and value.
You may find some examples of this language below:
<request xmlns:log="http://www.semwebtech.org/lang/2006/logic">
<subject>http://dummy.nop/xqq</subject>
<opaque>
for $X in ("aaa", "bbb")
return <doc><xxx>{$X}</xxx><yyy>{$Y}</yyy></doc>
</opaque>
<log:variable-bindings>
<log:tuple>
<log:variable name="Y">ccc</log:variable>
</log:tuple>
<log:tuple>
<log:variable name="Y">ddd</log:variable>
</log:tuple>
<log:tuple>
<log:variable name="Y">eee</log:variable>
</log:tuple>
</log:variable-bindings>
</request>
<request xmlns:log="http://www.semwebtech.org/lang/2006/logic">
<subject>http://dummy.nop/xqq</subject>
<opaque>
fn:doc($W)/*:feed/*:entry/*:link/@href
</opaque>
<log:variable-bindings>
<log:tuple>
<log:variable name="W"
>http://code.google.com/feeds/updates.xml</log:variable>
</log:tuple>
<log:tuple>
<log:variable name="W"
>http://code.google.com/feeds/featured.xml</log:variable>
</log:tuple>
</log:variable-bindings>
</request>
<request xmlns:log="http://www.semwebtech.org/lang/2006/logic">
<subject>http://dummy.nop/xqq</subject>
<Expression
xmlns="http://rewerse.net/I5/NS/2006/r3#"
xml:base="http://rewerse.net/I5/NS/r3/2005/eval/xquery"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<is rdf:resource="#opaque" />
<having><Parameter><is rdf:resource="#format" />
<literal>wrap</literal>
</Parameter></having>
<having><Parameter><is rdf:resource="#base-uri" />
<literal>http://code.google.com/feeds/</literal>
</Parameter></having>
<having><Parameter><is rdf:resource="#document" />
<literal rdf:parseType="Literal">
<config xmlns="">
<mode>escaped</mode>
<entry>1</entry>
</config>
</literal>
</Parameter></having>
<having><Parameter><is rdf:resource="#literal" />
<literal>
xquery version "1.0";
declare namespace atom = "http://purl.org/atom/ns#";
declare variable $W external;
let $m := fn:string(config/mode), $i := fn:number(config/entry)
for $r in fn:doc($W)/atom:feed/atom:entry[$i]/atom:title[@mode=$m]
return (fn:string($r), $r/@type, $r)
</literal>
</Parameter></having>
</Expression>
<log:variable-bindings>
<log:tuple>
<log:variable name="X">x1</log:variable>
<log:variable name="W">updates.xml</log:variable>
</log:tuple>
<log:tuple>
<log:variable name="X">x2</log:variable>
<log:variable name="W">updates.xml</log:variable>
</log:tuple>
<log:tuple>
<log:variable name="X"/>
<log:variable name="W">featured.xml</log:variable>
</log:tuple>
</log:variable-bindings>
</request>
<request xmlns:log="http://www.semwebtech.org/lang/2006/logic">
<subject>http://dummy.nop/xqq</subject>
<Expression
xmlns="http://rewerse.net/I5/NS/2006/r3#"
xml:base="http://rewerse.net/I5/NS/r3/2005/eval/xpath"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<is rdf:resource="#opaque" />
<having><Parameter><is rdf:resource="#format" />
<literal>raw</literal>
</Parameter></having>
<having><Parameter><is rdf:resource="#base-uri" />
<literal>http://code.google.com/feeds/</literal>
</Parameter></having>
<having><Parameter><is rdf:resource="#document" />
<literal rdf:parseType="Literal">
<config xmlns="" xmlns:atom="http://purl.org/atom/ns#">
<!-- using xpath -->
<!-- all namespace prefixes used here, get declared -->
<atom:entry>1</atom:entry>
</config>
</literal>
</Parameter></having>
<having><Parameter><is rdf:resource="#literal" />
<literal>
for $i in config/atom:entry
return fn:string(
fn:doc($W)/atom:feed/atom:entry[fn:number($i)]/atom:title)
</literal>
</Parameter></having>
</Expression>
<log:variable-bindings>
<log:tuple>
<log:variable name="W">updates.xml</log:variable>
</log:tuple>
<log:tuple>
<log:variable name="W">featured.xml</log:variable>
</log:tuple>
</log:variable-bindings>
</request>
Based on JAXP (using some classpath-selected XSLT processor, e.g. Saxon 8.7), an xslt Language is also available. This Language defines an apply Functor that uses a stylesheet and a document (<xml/> by default), applying the former to the latter and returning the obtained result (binding output-method accordingly). Also available, an opaque construct that digs a literal stylesheet (parameterized with logical variables, bound and used to override XSLT parameters). In the future, a base-uri parameter may be added to both constructs.
<request xmlns:log="http://www.semwebtech.org/lang/2006/logic">
<subject>http://dummy.nop/xslt</subject>
<Expression
xmlns="http://rewerse.net/I5/NS/2006/r3#"
xml:base="http://rewerse.net/I5/NS/r3/2005/eval/xslt"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<is rdf:resource="#apply" />
<having><Parameter><is rdf:resource="#output-method" />
<boundTo>M</boundTo>
</Parameter></having>
<having><Parameter><is rdf:resource="#document" />
<literal rdf:parseType="Literal">
<doc xmlns="">
<entry id="1">one</entry>
<entry id="2">two</entry>
</doc>
</literal>
</Parameter></having>
<having><Parameter><is rdf:resource="#stylesheet" />
<boundTo>S</boundTo>
</Parameter></having>
</Expression>
<log:variable-bindings>
<log:tuple>
<log:variable name="M"/>
<log:variable name="S">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<HTML><BODY>
<TABLE><TR><TH>ID</TH><TH>TEXT</TH></TR>
<xsl:for-each select="doc/entry">
<TR><TD><xsl:value-of select="@id"/></TD><TD><xsl:value-of select="."/></TD></TR>
</xsl:for-each>
</TABLE>
</BODY></HTML>
</xsl:template>
</xsl:stylesheet>
</log:variable>
</log:tuple>
<log:tuple>
<log:variable name="M">text</log:variable>
<log:variable name="S">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<HTML><BODY>
<TABLE><TR><TH>ID</TH><TH>TEXT</TH></TR>
<xsl:for-each select="doc/entry">
<TR><TD><xsl:value-of select="@id"/></TD><TD><xsl:value-of select="."/></TD></TR>
</xsl:for-each>
</TABLE>
</BODY></HTML>
</xsl:template>
</xsl:stylesheet>
</log:variable>
</log:tuple>
<log:tuple>
<log:variable name="M">html</log:variable>
<log:variable name="S">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<HTML><BODY>
<TABLE><TR><TH>ID</TH><TH>TEXT</TH></TR>
<xsl:for-each select="doc/entry">
<TR><TD><xsl:value-of select="@id"/></TD><TD><xsl:value-of select="."/></TD></TR>
</xsl:for-each>
</TABLE>
</BODY></HTML>
</xsl:template>
</xsl:stylesheet>
</log:variable>
</log:tuple>
</log:variable-bindings>
</request>
<request xmlns:log="http://www.semwebtech.org/lang/2006/logic">
<subject>http://dummy.nop/xslt</subject>
<Expression
xmlns="http://rewerse.net/I5/NS/2006/r3#"
xml:base="http://rewerse.net/I5/NS/r3/2005/eval/xslt"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<is rdf:resource="#opaque" />
<having><Parameter><is rdf:resource="#document" />
<literal rdf:parseType="Literal">
<doc xmlns="">
<entry id="1">one</entry>
<entry id="2">two</entry>
</doc>
</literal>
</Parameter></having>
<having><Parameter><is rdf:resource="#literal" />
<literal rdf:parseType="Literal">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns="">
<xsl:output method="xml"/>
<xsl:param name="some-param">some-value</xsl:param>
<xsl:template match="/">
<HTML><BODY>
<TABLE><TR><TH>ID</TH><TH>TEXT</TH></TR>
<xsl:for-each select="doc/entry">
<TR><TD><xsl:value-of select="@id"/></TD><TD><xsl:value-of select="."/></TD></TR>
</xsl:for-each>
</TABLE>
<P>Some Param: <xsl:value-of select="$some-param"/>.</P>
</BODY></HTML>
</xsl:template>
</xsl:stylesheet>
</literal>
</Parameter></having>
</Expression>
<log:variable-bindings>
<log:tuple>
<log:variable name="some-param"/>
</log:tuple>
<log:tuple>
<log:variable name="some-param">other-value</log:variable>
</log:tuple>
</log:variable-bindings>
</request>
The r3 application further includes the util Language that defines several ad-hoc utility LanguageConstructs:
An introspective OpaqueConstruct is currently under consideration (viz. opaque) that digs a literal RDF/XML serialization of an r3 Message. A Request/Terminate is to be issued upon evaluation from the literal input parameter and the synchronous Response returned. A Response is to be validated and "echoed". Eventually the latter one, echoing a Response, seems to be the only functionality that cannot be achieved using the http Language.
The util Language will probably be extended in the future. Some useful Aggregators may be added (e.g. count, sum, avg, min, max). Also some basic comparison Functors (e.g. eq, neq, lt, lte, gt, gte) and some basic Operators (e.g. and/and-then, or/or-then, not, select-whenotherwise/ if-then-else) may be added. In what concerns comparison Functors, extension of the xquery and xpath Languages to export also their functions and operators may be a better solution.
Last modified: |