If anyone has any suggestions for this I'd love to hear them.
I have a bunch of records (500k+) of elements like this:
<RELATIONSHIP>
<RELATIONSHIPID>1149315021</RELATIONSHIPID>
<CONCEPTID1>7826003</CONCEPTID1>
<RELATIONSHIPTYPE>246456000</RELATIONSHIPTYPE>
<CONCEPTID2>288526004</CONCEPTID2>
<CHARACTERISTICTYPE>1</CHARACTERISTICTYPE>
<REFINABILITY>2</REFINABILITY>
<RELATIONSHIPGROUP>0</RELATIONSHIPGROUP>
</RELATIONSHIP>
Given 2 concepts ID's .. .I want to query for RELATIONSHIP records where
CONCEPTID1 is the same, and CONCEPTID2 matches the 2 ID's I have.
I also have a 'master' record set of <CONCEPT> which lists all the
concept ID's if that helps.
I'm trying this nieve xquery ... which hasnt completed yet:
let $d1 := 387494007,
$d2 := 387458008
for $c in xdmp:directory("/SNOMED/concepts/")//CONCEPT
let $cid := $c/CONCEPTID/string()
return
xdmp:directory("/SNOMED/relationships/")//RELATIONSHIP[CONCEPTID1 eq
$cid][CONCEPTID2 = ($d1,$d2)]
I dont think its quite what I'm looking for but its close.
Problem is 10 minutes later it hasnt returned yet.
I'm sure its not using any kind of indexing which is going to be way too
slow.
I'm looking at the cts:element-value-co-occurrences
which seems to be very close to what I want but these 2 relationship
elements dont co-occur within the same fragment.
My next thought is to regenerate the data putting all relationships
where CONCEPTID1 inside the CONCEPT element which is associated to it.
That's probably a better design anyway ...
but any suggestions on how to query this in a different way very
welcome.
----------------------------------------
David A. Lee
Senior Principal Software Engineer
Epocrates, Inc.
[email protected] <mailto:[email protected]>
812-482-5224
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general