Package edu.stanford.nlp.pipeline

Examples of edu.stanford.nlp.pipeline.CoreNLPProtos$Relation


 
  /**
   * {@inheritDoc}
   */
  public void process(RelationContainer container) {
    Relation relation;

    // mark all nodes as required
    relation = container.getEntity();
    for (RelationMember memberReference : relation.getMembers()) {
      if (memberReference.getMemberType() == EntityType.Node) {
        long nodeId = memberReference.getMemberId();
        requiredNodes.set(nodeId);
      }
    }
View Full Code Here


 
  /**
   * {@inheritDoc}
   */
  public void process(RelationContainer container) {
    Relation relation;

    // mark all nodes as required
    relation = container.getEntity();
    for (RelationMember memberReference : relation.getMembers()) {
      if (memberReference.getMemberType() == EntityType.Way) {
        long wayId = memberReference.getMemberId();
        requiredWays.set(wayId);
      }
    }
View Full Code Here

     
      processedRelations = new ArrayList<Relation>(INSERT_BULK_ROW_COUNT_RELATION);
     
      prmIndex = 1;
      for (int i = 0; i < INSERT_BULK_ROW_COUNT_RELATION; i++) {
        Relation relation;
       
        relation = relationBuffer.remove(0);
        processedRelations.add(relation);
       
        prmIndex = relationBuilder.populateEntityParameters(bulkRelationStatement, prmIndex, relation);
      }
     
      try {
        bulkRelationStatement.executeUpdate();
      } catch (SQLException e) {
        throw new OsmosisRuntimeException("Unable to bulk insert relations into the database.", e);
      }
     
      for (Relation relation : processedRelations) {
        addRelationTags(relation);
        addRelationMembers(relation);
      }
    }
   
    if (complete) {
      while (relationBuffer.size() > 0) {
        Relation relation;
       
        relation = relationBuffer.remove(0);
       
        relationBuilder.populateEntityParameters(singleRelationStatement, 1, relation);
       
View Full Code Here

    rawUserName = attributes.getValue(ATTRIBUTE_NAME_USER);
    changesetId = buildChangesetId(attributes.getValue(ATTRIBUTE_NAME_CHANGESET_ID));
   
    user = buildUser(rawUserId, rawUserName);
   
    relation = new Relation(new CommonEntityData(id, version, timestampContainer, user, changesetId));
  }
View Full Code Here

            }
            // long id, int version, TimestampContainer timestampContainer,
            // OsmUser user,
            // long changesetId, Collection<Tag> tags,
            // List<RelationMember> members
            Relation tmp;
            if (i.hasInfo()) {
                Osmformat.Info info = i.getInfo();
                tmp = new Relation(new CommonEntityData(id, info.getVersion(), getDate(info),
                        getUser(info), info.getChangeset(), tags), nodes);
            } else {
                tmp = new Relation(new CommonEntityData(id, NOVERSION, NODATE, OsmUser.NONE,
                        NOCHANGESET, tags), nodes);
            }
            sink.process(new RelationContainer(tmp));
        }
    }
