Hi Karl,

I am still not positive I get what you want to do, but it sounds like you might 
consider doing 2 queries for this.  First, run a query with 
/patient/encounters/encounter as a searchable expression that finds the 
physician-name with the complaints.  Then, take the URIs of the documents 
returned from that query and pass them through as arguments to 
cts:directory-query as an additional-query to another search that searches over 
/patient/labs/lab.

It seems that given the way this data is modeled, you might have to perform 2 
searches.  You might be able to do some range constraints here to do something 
similar, but I cannot quite see the path to that.

But I am likely still missing something here.

-Danny

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Karl Erisman
Sent: Tuesday, April 06, 2010 9:08 AM
To: General Mark Logic Developer Discussion
Subject: [MarkLogic Dev General] Re: Separate searchable-expressions for 
different constraints?

Thanks for the response, Danny.  Notice that I asked about applying
the same <searchable-expression> to a SET of constraints.  Here's a
counter-example that demonstrates what I'd like to know how to do and
how I do not see a way to do it using <searchable-expression> and/or
<additional-query>:

<patient>
 <encounters>
   <encounter>
     <chief-complaint>hair loss</chief-complaint>
     <physician>
       <lastname>Williams</lastname>
     </physician>
   </encounter>
   <encounter>
     <chief-complaint>aches</chief-complaint>
     <physician>
       <lastname>Carter</lastname>
     </physician>
   </encounter>
 </encounters>
 <labs>
   <lab>
     <category>hematology</category>
     <name>RDW</name>
     <value>14.6</value>
   </lab>
   <lab>
     <category>chemistry</category>
     <name>CA</name>
     <value>9.2</value>
   </lab>
 </labs>
</patient>

The following query: "physician-lastname:williams
chief-complaint:aches test-name:rdw test-value:9.2" means to find
patients who have presented with Dr. Williams complaining of aches who
also have had an RDW test with a result value of 9.2.

I want the encounter-related constraints to be satisfied within the
SAME encounter section.  I want the lab-related constraints to be
satisfied within the SAME lab section.  So the document above does not
match the query.

<searchable-expression> would solve the problem IF each document only
had one section type (for example, it could be set to
"/patient/encounters/encounter" if there were only encounter
sections), but the document has multiple section types.  I see no way
that <additional-query> could be used here.

In general, the problem is that my options node supports a large set
of possible constraints and I want to partition that set into a few
subsets, specifying a different searchable-expression for each *subset
of the constraints*.  In my example, subsets would be: E =
{physician-lastname, chief-complaint}, L = {test-name, test-value} for
encounter constraints and lab constraints.  All constraints in subset
E must be satisfied in the same encounter, etc. for all subsets.

So, am I looking for a custom constraint-based approach?

Karl

On Mon, Apr 5, 2010 at 6:38:35 pm, Danny Sokolsky wrote:
>
> Hi Karl,
>
> You can add an <additional-query> option to your search:search options node. 
> If
> your additional-query is a cts:element-query, then that will constrain results
> to ones matching within that element. If you have different criteria for
> different elements, you can make the additional-query a cts:or-query of 
> multiple
> element-queries.
>
> -Danny
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to