Ejemplo n.º 1
0
  @Test
  public void testGetTargetCodesToNodeList() throws Exception {
    LexBIGService lbs = ServiceHolder.instance().getLexBIGService();

    CodedNodeGraph mappingGraph = lbs.getNodeGraph(MAPPING_SCHEME_URI, null, null);

    CodedNodeSet cns =
        mappingGraph.restrictToTargetCodeSystem(PARTS_SCHEME).toNodeList(null, false, true, 0, -1);

    ResolvedConceptReferencesIterator itr = cns.resolve(null, null, null);

    int count = 0;

    Set<String> foundCodes = new HashSet<String>();

    while (itr.hasNext()) {
      count++;
      foundCodes.add(itr.next().getCode());
    }

    assertEquals(3, foundCodes.size());

    assertTrue(foundCodes.contains("R0001"));
    assertTrue(foundCodes.contains("E0001"));
    assertTrue(foundCodes.contains("P0001"));
  }
  public void testT1_FNC_11() throws LBException {
    // in LexBig, a role is just an association, so this is traversing
    // associations.

    CodedNodeGraph cng =
        ServiceHolder.instance().getLexBIGService().getNodeGraph(THES_SCHEME, null, null);
    cng.restrictToAssociations(
        Constructors.createNameAndValueList(new String[] {"subClassOf"}), null);

    // role "Anatomy_Kind"
    ResolvedConceptReference[] rcr =
        cng.resolveAsList(
                Constructors.createConceptReference("Anatomy_Kind", THES_SCHEME),
                false,
                true,
                1,
                1,
                null,
                null,
                null,
                0)
            .getResolvedConceptReference();

    // check for some source (down) codes that I know should be there.
    assertTrue(rcr.length == 1);
    assertTrue(rcr[0].getConceptCode().equals("Anatomy_Kind"));

    Association[] a = rcr[0].getTargetOf().getAssociation();
    assertTrue(contains(a, "subClassOf", "Anatomic_Structure_System_or_Substance"));

    // go down one more level from one of the codes.
    ConvenienceMethods cm = new ConvenienceMethods(ServiceHolder.instance().getLexBIGService());
    a =
        new Association[] {
          cm.getAssociationForwardOneLevel(
              "Anatomic_Structure_System_or_Substance",
              "roles",
              "subClassOf",
              THES_SCHEME,
              null,
              false,
              null)
        };

    contains(a, "subClassOf", "C13018");
    contains(a, "subClassOf", "Body_Fluid_or_Substance");
  }
Ejemplo n.º 3
0
  public void testT1_FNC_02() throws LBException {

    CodedNodeSet cns =
        ServiceHolder.instance().getLexBIGService().getCodingSchemeConcepts(THES_SCHEME, null);
    cns.restrictToCodes(
        Constructors.createConceptReferenceList(
            new String[] {"Vallecula", "Palate", "Hard_Palate"}, THES_SCHEME));

    // this test is really lacking... but here is how you subset. You can
    // serialize however
    // you want from here...
    assertTrue(cns.resolveToList(null, null, null, 0).getResolvedConceptReference().length == 3);
  }
Ejemplo n.º 4
0
  @Test
  public void testT1_FNC_16() throws LBException {

    CodedNodeSet cns =
        ServiceHolder.instance().getLexBIGService().getCodingSchemeConcepts(AUTO_SCHEME, null);

    cns = cns.restrictToStatus(null, new String[] {"Retired"});
    ResolvedConceptReference[] rcr =
        cns.resolveToList(null, null, null, 0).getResolvedConceptReference();

    assertTrue(rcr.length == 1);
    assertTrue(rcr[0].getConceptCode().equals("73"));
  }
Ejemplo n.º 5
0
  /*
   * Example of listCodeRelationships
   */
  @Test
  public void testT1_FNC_31() throws LBException {
    LexBIGService lbs = ServiceHolder.instance().getLexBIGService();
    CodedNodeGraph cng = lbs.getNodeGraph(AUTO_SCHEME, null, null);

    ConceptReference ref4 = ConvenienceMethods.createConceptReference("A0001", AUTO_SCHEME);
    ConceptReference ref5 = ConvenienceMethods.createConceptReference("C0001", AUTO_SCHEME);
    ConceptReference ref6 = ConvenienceMethods.createConceptReference("Tires", "ExpendableParts");

    List<String> assocs = cng.listCodeRelationships(ref4, ref5, true);

    assertTrue(assocs.contains("hasSubtype"));

    assocs = cng.listCodeRelationships(ref4, ref6, false);

    assertTrue(assocs.contains("uses"));
  }
Ejemplo n.º 6
0
  public void testT1_FNC_17() throws LBException {

    CodedNodeSet cns =
        ServiceHolder.instance().getLexBIGService().getCodingSchemeConcepts(THES_SCHEME, null);

    cns =
        cns.restrictToMatchingDesignations(
            "heaart", SearchDesignationOption.ALL, "DoubleMetaphoneLuceneQuery", null);

    ResolvedConceptReference[] rcr =
        cns.resolveToList(null, null, null, 0).getResolvedConceptReference();

    // should have found the concept code C48589 - "Base of the Heart"
    boolean found = false;
    for (int i = 0; i < rcr.length; i++) {
      if (rcr[i].getConceptCode().equals("Base_of_the_Heart")) {
        found = true;
      }
    }
    assertTrue(found);
  }