You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@oodt.apache.org by Sheryl John <sh...@gmail.com> on 2011/10/13 02:54:37 UTC
DIS-style query error
Hi,
I'm facing some weird issue with the DIS-style queries I'm sending while
using xmlps.
Case:
DIS-style query1:
prod?q=RETURN = mrn AND RETURN = birth_dt_tm AND loc_nurse_unit_cd_desc_1 =
'PICU'
Gets converted to the SQL-query:
SELECT person.mrn as mrn,person.birth_dt_tm as birth_dt_tm FROM encounter
INNER JOIN person ON person.person_id = encounter.person_id INNER JOIN
encntr_loc_hist ON encntr_loc_hist.encntr_id = encounter.encntr_id WHERE
encntr_loc_hist.loc_nurse_unit_cd_desc = 'PICU'
Result: I get valid outputs.
----------
DIS-style query2:
prod?q=RETURN = mrn AND RETURN = birth_dt_tm AND loc_nurse_unit_cd_desc_1 =
'PICU' OR loc_nurse_unit_cd_desc_1 = 'PICU2'
Converted SQL-query:
SELECT person.mrn as mrn,person.birth_dt_tm as birth_dt_tm FROM encounter
INNER JOIN person ON person.person_id = encounter.person_id INNER JOIN
encntr_loc_hist ON encntr_loc_hist.encntr_id = encounter.encntr_id
WHERE (encntr_loc_hist.loc_nurse_unit_cd_desc
= PICU2 AND encntr_loc_hist.loc_nurse_unit_cd_desc = 'PICU')
Result: Invalid column name 'PICU2'. In the above converted SQL-query the
single quotes disappears around PICU2.
----------
DIS-style query3: Added parenthesis to DIS-style query2
prod?q=RETURN = mrn AND RETURN = birth_dt_tm AND {loc_nurse_unit_cd_desc_1 =
'PICU' OR loc_nurse_unit_cd_desc_1 = 'PICU2'}
Converted SQL-query:
SELECT person.mrn as mrn,person.birth_dt_tm as birth_dt_tm FROM encounter
INNER JOIN person ON person.person_id = encounter.person_id INNER JOIN
encntr_loc_hist ON encntr_loc_hist.encntr_id = encounter.encntr_id WHERE
(encntr_loc_hist.loc_nurse_unit_cd_desc = PICU2 OR
encntr_loc_hist.loc_nurse_unit_cd_desc = 'PICU')
Result: Invalid column name 'PICU2'. Again, no single quotes around PICU2.
I tried the above cases with LIKE and the single quotes still does not
appear. Is there a proper way of defining the DIS-style queries to correct
this?
Thanks,
Sheryl
Re: DIS-style query error
Posted by "Mattmann, Chris A (388J)" <ch...@jpl.nasa.gov>.
Hi Sheryl,
On Oct 12, 2011, at 5:54 PM, Sheryl John wrote:
> Hi,
>
> I'm facing some weird issue with the DIS-style queries I'm sending while using xmlps.
>
> Case:
>
> DIS-style query2:
> prod?q=RETURN = mrn AND RETURN = birth_dt_tm AND loc_nurse_unit_cd_desc_1 = 'PICU' OR loc_nurse_unit_cd_desc_1 = 'PICU2'
This isn't a valid DIS-tyle query. Note that you can't do RETURN = a *AND* b. It's RETURN = a AND RETURN = b.
>
> Converted SQL-query:
> SELECT person.mrn as mrn,person.birth_dt_tm as birth_dt_tm FROM encounter INNER JOIN person ON person.person_id = encounter.person_id INNER JOIN encntr_loc_hist ON encntr_loc_hist.encntr_id = encounter.encntr_id WHERE (encntr_loc_hist.loc_nurse_unit_cd_desc = PICU2 AND encntr_loc_hist.loc_nurse_unit_cd_desc = 'PICU')
>
> ----------
> DIS-style query3: Added parenthesis to DIS-style query2
> prod?q=RETURN = mrn AND RETURN = birth_dt_tm AND {loc_nurse_unit_cd_desc_1 = 'PICU' OR loc_nurse_unit_cd_desc_1 = 'PICU2'}
>
[...snip...]
> I tried the above cases with LIKE and the single quotes still does not appear. Is there a proper way of defining the DIS-style queries to correct this?
Yep, see my example above. I think that'll fix it.
Here's two good tutorials for DIS-style queries:
http://oodt.apache.org/components/maven/profile/querying/
http://oodt.apache.org/components/maven/xmlquery/disquery/
HTH,
Chris
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Chris Mattmann, Ph.D.
Senior Computer Scientist
NASA Jet Propulsion Laboratory Pasadena, CA 91109 USA
Office: 171-266B, Mailstop: 171-246
Email: chris.a.mattmann@nasa.gov
WWW: http://sunset.usc.edu/~mattmann/
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adjunct Assistant Professor, Computer Science Department
University of Southern California, Los Angeles, CA 90089 USA
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Re: DIS-style query error
Posted by "Mattmann, Chris A (388J)" <ch...@jpl.nasa.gov>.
Hi Sheryl,
On Oct 12, 2011, at 5:54 PM, Sheryl John wrote:
> Hi,
>
> I'm facing some weird issue with the DIS-style queries I'm sending while using xmlps.
>
> Case:
>
> DIS-style query2:
> prod?q=RETURN = mrn AND RETURN = birth_dt_tm AND loc_nurse_unit_cd_desc_1 = 'PICU' OR loc_nurse_unit_cd_desc_1 = 'PICU2'
This isn't a valid DIS-tyle query. Note that you can't do RETURN = a *AND* b. It's RETURN = a AND RETURN = b.
>
> Converted SQL-query:
> SELECT person.mrn as mrn,person.birth_dt_tm as birth_dt_tm FROM encounter INNER JOIN person ON person.person_id = encounter.person_id INNER JOIN encntr_loc_hist ON encntr_loc_hist.encntr_id = encounter.encntr_id WHERE (encntr_loc_hist.loc_nurse_unit_cd_desc = PICU2 AND encntr_loc_hist.loc_nurse_unit_cd_desc = 'PICU')
>
> ----------
> DIS-style query3: Added parenthesis to DIS-style query2
> prod?q=RETURN = mrn AND RETURN = birth_dt_tm AND {loc_nurse_unit_cd_desc_1 = 'PICU' OR loc_nurse_unit_cd_desc_1 = 'PICU2'}
>
[...snip...]
> I tried the above cases with LIKE and the single quotes still does not appear. Is there a proper way of defining the DIS-style queries to correct this?
Yep, see my example above. I think that'll fix it.
Here's two good tutorials for DIS-style queries:
http://oodt.apache.org/components/maven/profile/querying/
http://oodt.apache.org/components/maven/xmlquery/disquery/
HTH,
Chris
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Chris Mattmann, Ph.D.
Senior Computer Scientist
NASA Jet Propulsion Laboratory Pasadena, CA 91109 USA
Office: 171-266B, Mailstop: 171-246
Email: chris.a.mattmann@nasa.gov
WWW: http://sunset.usc.edu/~mattmann/
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adjunct Assistant Professor, Computer Science Department
University of Southern California, Los Angeles, CA 90089 USA
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++