XQL [ino:id]

Hi,

I need some clarification on the XQL.
I wrote one servlet which does the basic operations like Insert,Delete,Query and Edit the required record as Id as the primary.
I am not clear how to retrive the [ino:id] for the required record.
Suppose I have

1
Test

in the Tamino.
I gave Product[ProdId=‘1’]/Product[ProdId=1], it didn’t reply me.
When I give Product[@ino:id=5], it returned me the record.
Using Tamino Interactive Interface, I could find the ino:id, but how to do programmatically ?

Thanks in advance,
N.V.Sairam

Please help me to proceed.

Hi,

why do you want to retrieve the ino:id?
It is possible to find this information at insert
time, from the TaminoResult - but I think the
ProdId should be used for retrieving your
documents.

Trevor.

Hi,

Whenever I try Product[ProdId=1] it says,
No element/attribute found. But if I try Product, it is listing the record. So only when I give ino:id, it is listing the details. Where I am missing ?

Thanks,
N.V.Sairam

Excuse the stupid question, but are you sure that you don’t have any blanks in the content of the element? Otherwise the Product[ProdId = ‘1’] query should work …

Thanks for the regards.
I have understood I placed a silly question.


I am using the Tamino Developer Edition [1.2.1.5] for Windows NT. I have copied all the jars [domsdk.jar, sax.jar, sxsrte.jar, taminoclient.jar,w3cdom1.jar,xp.jar,xt.jar] from the Tamino Starter Kit, and included in my classpath. I am trying the sameple programs that are being provided with that, like
DemoPing, DemoInsert, DemoDelete…

Code of the DemoInsert****************************

/* DemoInsert demonstrates how to insert an Element into a Document

/* Tamino DOM API classes are included in package
com.softwareag.tamino.api.dom.
The Docuverse DOM Implementation is included in
package com.docuverse.dom.
/

import com.softwareag.tamino.api.dom.;
import com.docuverse.dom.;


/

This Demo insert an xml document like this below:



Wehlmann124
Wehlmann124
Wehlmann
Anton
<Date_of_Birth>02.01.1945</Date_of_Birth>
<Company_Name>Deutsche Bank</Company_Name>
Herr
Wehlmann124@web.de

Seitersweg 200
Darmstadt
64287
Germany
06150-41404
06150-896177

/
public class DemoInsert

public static final void main(String[] arg) throws Exception


try{
TaminoClient tamino=new TaminoClient( parseArgs(arg) );

System.out.println(" I am in first step ");

/ Begin of session /
tamino.startSession();

System.out.println(" I am in second step ");

/ Create a new Document /
BasicDocument doc=new BasicDocument();

System.out.println(" I am in third step ");

/ Create a new Root Element /
BasicElement telephone = new BasicElement(doc,“Telephone”);

System.out.println(" I am in first step ");

/ Create a new Attribute in Telephone /
/
xml: /
telephone.setAttribute(“EntryID”,“124”);

BasicElement c = new BasicElement(doc,“LoginName”);
c.appendChild(new BasicText(doc,“Wehlmann125”));
telephone.appendChild©;

c = new BasicElement(doc,“PassWord”);
c.appendChild(new BasicText(doc,“Wehlmann124”));
telephone.appendChild©;

c = new BasicElement(doc,“Lastname”);
c.appendChild(new BasicText(doc,“Wehlmann”));
telephone.appendChild©;

c = new BasicElement(doc,“Firstname”);
c.appendChild(new BasicText(doc,“Anton”));
telephone.appendChild©;

c = new BasicElement(doc,“Date_of_Birth”);
c.appendChild(new BasicText(doc,“02.01.1945”));
telephone.appendChild©;

c = new BasicElement(doc,“Company_Name”);
c.appendChild(new BasicText(doc,“Deutsche Bank”));
telephone.appendChild©;

c = new BasicElement(doc,“Salutation”);
c.appendChild(new BasicText(doc,“Herr”));
telephone.appendChild©;

c = new BasicElement(doc,“Email”);
c.appendChild(new BasicText(doc,"Wehlmann124@web.de"));
telephone.appendChild©;

/ Create a new sub element Address /
BasicElement adresse = new BasicElement(doc,“Address”);


c = new BasicElement(doc,“Street”);
c.appendChild(new BasicText(doc,“Seitersweg 200”));
adresse.appendChild©;

c = new BasicElement(doc,“City”);
c.appendChild(new BasicText(doc,“Darmstadt”));
adresse.appendChild©;

c = new BasicElement(doc,“ZIP”);
c.appendChild(new BasicText(doc,“64287”));
adresse.appendChild©;

c = new BasicElement(doc,“Country”);
c.appendChild(new BasicText(doc,“Germany”));
adresse.appendChild©;

c = new BasicElement(doc,“Telephone”);
c.appendChild(new BasicText(doc,“06150-41404”));
adresse.appendChild©;

c = new BasicElement(doc,“Fax”);
c.appendChild(new BasicText(doc,“06150-896177”));
adresse.appendChild©;

telephone.appendChild(adresse);

/ Now the DOM Element telephone is complete
/* Use method printTree of class TaminoClient to printout the
just created document tree /
TaminoClient.printTree(telephone);
/
use method insert of class TaminoClient to insert the document
into tamino database , default collection*/
TaminoResult tr= tamino.insert(telephone);

