Add the clause to create a relationship between nodes
519055
private function createRelationship(
        Identity $identity,
        object $entity,
        Query $query
    ): Query {
        $meta = ($this->metadata)(\get_class($entity));
        $data = ($this->extract)($entity);
        $start = $data->get($meta->startNode()->property());
        $end = $data->get($meta->endNode()->property());
        $varName = $this->name->sprintf(\md5($identity->value()));
        $startName = $this->name->sprintf(\md5($start));
        $endName = $this->name->sprintf(\md5($end));

        $paramKey = $varName->append('_props');
        $properties = $this->buildProperties($meta->properties(), $paramKey);
        $keysToKeep = $data->keys()->intersect($properties->keys());

        return $this
            ->matchEdge(
                $endName,
                $meta->endNode(),
                $end,
                $this->matchEdge(
                    $startName,
                    $meta->startNode(),
                    $start,
                    $query
                )
            )
            ->create((string) $startName)
            ->linkedTo((string) $endName)
            ->through(
                (string) $meta->type(),
                (string) $varName,
                'right'
            )
            ->withProperty(
                $meta->identity()->property(),
                (string) $paramKey
                    ->prepend('{')
                    ->append('}.')
                    ->append($meta->identity()->property())
            )
            ->withProperties($properties->reduce(
                [],
                static function(array $carry, string $property, string $cypher): array {
                    $carry[$property] = $cypher;

                    return $carry;
                }
            ))
            ->withParameter(
                (string) $paramKey,
                $data
                    ->filter(static function(string $key) use ($keysToKeep): bool {
                        return $keysToKeep->contains($key);
                    })
                    ->put($meta->identity()->property(), $identity->value())
                    ->reduce(
                        [],
                        static function(array $carry, string $key, $value): array {
                            $carry[$key] = $value;

                            return $carry;
                        }
                    )
            );
    }
1143141
def add_clause(self, clause, no_return=True):
        

        if self.lingeling:
            pysolvers.lingeling_add_cl(self.lingeling, clause)
1360569
private static void formatElseIfClauseWithNoDependencies(
      IfThenPair<?> condition, FormattingContext ctx) {
    ctx.append(" else if (").appendOutputExpression(condition.predicate).append(") ");
    try (FormattingContext ignored = ctx.enterBlock()) {
      ctx.appendAll(condition.consequent);
    }
  }
1043215
public function addConstraints()
    {
        if (static::$constraints)
        {
            /**
             * For belongs to relationships, which are essentially the inverse of has one
             * or has many relationships, we need to actually query on the primary key
             * of the parent model matching on the INCOMING relationship by name.
             *
             * We are trying to achieve a Cypher that goes something like:
             *
             * MATCH (phone:`Phone`), (phone)<-[:PHONE]-(owner:`User`)
             * WHERE id(phone) = 1006
             * RETURN owner;
             *
             * (phone:`Phone`) represents a matching statement where
             * 'phone' is the parent Node's placeholder and '`Phone`' is the parentLabel.
             * All node placeholders must be lowercased letters and will be used
             * throught the query to represent the actual Node.
             *
             * Resulting from:
             * class Phone extends NeoEloquent {
             *
             *     public function owner()
             *     {
             *          return $this->belongsTo('User', 'PHONE');
             *     }
             * }
            */

            // Get the parent node's placeholder.
            $parentNode = $this->query->getQuery()->modelAsNode($this->parent->getTable());
            // Tell the query that we only need the related model returned.
            $this->query->select($this->relation);
            // Set the parent node's placeholder as the RETURN key.
            $this->query->getQuery()->from = array($parentNode);
            // Build the MATCH ()<-[]-() Cypher clause.
            $this->query->matchIn($this->parent, $this->related, $this->relation, $this->foreignKey, $this->ownerKey, $this->parent->{$this->ownerKey});
            // Add WHERE clause over the parent node's matching key = value.
            $this->query->where($this->ownerKey, '=', $this->parent->{$this->ownerKey});
        }
    }
