Commit 9877bb64 authored by Georg Fette's avatar Georg Fette
Browse files

- NOT and NOT EXISTS now work

parent 8de8a3a5
......@@ -44,11 +44,16 @@ public class Graph_2_Cypher_Mapper extends Graph_2_System_Mapper {
@SuppressWarnings("unchecked")
private Set<OperatorType> prefixOps = new HashSet<OperatorType>(Arrays.asList(new OperatorType[] {
OperatorType.NOT, OperatorType.ABS, OperatorType.ALLTRUE, OperatorType.ANYTRUE,
OperatorType.AVG, OperatorType.COUNT, OperatorType.MAX, OperatorType.MIN, OperatorType.MEDIAN,
OperatorType.ABS, OperatorType.ALLTRUE, OperatorType.ANYTRUE, OperatorType.AVG,
OperatorType.COUNT, OperatorType.MAX, OperatorType.MIN, OperatorType.MEDIAN,
OperatorType.CEILING, OperatorType.EXP, OperatorType.FLOOR, OperatorType.LN, OperatorType.LOG,
OperatorType.ROUND, OperatorType.TRUNCATE, OperatorType.MIN, OperatorType.MAX }));
@SuppressWarnings("unchecked")
private Set<OperatorType> compOps = new HashSet<OperatorType>(Arrays.asList(new OperatorType[] {
OperatorType.EQUALS, OperatorType.MORE, OperatorType.MORE_OR_EQUAL, OperatorType.LESS,
OperatorType.LESS_OR_EQUAL, OperatorType.MATCHES, OperatorType.MATCHES_AQL }));
public Graph_2_Cypher_Mapper(Model model) {
super(model);
initializeOpMappings();
......@@ -70,22 +75,70 @@ public class Graph_2_Cypher_Mapper extends Graph_2_System_Mapper {
return opAlias;
}
private String writeProperty(QueryOperator aConc) {
String result = aliases.get(aConc);
if (result == null) {
if (aConc.type == OperatorType.ALIAS_REF) {
QueryOperator resolveAlias = aConc.resolveAlias();
result = writeProperty(resolveAlias);
} else if (aConc.type == OperatorType.INDEXED_FIELD) {
// the INDEXED_FIELDS are already handled in the Match via aliases
private String writeOperator(QueryOperator anOp) {
String result;
if ((anOp.type == OperatorType.FILTER) || (anOp.type == OperatorType.EXISTS)) {
if (state == CypherPart.WHERE) {
if (anOp.getParameters().size() > 1) {
result = writeExpression(anOp.getParameters().get(1));
} else {
result = "";
}
} else if (state == CypherPart.WITH) {
result = writeExpression(anOp.getParameters().get(0));
} else {
throw new RuntimeException("unexpected");
}
} else if (anOp.type == OperatorType.COLLECT) {
if (state == CypherPart.WHERE) {
result = "";
} else if (aConc.type == OperatorType.DEMOTE) {
result = writeProperty(aConc.getParameters().get(0).asConcept());
} else if (state == CypherPart.WITH) {
result = writeExpression(anOp.getParameters().get(1));
} else {
QueryOperator asConcept = aConc.getParameters().get(0).asConcept();
String pathPart = writeProperty(asConcept);
result = pathPart + "." + aConc.getIteratorSelector();
throw new RuntimeException("unexpected");
}
} else if (anOp.type == OperatorType.RETURN) {
result = "";
} else if (anOp.type == OperatorType.LIST) {
result = writeList(anOp);
} else if (anOp.type == OperatorType.ITERATE) {
result = "";
} else if (anOp.type == OperatorType.DEMOTE) {
result = writeExpression(anOp.getParameters().get(0));
} else if (anOp.type == OperatorType.OR) {
result = writeOr(anOp);
} else if (anOp.type == OperatorType.NOT) {
result = writeNot(anOp);
} else if (anOp.type == OperatorType.FIELD) {
Expression pathSource = anOp.getParameters().get(0);
Expression pathEnd = anOp.getParameters().get(1);
String pathSourceString = writeExpression(pathSource);
String pathEndString = writeExpression(pathEnd);
result = pathSourceString + "." + pathEndString;
} else if (infixOps.contains(anOp.type)) {
result = writeInfixOperator(anOp);
} else if (prefixOps.contains(anOp.type)) {
result = writePrefixOperator(anOp);
} else {
throw new RuntimeException("unexpected");
}
return result;
}
private String writeProperty(QueryOperator aConc) {
String result;
if (aConc.type == OperatorType.ALIAS_REF) {
QueryOperator resolveAlias = aConc.resolveAlias();
result = writeExpression(resolveAlias);
} else if (aConc.type == OperatorType.INDEXED_FIELD) {
// the INDEXED_FIELDS are already handled in the Match via aliases
result = "";
} else if (aConc.type == OperatorType.DEMOTE) {
result = writeExpression(aConc.getParameters().get(0).asConcept());
} else {
QueryOperator asConcept = aConc.getParameters().get(0).asConcept();
String pathPart = writeExpression(asConcept);
result = pathPart + "." + aConc.getIteratorSelector();
}
return result;
}
......@@ -154,18 +207,17 @@ public class Graph_2_Cypher_Mapper extends Graph_2_System_Mapper {
}
private String writeExpression(Expression anExp) {
String result;
if (aliases.containsKey(anExp)) {
return aliases.get(anExp);
}
if (anExp.isPrimitive()) {
result = writePrimitive(anExp.asPrimitive());
} else if (anExp.isConcept()) {
result = writeProperty(anExp.asConcept());
} else if (anExp.isOperator()) {
result = writeOperator(anExp.asOperator());
} else {
throw new RuntimeException("unexpected");
String result = aliases.get(anExp);
if (result == null) {
if (anExp.isPrimitive()) {
result = writePrimitive(anExp.asPrimitive());
} else if (anExp.isConcept()) {
result = writeProperty(anExp.asConcept());
} else if (anExp.isOperator()) {
result = writeOperator(anExp.asOperator());
} else {
throw new RuntimeException("unexpected");
}
}
return result;
}
......@@ -220,51 +272,30 @@ public class Graph_2_Cypher_Mapper extends Graph_2_System_Mapper {
return result;
}
private String writeOperator(QueryOperator anOp) {
String result;
if ((anOp.type == OperatorType.FILTER) || (anOp.type == OperatorType.EXISTS)) {
if (state == CypherPart.WHERE) {
if (anOp.getParameters().size() > 1) {
result = writeExpression(anOp.getParameters().get(1));
} else {
result = "";
// anOp.getAncestorsWithType(OperatorType.NOT).size() == 0)
}
} else if (state == CypherPart.WITH) {
result = writeExpression(anOp.getParameters().get(0));
} else {
throw new RuntimeException("unexpected");
}
} else if (anOp.type == OperatorType.COLLECT) {
if (state == CypherPart.WHERE) {
result = "";
} else if (state == CypherPart.WITH) {
result = writeExpression(anOp.getParameters().get(1));
} else {
throw new RuntimeException("unexpected");
private String writeNot(QueryOperator anOp) {
String opString = opMap.getOpString(anOp.type);
Expression param = anOp.getParameters().get(0);
if (param.isOperator() && param.asOperator().type == OperatorType.EXISTS) {
Expression existsParam = param.asOperator().getParameters().get(0);
if (!existsParam.isOperator()
|| (existsParam.asOperator().type != OperatorType.INDEXED_FIELD)) {
throw new RuntimeException(
"unexpected. NOT EXISTS may only be used with an archetype constraint");
}
} else if (anOp.type == OperatorType.DEMOTE) {
result = "";
} else if (anOp.type == OperatorType.LIST) {
result = writeList(anOp);
} else if (anOp.type == OperatorType.OR) {
result = writeOr(anOp);
} else if (anOp.type == OperatorType.ITERATE) {
result = writeExpression(anOp.getParameters().get(0));
} else if (anOp.type == OperatorType.FIELD) {
Expression pathSource = anOp.getParameters().get(0);
Expression pathEnd = anOp.getParameters().get(1);
String pathSourceString = writeExpression(pathSource);
String pathEndString = writeExpression(pathEnd);
result = pathSourceString + "." + pathEndString;
} else if (infixOps.contains(anOp.type)) {
result = writeInfixOperator(anOp);
} else if (prefixOps.contains(anOp.type)) {
result = writePrefixOperator(anOp);
QueryOperator indexedFieldOp = existsParam.asOperator();
QueryOperator aliasRef = indexedFieldOp.getParameters().get(0).asOperator();
String alias = aliases.get(aliasRef.resolveAlias());
String relName = indexedFieldOp.getParameters().get(1).asPrimitive().value;
String targetArchetypeName = indexedFieldOp.getParameters().get(2).asPrimitive().value;
String targetTypeName = indexedFieldOp.getDataType().parent;
String result = "NOT EXISTS ((" + alias + ")-[:" + relName + "]->(:" + targetTypeName
+ "{archetype_node_id:'" + targetArchetypeName + "'}))";
return result;
} else {
throw new RuntimeException("unexpected");
String expString = writeExpression(param);
String result = opString + "(" + expString + ")";
return result;
}
return result;
}
private String getPropertyType(QueryOperator aConc, QueryOperator aRel) {
......@@ -305,11 +336,26 @@ public class Graph_2_Cypher_Mapper extends Graph_2_System_Mapper {
return result;
}
private boolean isTypeRelationWithNot(QueryOperator aRel) {
List<QueryOperator> ancestorsWithType = aRel.getAncestorsWithType(OperatorType.NOT);
for (QueryOperator anOp : ancestorsWithType) {
for (Expression aParam : anOp.getParameters()) {
if (aParam.isOperator() && (aParam.asOperator().type == OperatorType.EXISTS)) {
return true;
}
}
}
return false;
}
private List<String> writeRelations(QueryOperator aConc) {
List<String> resultRelations = new ArrayList<String>();
List<QueryOperator> childConcepts = aConc.getChildConcepts();
for (QueryOperator aRel : childConcepts) {
if (isRelation(aConc, aRel)) {
// only take relations that are really realized in Neo4J as a relation and not via a property
// in a node
// and don't take relations that are NOT EXISTS checks with a archetype type constraint
if (isRelation(aConc, aRel) && !isTypeRelationWithNot(aRel)) {
String relString = write_FIELD_Relation(aConc, aRel);
resultRelations.add(relString);
}
......@@ -352,19 +398,24 @@ public class Graph_2_Cypher_Mapper extends Graph_2_System_Mapper {
for (QueryOperator anOp : query.getOperators()) {
// can there be more than one expression operator in the root anyway ?
boolean containsComparator = false;
if (anOp.type.isComparatorOp()) {
if (compOps.contains(anOp.type)) {
containsComparator = true;
}
for (QueryOperator aClause : anOp.getOpsRecursive()) {
if (aClause.type.isComparatorOp()) {
if (compOps.contains(aClause.type)) {
containsComparator = true;
}
if (aClause.type == OperatorType.INDEXED_FIELD && isTypeRelationWithNot(aClause)) {
containsComparator = true;
}
}
if (containsComparator) {
String clauseString = writeExpression(anOp);
expressionStrings.add(clauseString);
if (!clauseString.isEmpty()) {
expressionStrings.add(clauseString);
}
}
List<String> selectIndexStrings = writeSelectIndex(anOp);
List<String> selectIndexStrings = writeSelectIndexForRoot(anOp);
expressionStrings.addAll(selectIndexStrings);
List<String> containsTypeStrings = writeContainsType(anOp);
expressionStrings.addAll(containsTypeStrings);
......@@ -375,14 +426,17 @@ public class Graph_2_Cypher_Mapper extends Graph_2_System_Mapper {
return result;
}
private List<String> writeSelectIndex(QueryOperator anOp) {
private List<String> writeSelectIndexForRoot(QueryOperator aRoot) {
List<String> result = new ArrayList<String>();
List<QueryOperator> opsRecursiveWithType = anOp
List<QueryOperator> opsRecursiveWithType = aRoot
.getOpsRecursiveWithType(OperatorType.INDEXED_FIELD);
for (QueryOperator aSelect : opsRecursiveWithType) {
String sourceAlias = aliases.get(aSelect);
String index = aSelect.getParameters().get(2).asPrimitive().value;
result.add(sourceAlias + ".archetype_node_id = '" + index + "'");
if (!isTypeRelationWithNot(aSelect)) {
String sourceAlias = aliases.get(aSelect);
String index = aSelect.getParameters().get(2).asPrimitive().value;
String indexFieldString = sourceAlias + ".archetype_node_id = '" + index + "'";
result.add(indexFieldString);
}
}
return result;
}
......
......@@ -19,15 +19,15 @@ public class Test_AQL_2_Cypher {
public static void main(String[] args) throws IOException, QueryParseException {
Test_AQL_2_Cypher test = new Test_AQL_2_Cypher();
// test.debugTest();
test.testAQL_2_Cypher();
// test.debugTest();
test.testAQL_2_Cypher();
}
public void debugTest() throws QueryParseException, IOException {
initialize();
QueryManager queryManager = new QueryManager();
for (MultiQuery aMultiQuery : queryManager.queries) {
if (aMultiQuery.name.equals("query_AQL_2_Cypher_anamnese")) {
if (aMultiQuery.name.equals("query_AQL_2_Cypher_not1")) {
processQuery(aMultiQuery);
}
}
......
......@@ -28,7 +28,7 @@ public class Test_CQL_2_Cypher {
QueryManager queryManager = new QueryManager();
initialize();
for (MultiQuery aMultiQuery : queryManager.queries) {
if (aMultiQuery.name.equals("query_CQL_2_Cypher_Count2")) {
if (aMultiQuery.name.equals("query_CQL_2_Cypher_1Conc_2Constr")) {
processQuery(aMultiQuery);
}
}
......
......@@ -35,7 +35,7 @@ QUERY(
*Cypher
MATCH
(A:EHR), (A)-[*]->(B:CLUSTER), (B)-[:items]->(C:ITEM)
(A:EHR), (A)-[*]->(B:CLUSTER), (B)-[:items]->(C:ELEMENT)
WHERE
C.value.value = 'Natrium_g_dl' AND
C.archetype_node_id = 'at0024' AND
......
......@@ -43,7 +43,7 @@ QUERY(
*Cypher
MATCH
(A:EHR), (A)-[*]->(B:CLUSTER), (A)-[*]->(C:CLUSTER), (B)-[:items]->(D:ITEM), (C)-[:items]->(E:ITEM)
(A:EHR), (A)-[*]->(B:CLUSTER), (A)-[*]->(C:CLUSTER), (B)-[:items]->(D:ELEMENT), (C)-[:items]->(E:ELEMENT)
WHERE
B.archetype_node_id = 'openEHR-EHR-CLUSTER.laboratory_test_analyte.v1' AND
C.archetype_node_id = 'openEHR-EHR-CLUSTER.laboratory_test_analyte.v1' AND
......
......@@ -76,7 +76,7 @@ QUERY(
*Cypher
MATCH
(A:EHR), (A)-[*]->(B:CLUSTER), (A)-[*]->(C:CLUSTER), (B)-[:items]->(D:ITEM), (B)-[:items]->(E:ITEM), (E)-[:value]->(F:DATA_VALUE), (C)-[:items]->(G:ITEM), (C)-[:items]->(H:ITEM), (H)-[:value]->(I:DATA_VALUE)
(A:EHR), (A)-[*]->(B:CLUSTER), (A)-[*]->(C:CLUSTER), (B)-[:items]->(D:ELEMENT), (B)-[:items]->(E:ELEMENT), (E)-[:value]->(F:DATA_VALUE), (C)-[:items]->(G:ELEMENT), (C)-[:items]->(H:ELEMENT), (H)-[:value]->(I:DATA_VALUE)
WHERE
D.value.value = 'Natrium_g_dl' AND
G.value.value = 'H_moglobin_g_dl' AND
......
......@@ -62,7 +62,7 @@ QUERY(
*Cypher
MATCH
(A:EHR), (A)-[:ehr_id]->(B:HIER_OBJECT_ID), (A)-[*]->(C:CLUSTER), (A)-[*]->(D:CLUSTER), (C)-[:items]->(E:ITEM), (D)-[:items]->(F:ITEM)
(A:EHR), (A)-[:ehr_id]->(B:HIER_OBJECT_ID), (A)-[*]->(C:CLUSTER), (A)-[*]->(D:CLUSTER), (C)-[:items]->(E:ELEMENT), (D)-[:items]->(F:ELEMENT)
WHERE
E.value.value = 'Natrium_g_dl' AND
F.value.value = 'H_moglobin_g_dl' AND
......
......@@ -53,7 +53,7 @@ QUERY(
*Cypher
MATCH
(A:EHR), (A)-[*]->(B:CLUSTER), (A)-[*]->(C:CLUSTER), (B)-[:items]->(D:ITEM), (D)-[:value]->(E:DV_QUANTITY), (C)-[:items]->(F:ITEM), (F)-[:value]->(G:DV_QUANTITY)
(A:EHR), (A)-[*]->(B:CLUSTER), (A)-[*]->(C:CLUSTER), (B)-[:items]->(D:ELEMENT), (D)-[:value]->(E:DV_QUANTITY), (C)-[:items]->(F:ELEMENT), (F)-[:value]->(G:DV_QUANTITY)
WHERE
E.magnitude > G.magnitude AND
D.archetype_node_id = 'at0001' AND
......
......@@ -59,7 +59,7 @@ QUERY(
*Cypher
MATCH
(A:EHR), (A)-[*]->(B:CLUSTER), (A)-[*]->(C:CLUSTER), (B)-[:items]->(D:ITEM), (C)-[:items]->(E:ITEM)
(A:EHR), (A)-[*]->(B:CLUSTER), (A)-[*]->(C:CLUSTER), (B)-[:items]->(D:ELEMENT), (C)-[:items]->(E:ELEMENT)
WHERE
D.value.value = 'Natrium_g_dl' AND
E.value.value = 'H_moglobin_g_dl' AND
......
......@@ -35,7 +35,7 @@ QUERY(
*Cypher
MATCH
(A:EHR), (A)-[*]->(B:CLUSTER), (B)-[:items]->(C:ITEM), (C)-[:value]->(D:DV_QUANTITY)
(A:EHR), (A)-[*]->(B:CLUSTER), (B)-[:items]->(C:ELEMENT), (C)-[:value]->(D:DV_QUANTITY)
WHERE
120 < D.magnitude AND
C.archetype_node_id = 'at0001' AND
......
......@@ -45,7 +45,7 @@ QUERY(
*Cypher
MATCH
(A:EHR), (A)-[*]->(B:COMPOSITION), (B)-[*]->(C:OBSERVATION), (C)-[:data]->(D:HISTORY), (D)-[:events]->(E:EVENT), (E)-[:data]->(F:ITEM_TREE), (F)-[:items]->(G:ITEM), (G)-[:value]->(H:DV_QUANTITY)
(A:EHR), (A)-[*]->(B:COMPOSITION), (B)-[*]->(C:OBSERVATION), (C)-[:data]->(D:HISTORY), (D)-[:events]->(E:EVENT), (E)-[:data]->(F:ITEM_TREE), (F)-[:items]->(G:ELEMENT), (G)-[:value]->(H:DV_QUANTITY)
WHERE
B.archetype_node_id = 'openEHR-EHR-COMPOSITION.encounter.v1' AND
C.archetype_node_id = 'openEHR-EHR-OBSERVATION.blood_pressure.v2' AND
......
......@@ -77,7 +77,7 @@ QUERY(
*Cypher
MATCH
(A:EHR), (A)-[*]->(B:COMPOSITION), (B)-[*]->(C:OBSERVATION), (C)-[:data]->(D:HISTORY), (C)-[:data]->(E:HISTORY), (D)-[:events]->(F:EVENT), (F)-[:data]->(G:ITEM_TREE), (G)-[:items]->(H:ITEM), (H)-[:value]->(I:DV_QUANTITY), (E)-[:events]->(J:EVENT), (J)-[:data]->(K:ITEM_TREE), (K)-[:items]->(L:ITEM), (L)-[:value]->(M:DV_QUANTITY)
(A:EHR), (A)-[*]->(B:COMPOSITION), (B)-[*]->(C:OBSERVATION), (C)-[:data]->(D:HISTORY), (C)-[:data]->(E:HISTORY), (D)-[:events]->(F:EVENT), (F)-[:data]->(G:ITEM_TREE), (G)-[:items]->(H:ELEMENT), (H)-[:value]->(I:DV_QUANTITY), (E)-[:events]->(J:EVENT), (J)-[:data]->(K:ITEM_TREE), (K)-[:items]->(L:ELEMENT), (L)-[:value]->(M:DV_QUANTITY)
WHERE
I.magnitude >= 140 AND
H.archetype_node_id = 'at0004' AND
......
......@@ -22,15 +22,10 @@ QUERY(
'openEHR-EHR-ADMIN_ENTRY.admission.v0'
) as b),
OR(
NOT(EXISTS(FILTER(
FIELD(
ALIAS_REF('a'),
'content'
) as C,
IS(
ALIAS_REF('C'),
'openEHR-EHR-ADMIN_ENTRY.discharge_summary.v0'
)
NOT(EXISTS(INDEXED_FIELD(
ALIAS_REF('a'),
'content',
'openEHR-EHR-ADMIN_ENTRY.discharge_summary.v0'
))),
NOT(EQUALS(
FIELD(
......@@ -61,17 +56,12 @@ QUERY(
))
)
*comment
the cypher query is not ready yet.
*Cypher
MATCH
(A:EHR)-[*]->(B:COMPOSITION), (B)-[*]->(C:ADMIN_ENTRY)
OPTIONAL MATCH
(B)-[*]->(C:ADMIN_ENTRY)
WHERE
B.archetype_node_id = 'openEHR-EHR-COMPOSITION.encounter.v1' AND
C.archetype_node_id = 'openEHR-EHR-ADMIN_ENTRY.admission.v0' AND
NOT EXISTS()
MATCH
(A:EHR), (A)-[:ehr_status]->(B:EHR_STATUS), (A)-[:ehr_id]->(C:HIER_OBJECT_ID), (A)-[*]->(D:COMPOSITION), (B)-[:subject]->(E:PARTY_SELF), (E)-[:external_ref]->(F:PARTY_REF), (D)-[*]->(G:ADMIN_ENTRY)
WHERE
(NOT EXISTS ((D)-[:content]->(:ADMIN_ENTRY{archetype_node_id:'openEHR-EHR-ADMIN_ENTRY.discharge_summary.v0'})) OR NOT(F.namespace = 'CEC')) AND
D.archetype_node_id = 'openEHR-EHR-COMPOSITION.encounter.v1' AND
G.archetype_node_id = 'openEHR-EHR-ADMIN_ENTRY.admission.v0'
RETURN
A
C.value
\ No newline at end of file
......@@ -21,18 +21,10 @@ QUERY(
'ADMIN_ENTRY',
'openEHR-EHR-ADMIN_ENTRY.admission.v0'
) as b),
NOT(EXISTS(FILTER(
FIELD(
ALIAS_REF('a'),
'content'
) as C,
EQUALS(
FIELD(
ALIAS_REF('C'),
'archetype_node_id'
),
'openEHR-EHR-ADMIN_ENTRY.discharge_summary.v0'
)
NOT(EXISTS(INDEXED_FIELD(
ALIAS_REF('a'),
'content',
'openEHR-EHR-ADMIN_ENTRY.discharge_summary.v0'
)))
)
)
......@@ -45,12 +37,10 @@ the cypher query is not ready yet.
*Cypher
MATCH
(A:EHR)-[*]->(B:COMPOSITION), (B)-[*]->(C:ADMIN_ENTRY)
OPTIONAL MATCH
(B)-[*]->(D:ADMIN_ENTRY)
(A:EHR), (A)-[*]->(B:COMPOSITION), (B)-[*]->(C:ADMIN_ENTRY)
WHERE
NOT EXISTS ((B)-[:content]->(:ADMIN_ENTRY{archetype_node_id:'openEHR-EHR-ADMIN_ENTRY.discharge_summary.v0'})) AND
B.archetype_node_id = 'openEHR-EHR-COMPOSITION.encounter.v1' AND
C.archetype_node_id = 'openEHR-EHR-ADMIN_ENTRY.admission.v0' AND
NOT (C.archetype_node_id = 'openEHR-EHR-ADMIN_ENTRY.discharge_summary.v0')
C.archetype_node_id = 'openEHR-EHR-ADMIN_ENTRY.admission.v0'
RETURN
A
*AQL
SELECT e
FROM EHR e
CONTAINS COMPOSITION a[openEHR-EHR-COMPOSITION.encounter.v1]
WHERE NOT EXISTS a/content[openEHR-EHR-ADMIN_ENTRY.discharge_summary.v0]
*Graph
QUERY(
FILTER(
ITERATE('EHR') as e,
EXISTS(
CONTAINS_TYPE(
ALIAS_REF('e'),
'COMPOSITION',
'openEHR-EHR-COMPOSITION.encounter.v1'
) as a,
NOT(EXISTS(INDEXED_FIELD(
ALIAS_REF('a'),
'content',
'openEHR-EHR-ADMIN_ENTRY.discharge_summary.v0'
)))
)
),
RETURN(ALIAS_REF('e'))
)
*comment
the cypher query is not ready yet.
*Cypher
MATCH
(A:EHR), (A)-[*]->(B:COMPOSITION)
WHERE
NOT EXISTS ((B)-[:content]->(:ADMIN_ENTRY{archetype_node_id:'openEHR-EHR-ADMIN_ENTRY.discharge_summary.v0'})) AND
B.archetype_node_id = 'openEHR-EHR-COMPOSITION.encounter.v1'
RETURN
A
......@@ -86,7 +86,7 @@ QUERY(
*Cypher
MATCH
(A:EHR), (A)-[*]->(B:CLUSTER), (B)-[:items]->(C:ITEM), (B)-[:items]->(D:ITEM), (B)-[:items]->(E:ITEM), (B)-[:items]->(F:ITEM)
(A:EHR), (A)-[*]->(B:CLUSTER), (B)-[:items]->(C:ELEMENT), (B)-[:items]->(D:ELEMENT), (B)-[:items]->(E:ELEMENT), (B)-[:items]->(F:ELEMENT)
WHERE
(C.value.value = 'Calcium_g_dl' AND
D.value.value = 'Bla1_g_dl' OR E.value.value = 'Bla2_g_dl' AND
......
......@@ -35,7 +35,7 @@ QUERY(
*Cypher
MATCH
(A:EHR), (A)-[*]->(B:CLUSTER), (B)-[:items]->(C:ITEM), (C)-[:value]->(D:DV_QUANTITY)
(A:EHR), (A)-[*]->(B:CLUSTER), (B)-[:items]->(C:ELEMENT), (C)-[:value]->(D:DV_QUANTITY)
WHERE
D.magnitude = 10 AND
C.archetype_node_id = 'at0001' AND
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment