define attribute witn namespace and no targetnamespace

Hi,

I want to define a tsd which contains an attribute on the root element. This attribute needs to have a namespace, but the tsd document does not contain a target namespace.

the xml doc that uses this tsd looks like

Any clues?

define a tsd with just the attribute and the corresponding namespace.
Then define a tsd with no target namespace and import the attribute’s schema. Add the attribute to the element and you are done

regards

Harald

Hi,

I’ve created the following tsd’s (see attachments) where the id.tsd conaints the attribute I want to index. The id.tsd is imported in the type-tech-rdc.tsd (renamed to .xml so they could be attached)

Next I run explain this query in Xquery tool:
declare namespace imp=“http://nsp.rdc.nl/tamino/import/1.0”;
for $a in input()/TYPE-TECH-ABON[not(@imp:id = input()/typekeuring-export/feed/@srcref)]
return $a

The explain states the following:
This query compiles successfully.
This query will retrieve all documents from the doctype ETG-CVO/TYPE-TECH-ABON.
This query will perform an index scan (details unknown).

the srcref attribute is also indexed and that seems to be ok. But I’m wondering if the imp:id index is being used, since the query takes a very long time on a database with 600 - 700 small (usually round 500Kb - 1 Mb) documents in it.

Any help would be great!

Thanks,

Danny
type-tech-rdc.xml (1.56 KB)
id.xml (1.24 KB)

Hi Danny

Does it make any difference if you construct the xquery like this ?
declare namespace imp=“http://nsp.rdc.nl/tamino/import/1.0”;
let $a :=input()/typekeuring-export/feed/@srcref
for $b in input()/TYPE-TECH-ABON
where not(@imp:id = $a)
return $b

Finn

UPS I forgot the $b ref…

declare namespace imp=“http://nsp.rdc.nl/tamino/import/1.0”;
let $a :=input()/typekeuring-export/feed/@srcref
for $b in input()/TYPE-TECH-ABON
where not($b/@imp:id = $a)
return $b

Great!

I’ve tested it and this is what the explain function says:

This query compiles successfully.
This query will perform an index scan (details unknown).
This query will perform an index scan (details unknown).

The analyzed query:
{?explain?}
declare namespace imp=“http://nsp.rdc.nl/tamino/import/1.0”;
let $a :=input()/typekeuring-export/feed/@srcref
for $b in input()/TYPE-TECH-ABON where not($b/@imp:id = $a)
return $b

The query takes about 5 secs now instead of 10 mins!

Thanks for your help Finn!

(Although doing the query your way means changing some software that actually does the query).