721683
@Override
    public Node visitJoinRelation(SqlBaseParser.JoinRelationContext context)
    {
        Relation left = (Relation) visit(context.left);
        Relation right;

        if (context.CROSS() != null) {
            right = (Relation) visit(context.right);
            return new Join(getLocation(context), Join.Type.CROSS, left, right, Optional.empty());
        }

        JoinCriteria criteria;
        if (context.NATURAL() != null) {
            right = (Relation) visit(context.right);
            criteria = new NaturalJoin();
        }
        else {
            right = (Relation) visit(context.rightRelation);
            if (context.joinCriteria().ON() != null) {
                criteria = new JoinOn((Expression) visit(context.joinCriteria().booleanExpression()));
            }
            else if (context.joinCriteria().USING() != null) {
                criteria = new JoinUsing(visit(context.joinCriteria().identifier(), Identifier.class));
            }
            else {
                throw new IllegalArgumentException("Unsupported join criteria");
            }
        }

        Join.Type joinType;
        if (context.joinType().LEFT() != null) {
            joinType = Join.Type.LEFT;
        }
        else if (context.joinType().RIGHT() != null) {
            joinType = Join.Type.RIGHT;
        }
        else if (context.joinType().FULL() != null) {
            joinType = Join.Type.FULL;
        }
        else {
            joinType = Join.Type.INNER;
        }

        return new Join(getLocation(context), joinType, left, right, Optional.of(criteria));
    }
521762
def wordrelationships(relationshiplist):
    ''''''
    # Default list of relationships
    # FIXME: using string hack instead of making element
    #relationships = makeelement('Relationships', nsprefix='pr')
    relationships = etree.fromstring(
        '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006'
        '/relationships"></Relationships>')
    count = 0
    for relationship in relationshiplist:
        # Relationship IDs (rId) start at 1.
        rel_elm = makeelement('Relationship', nsprefix=None,
                              attributes={'Id':     'rId'+str(count+1),
                                          'Type':   relationship[0],
                                          'Target': relationship[1]}
                              )
        relationships.append(rel_elm)
        count += 1
    return relationships
454595
private void connectNodesIfNecessary(AbstractPlanNode node) {
        NodeSchema outputSchema = node.getOutputSchema();
        if (outputSchema != null) {
            for (SchemaColumn col : outputSchema) {
                connectPredicateStmt(col.getExpression());
            }
        }
        if (node instanceof AbstractScanPlanNode) {
            AbstractScanPlanNode scanNode = (AbstractScanPlanNode)node;
            connectPredicateStmt(scanNode.getPredicate());
            // If this is common table scan, we connect the scan node to the
            // plan nodes for the base and recursive query.
            if (scanNode instanceof SeqScanPlanNode) {
                SeqScanPlanNode seqScanNode = (SeqScanPlanNode)scanNode;
                connectCTENodesIfAny(seqScanNode);
            }
        } else if (node instanceof AbstractJoinPlanNode) {
            AbstractJoinPlanNode joinNode = (AbstractJoinPlanNode)node;
            connectPredicateStmt(joinNode.getPreJoinPredicate());
            connectPredicateStmt(joinNode.getJoinPredicate());
            connectPredicateStmt(joinNode.getWherePredicate());
        } else if (node instanceof AggregatePlanNode) {
            AggregatePlanNode aggNode = (AggregatePlanNode)node;
            connectPredicateStmt(aggNode.getPostPredicate());
        }

        for (AbstractPlanNode inlineNode: node.getInlinePlanNodes().values()) {
            connectNodesIfNecessary(inlineNode);
        }
    }
1047170
def add_node(self, node):
        """"""
        num_agents = len(self.nodes(type=Agent))
        curr_generation = int((num_agents - 1) / float(self.generation_size))
        node.generation = curr_generation

        if curr_generation == 0 and self.initial_source:
            parent = self._select_oldest_source()
        else:
            parent = self._select_fit_node_from_generation(
                node_type=type(node), generation=curr_generation - 1
            )

        if parent is not None:
            parent.connect(whom=node)
            parent.transmit(to_whom=node)
1222503
def _add_nodes(self):
        """"""
        for n, atom in enumerate(self.ast.select('atom')):
            self.add_node(n, atom=atom)
            self._atom_indices[id(atom)] = n
