当前位置: 首页>>代码示例>>Java>>正文


Java ElementHelper.validateProperty方法代码示例

本文整理汇总了Java中org.apache.tinkerpop.gremlin.structure.util.ElementHelper.validateProperty方法的典型用法代码示例。如果您正苦于以下问题:Java ElementHelper.validateProperty方法的具体用法?Java ElementHelper.validateProperty怎么用?Java ElementHelper.validateProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tinkerpop.gremlin.structure.util.ElementHelper的用法示例。


在下文中一共展示了ElementHelper.validateProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: vertices

import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; //导入方法依赖的package包/类
public Iterator<Vertex> vertices(String label, String key, Object value) {
    ElementHelper.validateProperty(key, value);
    IndexMetadata index = graph.getIndex(OperationType.READ, ElementType.VERTEX, label, key);
    if (index != null) {
        LOGGER.debug("Using vertex index for ({}, {})", label, key);
        return graph.getVertexIndexModel().vertices(label, index.isUnique(), key, value);
    }
    final VertexReader parser = new VertexReader(graph);

    byte[] val = ValueUtils.serializePropertyValue(graph, ElementType.VERTEX, label, key, value);
    final byte[] keyBytes = Bytes.toBytes(key);
    Scan scan = getPropertyScan(label, keyBytes, val);
    ResultScanner scanner = null;
    try {
        scanner = table.getScanner(scan);
        return HBaseGraphUtils.mapWithCloseAtEnd(scanner, parser::parse);
    } catch (IOException e) {
        throw new HBaseGraphException(e);
    }
}
 
开发者ID:rayokota,项目名称:hgraphdb,代码行数:21,代码来源:VertexModel.java

示例2: verticesInRange

import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; //导入方法依赖的package包/类
public Iterator<Vertex> verticesInRange(String label, String key, Object inclusiveFrom, Object exclusiveTo) {
    ElementHelper.validateProperty(key, inclusiveFrom);
    ElementHelper.validateProperty(key, exclusiveTo);
    IndexMetadata index = graph.getIndex(OperationType.READ, ElementType.VERTEX, label, key);
    if (index != null) {
        LOGGER.debug("Using vertex index for ({}, {})", label, key);
        return graph.getVertexIndexModel().verticesInRange(label, index.isUnique(), key, inclusiveFrom, exclusiveTo);
    }
    final VertexReader parser = new VertexReader(graph);

    byte[] fromVal = ValueUtils.serializePropertyValue(graph, ElementType.VERTEX, label, key, inclusiveFrom);
    byte[] toVal = ValueUtils.serializePropertyValue(graph, ElementType.VERTEX, label, key, exclusiveTo);
    final byte[] keyBytes = Bytes.toBytes(key);
    Scan scan = getPropertyScan(label, keyBytes, fromVal, toVal);
    ResultScanner scanner = null;
    try {
        scanner = table.getScanner(scan);
        return HBaseGraphUtils.mapWithCloseAtEnd(scanner, parser::parse);
    } catch (IOException e) {
        throw new HBaseGraphException(e);
    }
}
 
开发者ID:rayokota,项目名称:hgraphdb,代码行数:23,代码来源:VertexModel.java

示例3: property

import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public <V> Property<V> property(String name, V value) {
    ElementHelper.validateProperty(name, value);
    // validate bolt support
    Neo4JBoltSupport.checkPropertyValue(value);
    // transaction should be ready for io operations
    graph.tx().readWrite();
    // property value for key
    Neo4JEdgeProperty<V> propertyValue = new Neo4JEdgeProperty<>(this, name, value);
    // update map
    properties.put(name, propertyValue);
    // set edge as dirty
    session.dirtyEdge(this);
    // update flag
    dirty = true;
    // return property
    return propertyValue;
}
 
开发者ID:SteelBridgeLabs,项目名称:neo4j-gremlin-bolt,代码行数:22,代码来源:Neo4JEdge.java

示例4: property

import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; //导入方法依赖的package包/类
@Override
public <V> Property<V> property(final String key, final V value) {
    if (this.removed) throw elementAlreadyRemoved(Edge.class, id);
    ElementHelper.validateProperty(key, value);
    final Property oldProperty = super.property(key);
    final Property<V> newProperty = new TinkerProperty<>(this, key, value);
    if (null == this.properties) this.properties = new HashMap<>();
    this.properties.put(key, newProperty);
    TinkerHelper.autoUpdateIndex(this, key, value, oldProperty.isPresent() ? oldProperty.value() : null);
    return newProperty;

}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:13,代码来源:TinkerEdge.java

