A helper function to check if the ontology term (OT) contains the ontology annotations provided
in input. If the OT has the same annotation, the OT will be considered as a good match and the
similarity scores 100 are allocated to the OT
437120
private Entity calculateNGromOTAnnotations(Entity inputEntity, Entity ontologyTermEntity) {
    OntologyTermHitEntity mapEntity =
        new OntologyTermHitEntity(ontologyTermEntity, ontologyTermHitMetaData);
    for (Entity annotationEntity :
        ontologyTermEntity.getEntities(OntologyTermMetadata.ONTOLOGY_TERM_DYNAMIC_ANNOTATION)) {
      String annotationName =
          annotationEntity.getString(OntologyTermDynamicAnnotationMetadata.NAME);
      String annotationValue =
          annotationEntity.getString(OntologyTermDynamicAnnotationMetadata.VALUE);
      for (String attributeName : inputEntity.getAttributeNames()) {
        if (StringUtils.isNotEmpty(inputEntity.getString(attributeName))
            && StringUtils.equalsIgnoreCase(attributeName, annotationName)
            && StringUtils.equalsIgnoreCase(
                inputEntity.getString(attributeName), annotationValue)) {
          mapEntity.set(SCORE, 100d);
          mapEntity.set(COMBINED_SCORE, 100d);
          return mapEntity;
        }
      }
    }
    return mapEntity;
  }
395718
def _match(self, doc, where):
        """"""
        assert isinstance(where, dict), "where is not a dictionary"
        assert isinstance(doc, dict), "doc is not a dictionary"
        try:
            return all([doc[k] == v for k, v in where.items()])
        except KeyError:
            return False
796401
function hasMetaDocsRecommended(metaPropertyNode) {
    const metaDocs = getPropertyFromObject("docs", metaPropertyNode.value);

    return metaDocs && getPropertyFromObject("recommended", metaDocs.value);
}
195777
private boolean checkMatch() {
        if (matchList == null) {
            return true;
        }
        final int matchSize = matchList.size();
        final int ancestorSize = topicIdList.size();
        final List<String> tail = topicIdList.subList(ancestorSize - matchSize, ancestorSize);
        return matchList.equals(tail);
    }
785923
def match_all_concepts(self,string):
        ''''''
        multipliers = {'exact':10**5,'fname':10**4,'fuzzy':10**2,'fuzzy_fragment':1}
        matches = []
        for concept in self.vocab:
            matches += concept.matches(string,self.fuzzy,self.fname_match,self.fuzzy_fragment,self.guess)
        return sort_matches(matches)
1313282
private boolean isSimilarSignature(Method possiblyMatchingMethod, String desiredMethodName, Class<?>[] desiredParamTypes) {
        return possiblyMatchingMethod.getName().equals(desiredMethodName) && match(possiblyMatchingMethod.getParameterTypes(), desiredParamTypes);
    }
1015519
def compare_to_xrefs(self, xg1, xg2):
        
        ont = self.merged_ontology
        for (i,j,d) in xg1.edges(data=True):
            ont_left = self._id_to_ontology(i)
            ont_right = self._id_to_ontology(j)
            unique_lr = True
            num_xrefs_left = 0
            same_left = False
            if i in xg2:
                for j2 in xg2.neighbors(i):
                    ont_right2 = self._id_to_ontology(j2)
                    if ont_right2 == ont_right:
                        unique_lr = False
                        num_xrefs_left += 1
                        if j2 == j:
                            same_left = True
            unique_rl = True
            num_xrefs_right = 0
            same_right = False
            if j in xg2:
                for i2 in xg2.neighbors(j):
                    ont_left2 = self._id_to_ontology(i2)
                    if ont_left2 == ont_left:
                        unique_rl = False
                        num_xrefs_right += 1
                        if i2 == i:
                            same_right = True

            (x,y) = d['idpair']
            xg1[x][y]['left_novel'] = num_xrefs_left==0
            xg1[x][y]['right_novel'] = num_xrefs_right==0
            xg1[x][y]['left_consistent'] = same_left
            xg1[x][y]['right_consistent'] = same_right
