[teiid-users] unexpected query results against XML data source

John Doyle jdoyle at redhat.com
Tue Sep 1 11:48:24 EDT 2009


Hi Mike, 

I've tried to reproduce this but get no root elements to select from during the import process. Is it possible that the XSD pasted here is different from what you're using? 

~jd 
----- "Mike Mascari" <mascarim at yahoo.com> wrote: 
> 
> 
Hello. I've downloaded and installed the snapshot as of today (8/31/2009) and, using the designer: 

> 
1. Used Import->XML Schema as Relational Source Model 

> 
2. Selected Document over HTTP with no request parameters 

> 
3. Selected No Catalog 

> 
4. Chose "File System" as source of XML Schema (inlined below) 

> 
5. Chose "client" (I've tried w/"clients" as well) as the root element and "Finish" 

> 
6. Create a "purchasing" View Model and, with "purchasing" selected, created an "example" BaseTable. I then drag-and-drop "client" from clients.xmi Source Model into SOURCES pane. (This View abstraction turns out not to be the problem -- I query the Source via the Execute'd VDB with the same outcome.) 

> 
7. Created a "billing" vdb, cleaned, built, and synchronized. 

> 
8. Then, with this data served up by apache: 

> 

<?xml version="1.0" encoding="UTF-8"?> 
<clients> 
<client> 
<name>acme</name> 
<rate>15</rate> 
</client> 
<client> 
<name>toolwerks</name> 
<rate>20</rate> 
</client> 
</clients> 

> 
I issued the following query: 

> 

select * from clients.client 

> 
and received the expected result: 

> 


null;acme;15 
null;toolwerks;20 

> 
9. Then I did this: 

> 
select * from clients.client where name = 'acme' 

> 
and received *two rows*: 

> 

null;acme;15 
null;toolwerks;20 

> 
10. So I did this: 

> 
select * from clients.client where name != 'acme' 

> 
and received the expected one row: 

> 

null;toolwerks;20 

> 
??? 

> 
Is there something goofy with the equality operator against XML data? Is there flag that needs flipped on these attributes? I went with the "string" mapping on the 'XML Schema as Relational Source Model' dialog wizard (pane 4 IIRC). Oughtn't I have? I also changed XML node names that might have been SQL keywords ('name' -> 'fullname') but no dice... 

> 
Thoughts? 

> 
- Mike 

> 
Schema: 

> 

<?xml version="1.0"?> 


> 
<!-- our client database --> 

> 
<xs:element name="clients"> 

<xs:complexType> 
<xs:sequence> 

> 
<!-- the client --> 

<xs:element name="client" minOccurs="1" maxOccurs="unbounded"> 
<xs:complexType> 
<xs:sequence> 

> 
<!-- client name --> 

> 
<xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/> 

> 
<!-- bill rate --> 

> 
<xs:element name="rate" minOccurs="0"> 
<xs:simpleType> 
<xs:restriction base="xs:decimal"> 
<xs:minInclusive value="50"/> 
<xs:maxInclusive value="250"/> 
</xs:restriction> 
</xs:simpleType> 
</xs:element> 

> 
</xs:sequence> 

> 
</xs:complexType> 

> 
</xs:element> 

> 
</xs:sequence> 
</xs:complexType> 

> 
</xs:element> 
</xs:schema> 

> 
> 
> 
> _______________________________________________ teiid-users mailing list teiid-users at lists.jboss.org https://lists.jboss.org/mailman/listinfo/teiid-users 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/teiid-users/attachments/20090901/86cfeb7c/attachment.html 


More information about the teiid-users mailing list