Getting Count

I could be in the wrong place here, but I was wondering…

I am using the Tamino Interactive Client…
I was wondering I set a default database and did a though put test to tamino (inserting though java code), I was wondering using the I.I., how do I select the count, that is how many records went into the databse. (SQL SELECT count(*) from tablename_blah).

thanks

Rob

Hi Rob,

there is also a count() function in XPath.
Much like the SQL version it returns a count of the values passed to it.

If, for example, you inserted “Wibble” documents, you can count how many documents there are in the collection by using the query:
   count(/Wibble)

You can count the results of any valid XPath expression. So if you wanted to see how many Wibble documents have the value “Jib” in their “name” attribute, you could do this:
   count(/Wibble[@name=“Jib”])

I hope that helps,
Trevor.

ok,
here is what I am doing…

my databse name is test2

I have 10000 file in a directory, with the name blah00001.xml through blah10000.xml , so would the query you described be “select count(/blah)”


also whe I run
./ inside the QUERY box I get an error message about collection not found :
<ino:messagetext ino:code=“INOXRE8811”>Collection name not found</ino:messagetext>

I never set up a collection… sorry for the nubie question it’s that I looked in the documentation but couln’t find anything on collections

thanks again

Rob

From your description it seems as though the xml documents are still on your filesystem.

In order to make use of Tamino you have to store the xml documents into tamino either via the Tamino interactive interface, one of the loaders or via some program you write.

In order to store documents you need to define a schema. The schema defines the structure of a specific set of documents (in your case “blah” documents). As part of the schema you define what collection documents are being stored into.

Check out the Tamino documentation: “Getting Started” which describes collections and more.

Also Software AG has excellant Tamino and XML training courses, checkout training schedules in your country >>here <<.

Thanks guys,

according to the documentation I found that by default Tamino assignes the collection of ino:etc, to anything that you don’t define a schema for. I am inserting through a java client, with out a schema defined. I was wondering though, once I run

/. on the database I get my record, plus this stuff at the end:

- <ino:cursor ino:count=“10000”>
<ino:first ino:href=“?_XQL(1,1)=/.” />
<ino:next ino:href=“?_XQL(2,1)=/.” />
<ino:last ino:href=“?_XQL(10000,1)=/.” />
</ino:cursor>
- <ino:message ino:returnvalue=“0”>
ino:messagelineXQL Request processed</ino:messageline>
</ino:message>
</ino:response>

does ino:count mean the number of records in the database…

Rob

ino:count should be the number of documents that match the query; so the XPath query /. will match all documents and therefore ino:count will be 10000.