536416
def contains_pts(self, pts):
        """"""
        obj1, obj2 = self.objects
        arg1 = obj2.contains_pts(pts)
        arg2 = np.logical_not(obj1.contains_pts(pts))
        return np.logical_and(arg1, arg2)
1200816
@Override
    public boolean containsTerm(Term t) {
        List<Term> terms = getTerms();
        for (int i = 0; i < terms.size(); i++) {
            Term t2 = terms.get(i);
            if (t2.equals(t))
                return true;
        }
        return false;
    }
597389
def has_common(self, other):
        """"""
        if not isinstance(other, WordSet):
            raise ValueError('Can compare only WordSets')
        return self.term_set & other.term_set
633725
def Or(a: Bool, b: Bool) -> Bool:
    
    union = a.annotations + b.annotations
    return Bool(z3.Or(a.raw, b.raw), annotations=union)
706404
def matching_method(self, matching_method):
        
        allowed_values = ["CONTAINS", "STARTSWITH", "EXACT", "TAGPATH"]  # noqa: E501
        if matching_method not in allowed_values:
            raise ValueError(
                "Invalid value for `matching_method` ({0}), must be one of {1}"  # noqa: E501
                .format(matching_method, allowed_values)
            )

        self._matching_method = matching_method
362839
def match_criterion(self, tag):
        '''
        '''
        return tag.name == self.reference_tag_name and \
            tag.attrs.get('kind', '') == self.reference_tag_kind
143653
public boolean equalsTo(Object o)
    {
        if (o == null || !(o instanceof Document))
        {
            return false;
        }
        
        Document docCompared = (Document)o;
        if(getName() == null || !getName().equals(docCompared.getName())) return false;
        if(getRepository() == null || !getRepository().equals(docCompared.getRepository())) return false;
        
        return true;
    }
308991
public static boolean matches(Class<? extends Annotation> anno, String consName) {
		return VALIDATORS.get(anno).equals(consName);
	}
393026
def annotations(self, qname=True):
        
        if qname:
            return sorted([(uri2niceString(x, self.namespaces)
                            ), (uri2niceString(y, self.namespaces)), z]
                          for x, y, z in self.triples)
        else:
            return sorted(self.triples)
318609
def _is_match(self, response, answer):
        

        def compare_conditions(droppable_id, spatial_units, response_conditions):
            """Compare response coordinates with spatial units for droppable_id"""
            coordinate_match = True
            for coordinate in response_conditions['coordinate_conditions']['include'][droppable_id]:
                answer_match = False
                for spatial_unit in spatial_units:
                    if (coordinate['containerId'] == spatial_unit['containerId'] and
                            coordinate['coordinate'] in spatial_unit['spatialUnit']):
                        answer_match = True
                        break
                coordinate_match = coordinate_match and answer_match
            return coordinate_match

        # Did the consumer application already do the work for us?
        if response.has_zone_conditions():
            return bool(response.get_zone_conditions() == answer.get_zone_conditions())

        answer_conditions = self._get_conditions_map(answer)
        response_conditions = self._get_conditions_map(response)

        # Check to see if the lists of droppables used are the same:
        if set(answer_conditions['spatial_unit_conditions']['include']) != set(response_conditions['coordinate_conditions']['include']):
            return False

        # Compare included answer spatial unit areas to response coordinates
        for droppable_id, spatial_units in answer_conditions['spatial_unit_conditions']['include'].items():
            # Do the number of defined include conditions match:
            if len(spatial_units) != len(response_conditions['coordinate_conditions']['include'][droppable_id]):
                return False
            if not compare_conditions(droppable_id, spatial_units, response_conditions):
                return False

        # Compare excluded answer spatial unit areas to response coordinates
        for droppable_id, spatial_units in answer_conditions['spatial_unit_conditions']['exclude'].items():
            if compare_conditions(droppable_id, spatial_units, response_conditions):
                return False
        return True