Gets version of predicate and sees if we have a translation to a common relation.
            INPUT:
                pred = predicate from the triple
            OUTPUT:
                Common relationship or None
497054
def get_common_pred(self, pred):
        ''' 
        '''
        pred = self.clean_pred(pred)
        common_pred = self.pred2common.get(pred)
        return common_pred
571043
def _get_any_translated_model(self, meta=None):
        
        if meta is None:
            meta = self._parler_meta.root

        tr_model = meta.model
        local_cache = self._translations_cache[tr_model]
        if local_cache:
            # There is already a language available in the case. No need for queries.
            # Give consistent answers if they exist.
            check_languages = [self._current_language] + self.get_fallback_languages()
            try:
                for fallback_lang in check_languages:
                    trans = local_cache.get(fallback_lang, None)
                    if trans and not is_missing(trans):
                        return trans
                return next(t for t in six.itervalues(local_cache) if not is_missing(t))
            except StopIteration:
                pass

        try:
            # Use prefetch if available, otherwise perform separate query.
            prefetch = self._get_prefetched_translations(meta=meta)
            if prefetch is not None:
                translation = prefetch[0]  # Already a list
            else:
                translation = self._get_translated_queryset(meta=meta)[0]
        except IndexError:
            return None
        else:
            local_cache[translation.language_code] = translation
            _cache_translation(translation)
            return translation
159755
def relation
      return unless @builder
      return unless @builder.object
      return unless @builder.object.relations
      relation = @builder.object.relations[attribute_name.to_s]
      raise "Relation #{attribute_name} not found" unless relation
      relation
    end
688821
def predicate(self, name, func=None):
        
        if func is None:
            return functools.partial(self.predicate, name)
        self.predicates[name] = func
        return func
715360
def get_result(self):
        
        translated = self.translate(self.expr)
        if self._needs_name(self.expr):
            # TODO: this could fail in various ways
            name = self.expr.get_name()
            translated = self.name(translated, name)
        return translated
1257561
def predicates_overlap(tags1: List[str], tags2: List[str]) -> bool:
    
    # Get predicate word indices from both predictions
    pred_ind1 = get_predicate_indices(tags1)
    pred_ind2 = get_predicate_indices(tags2)

    # Return if pred_ind1 pred_ind2 overlap
    return any(set.intersection(set(pred_ind1), set(pred_ind2)))
721826
def get_relations(self, rel_id=None, **kwargs):
        
        return self.get_elements(Relation, elem_id=rel_id, **kwargs)
890178
def triples(self, source=None, relation=None, target=None):
        
        triplematch = lambda t: (
            (source is None or source == t.source) and
            (relation is None or relation == t.relation) and
            (target is None or target == t.target)
        )
        return list(filter(triplematch, self._triples))
660348
def visitPredicate(self, ctx: ShExDocParser.PredicateContext):
        
        self.expression.predicate = self.context.predicate_to_IRI(ctx)
82968
def predicate_to_IRI(self, predicate: ShExDocParser.PredicateContext) -> ShExJ.IRIREF:
        
        if predicate.iri():
            return self.iri_to_iriref(predicate.iri())
        else:
            return RDF_TYPE
401894
def has_one(relation_name, *all_args)
      # rubocop:enable Style/PredicateName

      args = all_args.pop

      relation = {
        type: :has_one,
        relation_name: relation_name,
        table_name: args[:table_name] || StringCases.pluralize(relation_name),
        args: args,
        all_args: all_args
      }

      if args[:foreign_key]
        relation[:foreign_key] = args.fetch(:foreign_key)
      else
        relation[:foreign_key] = :"#{StringCases.camel_to_snake(name)}_id"
      end

      relation[:dependent] = args.fetch(:dependent) if args[:dependent]

      if args && args[:class_name]
        relation[:class_name] = args.fetch(:class_name)
      else
        relation[:class_name] = StringCases.snake_to_camel(relation_name)
      end

      @has_one_relations ||= []
      @has_one_relations << relation

      relationships[relation_name] = relation

      define_method(relation_name) do
        if (model = autoloads[relation_name])
          model
        elsif relation[:args][:through]
          __send__(relation[:args][:through]).__send__(relation_name)
        else
          class_instance = StringCases.constantize(relation.fetch(:class_name))

          query = class_instance.where(relation.fetch(:foreign_key) => id)
          query.previous_model = self
          query.relation = relation

          all_args.each do |arg|
            query = query.instance_exec(&arg) if arg.is_a?(Proc)
          end

          query.first
        end
      end
    end
155613
def predicatesIn(G: Graph, n: Node) -> Set[TriplePredicate]:
    
    return {p for _, p in G.subject_predicates(n)}
525357
def get_in(d, t, default=None):
    
    result = reduce(lambda d, t: d.get(t, {}), t, d)
    if not result:
        return default
    else:
        return result
128302
def predicates(G: Graph, n: Node) -> Set[TriplePredicate]:
    
    return predicatesOut(G, n) | predicatesIn(G, n)
545460
def _if(cls, verb):
        
        pred = verb.predicate
        data = verb.data
        groups = set(_get_groups(verb))

        # force predicate
        if isinstance(pred, str):
            if not pred.endswith('_dtype'):
                pred = '{}_dtype'.format(pred)
            pred = getattr(pdtypes, pred)
        elif pdtypes.is_bool_dtype(np.array(pred)):
            # Turn boolean array into a predicate function
            it = iter(pred)

            def pred(col):
                return next(it)

        return [col for col in data
                if pred(data[col]) and col not in groups]
544769
public static <E> Optional<E> find(final Iterable<E> iterable, final Predicate<E> pred) {
        for (E element : iterable) {
            if (pred.test(element)) {
                return Optional.of(element);
            }
        }
        return Optional.absent();
    }
1189666
def get_relation(self, relation):
        
        from .relations import Relation

        with Relation.no_constraints(True):
            rel = getattr(self.get_model(), relation)()

        nested = self._nested_relations(relation)

        if len(nested) > 0:
            rel.get_query().with_(nested)

        return rel