Helper methods for adding triples
161726
protected void add(SubjectNode subject,
                       RDFName predicate,
                       ObjectNode object,
                       Set<Triple> set) throws ResourceIndexException {
        set.add(new SimpleTriple(subject, predicate, object));
    }
819330
def triplify(binding):
    
    triples = []
    if binding.data is None:
        return None, triples

    if binding.is_object:
        return triplify_object(binding)
    elif binding.is_array:
        for item in binding.items:
            _, item_triples = triplify(item)
            triples.extend(item_triples)
        return None, triples
    else:
        subject = binding.parent.subject
        triples.append((subject, binding.predicate, binding.object))
        if binding.reverse is not None:
            triples.append((binding.object, binding.reverse, subject))
        return subject, triples
26822
public void incrementCount3D(K first, K second, K third) {
    incrementCount3D(first, second, third, 1.0);
  }
39134
private Triple getLocalizedTriple(Triple triple) {
        try {
            return _connector.getElementFactory().createTriple(
                    getLocalizedResource(triple.getSubject()),
                    getLocalizedResource(triple.getPredicate()),
                    getLocalizedObject(triple.getObject()));
        } catch (GraphElementFactoryException e) {
            throw new RuntimeException("Error localizing triple", e);
        }
    }
474607
def add(v1, v2):
    '''
    '''
    return tuple(a + b for a, b in zip(v1, v2))
187879
def add_to_triplestore(self, output):
        """"""
        if len(output) > 0:
            result = self.ext_conn.load_data(data=output.serialize(),
                                             datatype='rdf')
597926
def _addf(ins):
    ''' 
    '''
    op1, op2 = tuple(ins.quad[2:])

    if _f_ops(op1, op2) is not None:
        opa, opb = _f_ops(op1, op2)
        if opb == 0:  # A + 0 => A
            output = _float_oper(opa)
            output.extend(_fpush())
            return output

    output = _float_oper(op1, op2)
    output.append('call __ADDF')
    output.extend(_fpush())
    REQUIRES.add('addf.asm')
    return output
558292
def add(one, two=4, three=False):
    ''' 
    '''
    s = str(int(one) + int(two))

    logging.debug('logging sum from hello.py:' + s)
    print 'printing sum from hello.py:', s

    return s
1052927
def version_triple(tag):
    
    groups = re.match(r'v?(\d+)\.(\d+)\.(\d+)', tag).groups()
    return tuple(int(n) for n in groups)
1102597
def from_triple(cls, triple):
        
        with ffi.OutputString() as outerr:
            target = ffi.lib.LLVMPY_GetTargetFromTriple(triple.encode('utf8'),
                                                        outerr)
            if not target:
                raise RuntimeError(str(outerr))
            target = cls(target)
            target._triple = triple
            return target
733941
def add_triple(self, subj, pred, obj):
        '''  '''
        subj_data, pred_data, obj_data = self.are_ilx([subj, pred, obj])
        # RELATIONSHIP PROPERTY
        if subj_data.get('id') and pred_data.get('id') and obj_data.get('id'):
            if pred_data['type'] != 'relationship':
                return self.test_check('Adding a relationship as formate \
                                       "term1_ilx relationship_ilx term2_ilx"')
            return self.add_relationship(term1=subj_data,
                                         relationship=pred_data,
                                         term2=obj_data)
        # ANNOTATION PROPERTY
        elif subj_data.get('id') and pred_data.get('id'):
            if pred_data['type'] != 'annotation':
                return self.test_check('Adding a relationship as formate \
                                       "term_ilx annotation_ilx value"')
            return self.add_annotation(entity=subj_data,
                                       annotation=pred_data,
                                       value=obj)
        # UPDATE ENTITY
        elif subj_data.get('id'):
            data = subj_data
            _pred = self.ttl2sci_map.get(pred)
            if not _pred:
                error = pred + " doesnt not have correct RDF format or It is not an option"
                return self.test_check(error)
            data = self.custom_update(data, _pred, obj)
            if data == 'failed':  # for debugging custom_update
                return data
            data = superclasses_bug_fix(data)
            url_base = self.base_path + 'term/edit/{id}'
            url = url_base.format(id=data['id'])
            return self.post(url, data)
        else:
            return self.test_check('The ILX ID(s) provided do not exist')
1061523
def triple_in_shape(expr: ShExJ.shapeExpr, label: ShExJ.tripleExprLabel, cntxt: Context) \
        -> Optional[ShExJ.tripleExpr]:
    
    te = None
    if isinstance(expr, (ShExJ.ShapeOr, ShExJ.ShapeAnd)):
        for expr2 in expr.shapeExprs:
            te = triple_in_shape(expr2, label, cntxt)
            if te is not None:
                break
    elif isinstance(expr, ShExJ.ShapeNot):
        te = triple_in_shape(expr.shapeExpr, label, cntxt)
    elif isinstance(expr, ShExJ.shapeExprLabel):
        se = reference_of(expr, cntxt)
        if se is not None:
            te = triple_in_shape(se, label, cntxt)
    return te
470549
def triples(self, (s, p, o), context=None):
        
        named_graph = _get_named_graph(context)
        query_sets = _get_query_sets_for_object(o)

        filter_parameters = dict()
        if named_graph is not None:
            filter_parameters['context_id'] = named_graph.id
        if s:
            filter_parameters['subject'] = s
        if p:
            filter_parameters['predicate'] = p
        if o:
            filter_parameters['object'] = o

        query_sets = [qs.filter(**filter_parameters) for qs in query_sets]  # pylint: disable=W0142

        for qs in query_sets:
            for statement in qs:
                triple = statement.as_triple()
                yield triple, context
1069719
private void addMethodDefTriples(URIReference objURI,
                                     DOReader reader,
                                     Set<Triple> set)
            throws ResourceIndexException {
        try {
            for (MethodDef element : getAbstractMethods(reader)) {
                add(objURI, MODEL.DEFINES_METHOD, element.methodName, set);
            }
        } catch (ResourceIndexException e) {
            throw e;
        } catch (Exception e) {
            throw new ResourceIndexException("Error adding method def "
                    + "triples", e);
        }
    }
1348952
function addArr(arr1, arr2, shift = 0) {
  arr2.forEach((singlet, i) => {
    addNum(arr1, singlet, i + shift);
  });
}
257385
def add3(self, target, path_settings=None, method='GET'):
        
        if path_settings is None:
            path_settings = []
        return self.add(method, path_settings, target)
313270
def add_triple(self, subject, predicate, object):
        

        def filter_ontid(ontid):
            if ontid.startswith('http://'):
                pass
            elif ontid.prefix == 'ILXTEMP':
                ontid = 'tmp_' + ontid.suffix
            else:
                ontid = 'ilx_' + ontid.suffix
            return ontid

        # this split between annotations and relationships is severely annoying
        # because you have to know before hand which one it is (sigh)
        s = OntId(subject)
        p = OntId(predicate)
        o = self._get_type(object)
        if type(o) == str:
            func = self.ilx_cli.add_annotation
        elif type(o) == OntId:
            func = self.ilx_cli.add_relationship
            o = filter_ontid(o)
        else:
            raise TypeError(f'what are you giving me?! {object!r}')

        s = filter_ontid(s)
        p = filter_ontid(p)

        resp = func(s, p, o)
        return resp