/* end of transaction /
tamino.commit(true);

/ start a query to test the new document and show the result element on the
screen /
tr = tamino.query(“Telephone[LoginName=“Wehlmann125”]”);
if (tr.getElement() != null ){
TaminoClient.printTree(tr.getElement());
}
else
System.out.println(“Telephone[@LoginName=“Wehlmann125”] not
found” );

/ end of session /
tamino.endSession();
}
/
call class TaminoError to catch the error /
catch (com.softwareag.tamino.api.dom.TaminoError e){
System.out.println("Tamino Error Text: " + e.errorText );
System.out.println("Tamino Error Code: " + e.responseCode );
}


}

/ Definition of method parseArgs /


public static final String parseArgs(String[] args){
if (args.length >= 1)
return args[0];

else

System.out.println("\n>> Tamino Demo Programs << \n" +
“Copyright © 2000 SOFTWARE AG, ALL Rights Reserved.
\n\n” +
“Usage: java Demo… database-url \n” +
" e.g.Tamino Version 1.2 java DemoQuery
http://pcmypc/tamino/mydb \n" +
" e.g.Tamino Version 2.1 java DemoQuery
http://pcmypc/tamino/mydb/mycollection \n" );
System.exit(0);
return null;
}
}

}


*****
My URL is http://localhost/tamino/NECBS.

I just ran the above program, I got the result as below,

<?xml version="1.0" encoding="ISO-8859-1" ?>
- <ino:response xmlns:ino="http://namespaces.softwareag.com/tamino/response"
xmlns:xql=“http://metalab.unc.edu/xql/”>
xql:queryTelephone[LoginName=‘Wehlmann125’]</xql:query>
- <ino:message ino:returnvalue=“9539”>
<ino:messagetext ino:code=“INOXZE9539”>Element/attribute not
defined</ino:messagetext>
</ino:message>
</ino:response>


with setting Databse URL as http://localhost/tamino/NECBS
and XQL as 1. Telephone[LoginName=‘Wehlmann125’]
2. Telephone[@LoginName=“Wehlmann125”]
3. Telephone[@LoginName=Wehlmann125]
but I got the result as below, except the respective
xql:queryTelephone[LoginName=‘Wehlmann125’]</xql:query>
xql:queryTelephone[@LoginName=“Wehlmann125”]</xql:query>
xql:queryTelephone[@LoginName=Wehlmann125]</xql:query>



When I try with setting Databse URL as http://localhost/tamino/NECBS
and XQL as Telephone,

I got the result as

<?xml version="1.0" encoding="ISO-8859-1" ?>
- <ino:response xmlns:ino=“http://namespaces.softwareag.com/tamino/response"
xmlns:xql=“http://metalab.unc.edu/xql/”>
xql:queryTelephone</xql:query>
- <ino:message ino:returnvalue=“0”>
ino:messagelineXQL Request processing</ino:messageline>
</ino:message>
- xql:result
-
Wehlmann125
Wehlmann124
Wehlmann
Anton
<Date_of_Birth>02.01.1945</Date_of_Birth>
<Company_Name>Deutsche Bank</Company_Name>
Herr
Wehlmann124@web.de
-
Seitersweg 200
Darmstadt
64287
Germany
06150-41404
06150-896177


</xql:result>
- <ino:cursor ino:count=“1”>
<ino:first ino:href=”?_XQL(1,16)=Telephone" />
</ino:cursor>
- <ino:message ino:returnvalue=“0”>
ino:messagelineXQL Request processed</ino:messageline>
</ino:message>
</ino:response>


When I try XQL as Telephone[@ino:id=“1”]

I got the result as

<?xml version="1.0" encoding="ISO-8859-1" ?>
- <ino:response xmlns:ino=“http://namespaces.softwareag.com/tamino/response"
xmlns:xql=“http://metalab.unc.edu/xql/”>
xql:queryTelephone[@ino:id=“1”]</xql:query>
- <ino:message ino:returnvalue=“0”>
ino:messagelineXQL Request processing</ino:messageline>
</ino:message>
- xql:result
-
Wehlmann125
Wehlmann124
Wehlmann
Anton
<Date_of_Birth>02.01.1945</Date_of_Birth>
<Company_Name>Deutsche Bank</Company_Name>
Herr
Wehlmann124@web.de
-
Seitersweg 200
Darmstadt
64287
Germany
06150-41404
06150-896177


</xql:result>
- <ino:cursor ino:count=“1”>
<ino:first ino:href=”?_XQL(1,16)=Telephone[@ino:id=“1”]" />
</ino:cursor>
- <ino:message ino:returnvalue=“0”>
ino:messagelineXQL Request processed</ino:messageline>
</ino:message>
</ino:response>
***********


Please tell me the problem with my appraoch.

Thanks,
N.V.Sairam
:smiley:

I think your xql should be Telephone[LoginName~=‘Wehlmann125’] instead of the Telephone[LoginName=‘Wehlmann125’]

Thanks Chetan Jagtap.