예제 #1
0
 /**
  * Instantiates a new concept expression impl.
  *
  * @param uuid the uuid
  * @param concept the concept
  */
 public ConceptExpressionImpl(UUID uuid, SnomedConcept concept) {
   super(uuid);
   if (concept != null) {
     this.concept = concept;
     conceptId = concept.getConceptID();
   } else {
     throw new IllegalArgumentException("Concept passed can not be null.");
   }
 }
예제 #2
0
  /**
   * Populate relationships.
   *
   * @param concept the concept
   */
  @Transient
  protected void populateRelationships(SnomedConcept concept) {
    // get parents and add as parent expressions
    for (SnomedConcept parent : concept.getParents()) {
      ConceptExpression parentExpression = new ConceptExpressionImpl(parent);
      parentExpression.addChildExpression(this);
    }

    // get children and add as child expressions
    for (SnomedConcept child : concept.getChildren()) {
      addChildExpression(new ConceptExpressionImpl(child));
    }

    /*
      process relationships; we know that all defining relationships and role groups associated with them
      need to go into an equivalent expression composed on an intersection expression
    */

    Collection<Expression> expressions = new HashSet<Expression>();
    for (SnomedRelationship relationship : concept.getDefiningRelationships()) {
      expressions.add(new SnomedRelationshipPropertyExpression(relationship));
    }
    // process role groups
    for (SnomedRoleGroup roleGroup : concept.getRoleGroups()) {
      expressions.add(new SnomedRoleGroupExpression(roleGroup));
    }
    // create an intersection expression and add as equivalent expression
    IntersectionExpression intersectionExpression = new IntersectionExpressionImpl(expressions);
    intersectionExpression.addChildExpression(this);

    // process refining relationships
    for (SnomedRelationship relationship : concept.getRefiningRelationships()) {
      SnomedRelationshipPropertyExpression relationshipPropertyExpression =
          new SnomedRelationshipPropertyExpression(relationship);
      relationshipPropertyExpression.addChildExpression(this);
    }
  }