View Full Code Here

 
  /**
   * {@inheritDoc}
   */
  public void process(RelationContainer relationContainer) {
    Relation relation;
    int memberSequenceId;
   
    relation = relationContainer.getEntity();
   
    relationWriter.writeField(relation.getId());
    relationWriter.writeField(relation.getVersion());
    relationWriter.writeField(relation.getUser().getId());
    relationWriter.writeField(relation.getTimestamp());
    relationWriter.writeField(relation.getChangesetId());
    relationWriter.endRecord();
   
    for (Tag tag : relation.getTags()) {
      relationTagWriter.writeField(relation.getId());
      relationTagWriter.writeField(tag.getKey());
      relationTagWriter.writeField(tag.getValue());
      relationTagWriter.endRecord();
    }
   
    memberSequenceId = 0;
    for (RelationMember member : relation.getMembers()) {
      relationMemberWriter.writeField(relation.getId());
      relationMemberWriter.writeField(member.getMemberId());
      relationMemberWriter.writeField(memberTypeValueMapper.getMemberType(member.getMemberType()));
      relationMemberWriter.writeField(member.getMemberRole());
      relationMemberWriter.writeField(memberSequenceId++);
      relationMemberWriter.endRecord();
View Full Code Here

            processedRelations = new ArrayList<Relation>(INSERT_BULK_ROW_COUNT_RELATION);

            prmIndex = 1;
            for (int i = 0; i < INSERT_BULK_ROW_COUNT_RELATION; i++) {
                Relation relation;

                relation = relationBuffer.remove(0);
                processedRelations.add(relation);

                populateRelationParameters(bulkRelationStatement, prmIndex, relation);
                prmIndex += INSERT_PRM_COUNT_RELATION;
            }

            try {
                bulkRelationStatement.executeUpdate();
            } catch (SQLException e) {
                throw new OsmosisRuntimeException("Unable to bulk insert relations into the database.", e);
            }

            for (Relation relation : processedRelations) {
                addRelationTags(relation);
                addRelationMembers(relation);
            }
        }

        if (complete) {
            while (relationBuffer.size() > 0) {
                Relation relation;

                relation = relationBuffer.remove(0);

                populateRelationParameters(singleRelationStatement, 1, relation);
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void process(RelationContainer relationContainer) {
        Relation relation;
        long relationId;

        flushWays(true);

        relation = relationContainer.getEntity();
        relationId = relation.getId();

        if (relationId >= maxRelationId) {
            maxRelationId = relationId + 1;
        }
        if (relationId < minRelationId) {
View Full Code Here

 
  /**
   * {@inheritDoc}
   */
  public void process(RelationContainer relationContainer) {
    Relation relation;
    long relationId;
    long objectOffset;
   
    relation = relationContainer.getEntity();
    relationId = relation.getId();
   
    // Write the relation to the object store and save the file offset in an
    // index keyed by relation id.
    objectOffset = relationObjectStore.add(relation);
    relationObjectOffsetIndexWriter.write(
      new LongLongIndexElement(relationId, objectOffset)
    );
   
    // Write the relation id to indexes keyed by each of the relation members.
    for (RelationMember member : relation.getMembers()) {
      EntityType memberType;
     
      memberType = member.getMemberType();
     
      if (memberType.equals(EntityType.Node)) {
View Full Code Here

 
  /**
   * {@inheritDoc}
   */
  public void process(RelationContainer container) {
    Relation relation;
    boolean inArea;
        boolean holdBackRelation;
   
    relation = container.getEntity();
   
    // First look through all the node and way members to see if any are within the filtered area
    inArea = false;
        holdBackRelation = false;

    for (RelationMember member : relation.getMembers()) {
      switch (member.getMemberType()) {
      case Node:
        inArea = availableNodes.get(member.getMemberId());
        break;
      case Way:
        inArea = availableWays.get(member.getMemberId());
        break;
      case Relation:
        inArea = availableRelations.get(member.getMemberId());
        break;
      default:
        break;
      }
     
      if (inArea) {
        break;
      }
    }

        if (cascadingRelations) { //  && referencesOtherRelation && (!inArea || clipIncompleteEntities)) {
            holdBackRelation = true;
        }

    // Check if we're storing entities for later.
    if (storeEntities || holdBackRelation) {
      allRelations.add(container);
        }
   
    // If the relation has at least one member in the filtered area.
    if (inArea) {
      availableRelations.set(relation.getId());
     
      // If we're not storing entities, we pass it on immediately.
      if (!storeEntities && !holdBackRelation) {
        emitRelation(container);
      }
View Full Code Here

TOP

Related Classes of edu.stanford.nlp.pipeline.CoreNLPProtos$Relation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.