QuickstartCqlVisitor extends cqlBaseVisitor { public Collection<Retrieve> getRetrieves() { return Collections.unmodifiableSet(retrieves); } QuickstartCqlVisitor(); String getLibrary(); String getVersion(); Collection<String> getVariables(); Map<String, ValueSet> getValuesets(); Collection<Retrieve> getRetrieves(); @Override Object visitLibraryDefinition(@NotNull cqlParser.LibraryDefinitionContext ctx); @Override Object visitLetStatement(@NotNull cqlParser.LetStatementContext ctx); @Override ValueSet visitValueset(@NotNull cqlParser.ValuesetContext ctx); @Override Object visitValuesetDefinition(@NotNull cqlParser.ValuesetDefinitionContext ctx); @Override Object visitMethodExpressionTerm(@NotNull cqlParser.MethodExpressionTermContext ctx); @Override Object visitRetrieve(@NotNull cqlParser.RetrieveContext ctx); @Override String visitStringLiteral(@NotNull cqlParser.StringLiteralContext ctx); static void main(String[] args);  }
@Test public void testRetrieve() { QuickstartCqlVisitor v = visitLogic( "valueset \"Acute Pharyngitis\" = ValueSet('2.16.840.1.113883.3.464.1003.102.12.1011')\n" + "let pharyngitis = [Condition: \"Acute Pharyngitis\"]"); Collection<Retrieve> rSet = v.getRetrieves(); assertEquals(rSet.size(), 1); Retrieve r = rSet.iterator().next(); assertEquals(r.getExistence(), Retrieve.Existence.Occurrence); assertEquals(r.getTopic(), "Condition"); assertEquals(r.getValueset(), new ValueSet("2.16.840.1.113883.3.464.1003.102.12.1011")); assertNull(r.getModality()); }
@Test public void testRetrieveNonOccurrence() { QuickstartCqlVisitor v = visitLogic( "valueset \"Office Visit\" = ValueSet('2.16.840.1.113883.3.464.1003.101.12.1001')\n" + "let encounter = [NonOccurrence of Encounter, Performance: \"Office Visit\"]"); Collection<Retrieve> rSet = v.getRetrieves(); assertEquals(rSet.size(), 1); Retrieve r = rSet.iterator().next(); assertEquals(r.getExistence(), Retrieve.Existence.NonOccurrence); assertEquals(r.getTopic(), "Encounter"); assertEquals(r.getModality(), "Performance"); assertEquals(r.getValueset(), new ValueSet("2.16.840.1.113883.3.464.1003.101.12.1001")); }
@Test public void testMultipleRetrieveReferencesArentDoubleCounted() { QuickstartCqlVisitor v = visitLogic( "valueset \"Acute Pharyngitis\" = ValueSet('2.16.840.1.113883.3.464.1003.102.12.1011')\n" + "let pharyngitis = [Condition: \"Acute Pharyngitis\"]\n" + "let pharyngitis_two = [Condition: \"Acute Pharyngitis\"]"); Collection<Retrieve> rSet = v.getRetrieves(); assertEquals(rSet.size(), 1); }