示例5: addProperty

import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; //导入方法依赖的package包/类
public <V> Property<V> addProperty(final TinkerVertex vertex, final String key, final V value) {
    ElementHelper.validateProperty(key, value);
    if (isComputeKey(key)) {
        final TinkerVertexProperty<V> property = new TinkerVertexProperty<V>((TinkerVertex) vertex, key, value) {
            @Override
            public void remove() {
                removeProperty(vertex, key, this);
            }
        };
        this.addValue(vertex, key, property);
        return property;
    } else {
        throw GraphComputer.Exceptions.providedKeyIsNotAnElementComputeKey(key);
    }
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:16,代码来源:TinkerGraphComputerView.java

示例6: property

import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; //导入方法依赖的package包/类
/**
 * Strengthen return type to {@link BlazeVertexProperty}.
 * 
 * @see BlazeGraph#vertexProperty(BlazeVertex, Cardinality, String, Object, Object...)
 */
@Override
public <V> BlazeVertexProperty<V> property(final Cardinality cardinality, 
        final String key, final V val, final Object... kvs) {
    ElementHelper.validateProperty(key, val);
    if (ElementHelper.getIdValue(kvs).isPresent())
        throw Vertex.Exceptions.userSuppliedIdsNotSupported();
    
    return graph.vertexProperty(this, cardinality, key, val, kvs);
}
 
开发者ID:blazegraph,项目名称:tinkerpop3,代码行数:15,代码来源:BlazeVertex.java

示例7: propertiesToMap

import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; //导入方法依赖的package包/类
public static Map<String, Object> propertiesToMap(Object... keyValues) {
    Map<String, Object> props = new HashMap<>();
    for (int i = 0; i < keyValues.length; i = i + 2) {
        Object key = keyValues[i];
        if (key.equals(T.id) || key.equals(T.label)) continue;
        String keyStr = key.toString();
        Object value = keyValues[i + 1];
        ElementHelper.validateProperty(keyStr, value);
        props.put(keyStr, value);
    }
    return props;
}
 
开发者ID:rayokota,项目名称:hgraphdb,代码行数:13,代码来源:HBaseGraphUtils.java

示例8: setProperty

import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; //导入方法依赖的package包/类
public void setProperty(Vertex vertex, String key, Object value) {
    try {
        HBaseVertex v = (HBaseVertex) vertex;
        ElementHelper.validateProperty(key, value);

        graph.validateProperty(v.getElementType(), v.label(), key, value);

        // delete from index model before setting property
        Object oldValue = null;
        boolean hasIndex = v.hasIndex(OperationType.WRITE, key);
        if (hasIndex) {
            // only load old value if using index
            oldValue = v.getProperty(key);
            if (oldValue != null && !oldValue.equals(value)) {
                VertexIndexRemover indexRemover = new VertexIndexRemover(graph, v, key, null);
                if (vertexIndicesMutator != null) vertexIndicesMutator.mutate(getMutationList(indexRemover.constructMutations()));
            }
        }

        v.getProperties().put(key, value);
        v.updatedAt(System.currentTimeMillis());

        if (hasIndex) {
            if (oldValue == null || !oldValue.equals(value)) {
                VertexIndexWriter indexWriter = new VertexIndexWriter(graph, v, key);
                if (vertexIndicesMutator != null) vertexIndicesMutator.mutate(getMutationList(indexWriter.constructInsertions()));
            }
        }
        PropertyWriter propertyWriter = new PropertyWriter(graph, v, key, value);
        if (verticesMutator != null) verticesMutator.mutate(getMutationList(propertyWriter.constructMutations()));
    } catch (IOException e) {
        throw new HBaseGraphException(e);
    }
}
 
开发者ID:rayokota,项目名称:hgraphdb,代码行数:35,代码来源:HBaseBulkLoader.java

示例9: verticesWithLimit

import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; //导入方法依赖的package包/类
public Iterator<Vertex> verticesWithLimit(String label, String key, Object from, int limit, boolean reversed) {
    ElementHelper.validateProperty(key, from != null ? from : new Object());
    IndexMetadata index = graph.getIndex(OperationType.READ, ElementType.VERTEX, label, key);
    if (index != null) {
        LOGGER.debug("Using vertex index for ({}, {})", label, key);
        return graph.getVertexIndexModel().verticesWithLimit(label, index.isUnique(), key, from, limit, reversed);
    }
    throw new HBaseGraphNotValidException("Method verticesWithLimit requires an index be defined");
}
 
开发者ID:rayokota,项目名称:hgraphdb,代码行数:10,代码来源:VertexModel.java

示例10: setProperty

import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; //导入方法依赖的package包/类
public void setProperty(String key, Object value) {
    ElementHelper.validateProperty(key, value);

    graph.validateProperty(getElementType(), label, key, value);

    // delete from index model before setting property
    Object oldValue = null;
    boolean hasIndex = hasIndex(OperationType.WRITE, key);
    if (hasIndex) {
        // only load old value if using index
        oldValue = getProperty(key);
        if (oldValue != null && !oldValue.equals(value)) {
            deleteFromIndexModel(key, null);
        }
    }

    getProperties().put(key, value);
    updatedAt(System.currentTimeMillis());

    if (hasIndex) {
        if (oldValue == null || !oldValue.equals(value)) {
            writeToIndexModel(key);
        }
    }
    Mutator writer = getModel().writeProperty(this, key, value);
    Mutators.write(getTable(), writer);
}
 
开发者ID:rayokota,项目名称:hgraphdb,代码行数:28,代码来源:HBaseElement.java

示例11: incrementProperty

import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; //导入方法依赖的package包/类
public void incrementProperty(String key, long value) {
    if (!graph.configuration().getUseSchema()) {
        throw new HBaseGraphNoSchemaException("Schema not enabled");
    }
    ElementHelper.validateProperty(key, value);

    graph.validateProperty(getElementType(), label, key, value);

    updatedAt(System.currentTimeMillis());

    Mutator writer = getModel().incrementProperty(this, key, value);
    long newValue = Mutators.increment(getTable(), writer, key);
    getProperties().put(key, newValue);
}
 
开发者ID:rayokota,项目名称:hgraphdb,代码行数:15,代码来源:HBaseElement.java

示例12: property

import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; //导入方法依赖的package包/类
@Override
public <V> Property<V> property(final String key, final V value) {
    ElementHelper.validateProperty(key, value);
    if (null == edgeProperties)
        edgeProperties = new HashMap<>();
    Map<String, Object> properties = edgeProperties.get(this.id);
    if (null == properties) {
        properties = new HashMap<>();
        edgeProperties.put(this.id, properties);
    }
    properties.put(key, value);
    return new StarProperty<>(key, value, this);
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:14,代码来源:StarGraph.java

示例13: property

import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; //导入方法依赖的package包/类
@Override
public <V> Property<V> property(final String key, final V value) {
    if (this.removed) throw elementAlreadyRemoved(Edge.class, id);
    ElementHelper.validateProperty(key, value);
 //   final Property oldProperty = super.property(key);
    final Property<V> newProperty = new LiteProperty<V>(this, key, value);
    this.properties.put(key,newProperty);//此处逻辑是不更新,直接替换
    insertProperty(EDGE_PROPERTIES + this.id, key, value);
    return newProperty;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:11,代码来源:LiteEdge.java

示例14: property

import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; //导入方法依赖的package包/类
@Override
public <V> Property<V> property(final String key, final V value) {
    ElementHelper.validateProperty(key, value);
    this.graph.tx().readWrite();
    try {
        this.baseElement.setProperty(key, value);
        return new Neo4jProperty<>(this, key, value);
    } catch (final IllegalArgumentException e) {
        throw Property.Exceptions.dataTypeOfPropertyValueNotSupported(value, e);
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:12,代码来源:Neo4jEdge.java

示例15: property

import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; //导入方法依赖的package包/类
@Override
public <V> VertexProperty<V> property(final VertexProperty.Cardinality cardinality, final String key, final V value, final Object... keyValues) {
    ElementHelper.validateProperty(key, value);
    if (ElementHelper.getIdValue(keyValues).isPresent())
        throw Vertex.Exceptions.userSuppliedIdsNotSupported();
    this.graph.tx().readWrite();
    return this.graph.trait.setVertexProperty(this, cardinality, key, value, keyValues);
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:9,代码来源:Neo4jVertex.java


注:本文中的org.apache.tinkerpop.gremlin.structure.util.ElementHelper.validateProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。