Title: Tamino: Getting there
1Tamino Getting there
Tamino
GETTING THERE
Curtis Pew The University of Texas at
Austin c.pew_at_its.utexas.edu
2From wherever you may be
3Preliminaries
4HyperText Transport Protocol
Server
GET /hello.html HTTP/1.1 Host www.example.com Use
r-Agent Spiffy Browser/1.0
HTTP/1.1 200 OK Date Wed, 18 Oct 2006 131012
GMT Server Spiffy Web Server/1.0 Content-length
136 Content-type text/html lt!DOCTYPE HTML
PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http//www.w3.org/TR/html4/strict.dtd"gt lttitlegtHe
llolt/titlegtltpgtHello, world!
Client
5HTTP Methods
PUT
create/replace resource
GET
retrieve resource
DELETE
remove resource
POST
do something with resource
6Tamino and the Web
Tamino user
Tamino user
Tamino user
C API Program
Tamino user
Tamino Database
Web Server
Tamino user
Tamino Database
Web Server
Tamino user
Tamino Database
Tamino user
7Tamino Organization
8XQuery
9GenealogyofXQuery
DSSSL
XSL
XSLT
XPointer
XSL-FO
XSLT
XPath
SQL
XQuery
10Path Expressions
prefs/favs_at_name "Samuel"/song
ltprefsgt ltfavs name"Samuel"gt ltsonggtOld
McDonaldlt/songgt ltquotegtTo be or not to
be.lt/quotegt lt/favsgt ltfavs name"Jonathan"gt
ltsonggtThe Eensy-weensy spiderlt/songgt
ltsonggtPopcorn poppinglt/songgt lt/favsgt lt/prefsgt
11Path Expressions
prefs/favs_at_name "Samuel"/song
ltprefsgt ltfavs name"Samuel"gt ltsonggtOld
McDonaldlt/songgt ltquotegtTo be or not to
be.lt/quotegt lt/favsgt ltfavs name"Jonathan"gt
ltsonggtThe Eensy-weensy spiderlt/songgt
ltsonggtPopcorn poppinglt/songgt lt/favsgt lt/prefsgt
12Path Expressions
prefs/favs_at_name "Samuel"/song
ltprefsgt ltfavs name"Samuel"gt ltsonggtOld
McDonaldlt/songgt ltquotegtTo be or not to
be.lt/quotegt lt/favsgt ltfavs name"Jonathan"gt
ltsonggtThe Eensy-weensy spiderlt/songgt
ltsonggtPopcorn poppinglt/songgt lt/favsgt lt/prefsgt
13Path Expressions
prefs/favs_at_name "Samuel"/song
ltprefsgt ltfavs name"Samuel"gt ltsonggtOld
McDonaldlt/songgt ltquotegtTo be or not to
be.lt/quotegt lt/favsgt ltfavs name"Jonathan"gt
ltsonggtThe Eensy-weensy spiderlt/songgt
ltsonggtPopcorn poppinglt/songgt lt/favsgt lt/prefsgt
14FLWOR Expressions
for book in input()/book, author in
input()/author let title book/title, name
author/name where book/author name order
by name return ltauthor-titlegt name,
title lt/author-titlegt
15Update Expressions
update delete root(input()/fragmenttfgetInoId(.)
12) update insert ltpayment
date"2006-10-01"gt500.00lt/paymentgt into
input()/account_at_acct-id "loan88345"/history u
pdate let p 500.00 for a in
input()/account let b a/_at_balance
where a/_at_acct-id "loan88345" do
(insert ltpayment date"2006-10-01"gtplt/paymentgt
into a/history,
replace b with attribute balance b - p)
16(No Transcript)
17X-Machine
18X-Machine
Client
Tamino Manager
X-Tension
application
XML Parser
Query Interpreter
application
Object Processor
Adabas
X-Node
Object Composer
Oracle
other databases
Tamino Server
19URL Addressing
http//example.com/tamino/mydb/hr/employee/fred ht
tp//example.com/tamino/mydb/hr/employee/_at_3
mydb
help
hr
department
employee
html
1
3 fred
2
4
20URL Addressing
http//example.com/tamino/mydb/hr/employee/fred ht
tp//example.com/tamino/mydb/hr/employee/_at_3
mydb
help
hr
department
employee
html
1
3 fred
2
4
21URL Addressing
http//example.com/tamino/mydb/hr/employee/fred ht
tp//example.com/tamino/mydb/hr/employee/_at_3
mydb
help
hr
department
employee
html
1
3 fred
2
4
22URL Addressing
http//example.com/tamino/mydb/hr/employee/fred ht
tp//example.com/tamino/mydb/hr/employee/_at_3
mydb
help
hr
department
employee
html
1
3 fred
2
4
23X-Machine Commands
X-Machine
_commandvalue
GET /tamino/cgp/test2006?_xqueryinput28292ffra
gment HTTP/1.1 Hostname flute.its.utexas.edu
POST /tamino/cgp/test2006 HTTP/1.1 Hostname
flute.its.utexas.edu Content-Type
multipart/form-data boundaryrfj23jjHG Content
-length 142 --rfj23jjHG Content-disposition
form-data name_xquery Content-type
text/plain Content-length 16 input()/fragment --
rfj23jjHG--
24X-Machine Response
X-Machine
lt?xml version"1.0" encoding"ISO-8859-1"
?gt ltinoresponse xmlnsino"http//namespaces.soft
wareag.com/tamino/response2"
xmlnsxql"http//metalab.unc.edu/xql/"gt
ltxqquery xmlnsxq"http//namespaces.softwareag.c
om/tamino/XQuery/result"gt lt!CDATAinput()/fra
gmentgt lt/xqquerygt ltinomessage
inoreturnvalue"0"gt ltinomessagelinegtXQuery
Request processinglt/inomessagelinegt
lt/inomessagegt ltxqresult xmlnsxq"http//names
paces.softwareag.com/tamino/XQuery/result"gt quer
y result goes here lt/xqresultgt
ltinomessage inoreturnvalue"0"gt
ltinomessagelinegtXQuery Request
processedlt/inomessagelinegt lt/inomessagegt lt/ino
responsegt
25_process
http//example.com/tamino/mydb/mycoll
ltinorequestgt ltinoobject inodocnamefredgt
first document here lt/inoobjectgt
ltinoobject inodocnametomgt second
document here lt/inoobjectgt ltinoobject
inodocnamebengt third document here
lt/inoobjectgt lt/inorequestgt
26Schema commands
_defineschema
_undefinecollection/schema-name/doctype
27Sessions
Server
_connect
Sessionid 5 Sessionkey 3948586
Other commands
_disconnect _sessionid5 _sessionkey5940386
Client
28Transactions
Atomic Consistent Independent Durable
_commit
_rollback
29Cursors
Server
_cursoropen _xquery
handle 1
_cursorfetch _handle1 _position10
Client
_cursorclose _handle1
30Prepared queries
Server
_preparedeclare variable x
handle 2
_executeprepared-xquery _handle2 xvalue
Client
31APIs
32Tamino API for C
include ltstdio.hgt include "TaminoAPI4C.h" int
main() TAC_HANDLE handle const char
dbname "cgp" const char collection
"test2006" const char query
"input()/fragment const char response
handle tac_init(dbname) tac_xquery(handle,
collection, query) tac_last_xml_response(handle
, response) printf("s\n", response)
tac_end(handle) return 0
33Tamino API for Java
final static String QUERY "input()/fragment" f
inal static String DATABASE_URI
"http//flute.its.utexas.edu/tamino/cgp" static
public void main(String args) throws Exception
// Create an object to represent the result
document. We will use JDOM TXMLObject xmlObj
TXMLObject.newInstance(TJDOMObjectModel.getInstanc
e()) // create an object representing the
database connection TConnection dbconnect
TConnectionFactory.getInstance().newConnection
(DATABASE_URI) // an object accessor represents
a collection within the database // and the
Java XML API we'll use to manipulate the
results. TXMLObjectAccessor objAcc
dbconnect.newXMLObjectAccessor(
TAccessLocation.newInstance("test2006"),
TJDOMObjectModel.getInstance()) // create an
object representing the query TXQuery query
TXQuery.newInstance(QUERY) // now we can
actually query the database TResponse tresp
objAcc.xquery(query) // extract the first result
from the response if (tresp.hasFirstXMLObject())
xmlObj tresp.getFirstXMLObject() // use
JDOM methods to process document Element el
(Element)xmlObj.getElement() String content
el.getText() System.out.println(content)
// close the connection dbconnect.close()
34Tamino API for .Net
TaminoConnection connection new
TaminoConnection("http//flute.its.utexas.edu/tami
no/cgp") connection.Open(TaminoConnectionMode.Aut
oCommit) TaminoCommand cmd connection.CreateCom
mand("test2006") TaminoQuery xquery new
TaminoQuery("input()/fragment") TaminoQueryRespon
se tresp cmd.Query(xquery) foreach (XmlNode
node in tresp) Console.WriteLine(node.OuterX
ml) tresp.Close() connection.Close()
35HTTP Client API for JScript
lthtmlgt ltheadgtlttitlegtTamino JScript
Demolt/titlegt ltscript typetext/javascript
srcTaminoLib.jsgtlt/scriptgt ltscript
typetext/javascriptgt var db new
TaminoClient("http//flute.its.utexas.edu/tamino/c
gp/test2006") var qresponse db.xquery("input()/
fragment") var xqueryResultList
qresponse.getResult().childNodes //
xqueryResultList contains DOM objects
representing // the result nodes. lt/scriptgt
36Tamino API for PHP
lt?php require_once("TaminoAPI.php") require_once(
"TaminoHelperFunctions.php") tamino new
TaminoAPI("http//flute.its.utexas.edu", 80,"cg
p","","") tamino-gtsetCollection("test2006") if
(tamino-gtxquery("input()/fragment"))
tamino-gtprintResultBody() else
thfPrintError(tamino) ?gt
37Tamino API for Perl
use Tamino db Tamino-gtnew("http//flute.its.ut
exas.edu/tamino/cgp") xml db-gtxquery("test200
6", "input()/fragment")
38Natural
REQUEST DOCUMENT FROM "http//flute.its.utexas
.edu/tamino/cgp/test2006" WITH DATA
NAME '_xquery' VALUE 'input28292ffragm
ent' NAME '_encoding VALUE
'utf-8' RETURN RESPONSE TAMINO-DOCUMENT PAR
SE XML TAMINO-DOCUMENT INTO NAME
ELEM-NAME VALUE XML-TEXT IF ELEM-NAME
'index OR 'author
OR 'text' WRITE ELEM-NAME ''
XML-TEXT END-IF END-PARSE
39Ruby
require 'tamino/database' require
'tamino/xquery' query_string
'input()/fragment' xquery TaminoXQuery.new('te
st2006', query_string) TaminoDatabase.connect(
'http//flute.its.utexas.edu/tamino/cgp')
db xquery.each_result(db) doc
puts doc
40Tamino and the Web
Tamino user
Tamino user
Tamino user
C API Program
Tamino user
Tamino Database
Web Server
Tamino user
Tamino Database
Web Server
Tamino user
Tamino Database
Tamino user
41Questions?
42Resources
- Paper https//webspace.utexas.edu/curtispe/NatCon
f/tam2006paper.html - Slides https//webspace.utexas.edu/curtispe/NatCo
nf/tam2006.ppt - My email c.pew_at_its.utexas.edu
- XQuery http//documentation.softwareag.com/crossv
ision/ins441/xqueryref/xqr-over.htm - X-Machine http//documentation.softwareag.com/cro
ssvision/ins441/xprog/xpover.htm - APIs
- C http//documentation.softwareag.com/crossvision
/ins441/inoapi4c/api4c-over.htm - Java http//documentation.softwareag.com/crossvis
ion/ins441/inoapi/apiover.htm - .Net http//documentation.softwareag.com/crossvis
ion/ins441/dotnetapi/apiintro.htm - Jscript http//documentation.softwareag.com/cross
vision/ins441/jsapi/apiover.htm