436325
def add_node(self, node_name, dataframe=False):
        
        if node_name is None:
            return None
        return self.add_nodes([node_name], dataframe=dataframe)
109574
def add_node(self, node):
        """"""
        nodes = self.nodes()

        if len(nodes) > 1:
            first_node = min(nodes, key=attrgetter("creation_time"))
            first_node.connect(direction="both", whom=node)
525875
def _add_subject_node(self, node, subj_str):
        """"""
        child = node.add_child(name=subj_str)
        child.add_feature(SUBJECT_NODE_TAG, True)
        return child
157282
function buildJoinRelation (join) {
    // if there is already a join on this relation then throw error
    assert.ok(!this.joinRelations[join.relation], 'join already exists for '+join.relation)
    // get relation for join
    var relation = this.model.relation(join.relation)
    // add join to joins
    this.joinRelations[join.relation] = join
    this.joinRelationNames.push(join.relation)
    // create alias for relation table to use in query
    join.relationAlias = this.newAlias(relation.model.name)
    // if join is via another model then join on that table
    if (relation.via) {
        // create alias for via table to use in query
        join.viaAlias = this.newAlias(relation.viaModel.name)
        // add join on alias table to query
        this.join.push( this.joinSql(relation.viaModel.name, join.viaAlias, relation.viaModelIdColumn, this.alias, relation.modelIdColumn, join.left ? 'LEFT JOIN' : 'JOIN') )
        // add join from alias to relation table to query
        this.join.push( this.joinSql(relation.model.name, join.relationAlias, relation.relationIdColumn, join.viaAlias, relation.viaRelationIdColumn, join.left ? 'LEFT JOIN' : 'JOIN') )
    }
    // join directly to related table
    else {
        this.join.push( this.joinSql(relation.model.name, join.relationAlias, relation.relationIdColumn, this.alias, relation.modelIdColumn, join.left ? 'LEFT JOIN' : 'JOIN') )
    }
}
996172
def add_node(self, node):
        """"""
        for predecessor in self._most_recent_predecessors_to(node):
            predecessor.connect(whom=node)
1158828
def _add_nodes_edges(self, subj_agent, obj_agent, relation, evidences):
        """"""
        subj_data, subj_edge = _get_agent_node(subj_agent)
        obj_data, obj_edge = _get_agent_node(obj_agent)
        # If we failed to create nodes for subject or object, skip it
        if subj_data is None or obj_data is None:
            return
        subj_node = self.model.add_node_from_data(subj_data)
        obj_node = self.model.add_node_from_data(obj_data)
        edge_data_list = \
            _combine_edge_data(relation, subj_edge, obj_edge, evidences)
        for edge_data in edge_data_list:
            self.model.add_edge(subj_node, obj_node, **edge_data)
277438
function createNodes(entityRanges, decoratorRanges = [], textArray, block) {
  let lastIndex = 0;
  const mergedRanges = [...entityRanges, ...decoratorRanges].sort((a, b) => a.offset - b.offset);
  const nodes = [];
  // if thers no entities will return just a single item
  if (mergedRanges.length < 1) {
    nodes.push(new ContentNode({ block, start: 0, end: textArray.length }));
    return nodes;
  }

  mergedRanges.forEach((range) => {
    // create an empty node for content between previous and this entity
    if (range.offset > lastIndex) {
      nodes.push(new ContentNode({ block, start: lastIndex, end: range.offset }));
    }
    // push the node for the entity
    nodes.push(new ContentNode({
      block,
      entity: range.key,
      decorator: range.component,
      decoratorProps: range.decoratorProps,
      decoratedText: range.component
        ? getString(textArray, range.offset, range.offset + range.length)
        : undefined,
      start: range.offset,
      end: range.offset + range.length,
      contentState: range.contentState,
    }));
    lastIndex = range.offset + range.length;
  });

  // finaly add a node for the remaining text if any
  if (lastIndex < textArray.length) {
    nodes.push(new ContentNode({
      block,
      start: lastIndex,
      end: textArray.length,
    }));
  }
  return nodes;
}
229262
def dependency(self, node1, node2):
        ""
        self.graph.add_node(node1)
        self.graph.add_node(node2)
        self.graph.add_edge(node2, node1)