• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Cardinality类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.thinkaurelius.titan.core.Cardinality的典型用法代码示例。如果您正苦于以下问题:Java Cardinality类的具体用法?Java Cardinality怎么用?Java Cardinality使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Cardinality类属于com.thinkaurelius.titan.core包,在下文中一共展示了Cardinality类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getMapping

import com.thinkaurelius.titan.core.Cardinality; //导入依赖的package包/类
public static final Map<String,KeyInformation> getMapping(final IndexFeatures indexFeatures) {
    Preconditions.checkArgument(indexFeatures.supportsStringMapping(Mapping.TEXTSTRING) ||
            (indexFeatures.supportsStringMapping(Mapping.TEXT) && indexFeatures.supportsStringMapping(Mapping.STRING)),
            "Index must support string and text mapping");
    return new HashMap<String,KeyInformation>() {{
        put(TEXT,new StandardKeyInformation(String.class, Cardinality.SINGLE, new Parameter("mapping",
                indexFeatures.supportsStringMapping(Mapping.TEXT)?Mapping.TEXT:Mapping.TEXTSTRING)));
        put(TIME,new StandardKeyInformation(Long.class, Cardinality.SINGLE));
        put(WEIGHT,new StandardKeyInformation(Double.class, Cardinality.SINGLE, new Parameter("mapping",Mapping.DEFAULT)));
        put(LOCATION,new StandardKeyInformation(Geoshape.class, Cardinality.SINGLE));
        put(NAME,new StandardKeyInformation(String.class, Cardinality.SINGLE, new Parameter("mapping",
                indexFeatures.supportsStringMapping(Mapping.STRING)?Mapping.STRING:Mapping.TEXTSTRING)));
        if(indexFeatures.supportsCardinality(Cardinality.LIST)) {
            put(PHONE_LIST, new StandardKeyInformation(String.class, Cardinality.LIST, new Parameter("mapping",
                    indexFeatures.supportsStringMapping(Mapping.STRING) ? Mapping.STRING : Mapping.TEXTSTRING)));
        }
        if(indexFeatures.supportsCardinality(Cardinality.SET)) {
            put(PHONE_SET, new StandardKeyInformation(String.class, Cardinality.SET, new Parameter("mapping",
                    indexFeatures.supportsStringMapping(Mapping.STRING) ? Mapping.STRING : Mapping.TEXTSTRING)));
        }
        put(DATE,new StandardKeyInformation(Instant.class, Cardinality.SINGLE));
    }};
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:24,代码来源:IndexProviderTest.java


示例2: testTinkerPopCardinality

import com.thinkaurelius.titan.core.Cardinality; //导入依赖的package包/类
@Test
public void testTinkerPopCardinality() {
    PropertyKey id = mgmt.makePropertyKey("id").cardinality(Cardinality.SINGLE).dataType(Integer.class).make();
    PropertyKey name = mgmt.makePropertyKey("name").cardinality(Cardinality.SINGLE).dataType(String.class).make();
    PropertyKey names = mgmt.makePropertyKey("names").cardinality(Cardinality.LIST).dataType(String.class).make();

    mgmt.buildIndex("byId", Vertex.class).addKey(id).buildCompositeIndex();

    finishSchema();
    GraphTraversalSource gts;
    Vertex v;

    v = graph.addVertex("id", 1);
    v.property(single, "name", "t1");
    graph.addVertex("id", 2, "names", "n1", "names", "n2");
    graph.tx().commit();

    gts = graph.traversal();
    v = gts.V().has("id", 1).next();
    v.property(single, "name", "t2");
    v = gts.V().has("id", 1).next();
    v.property(single, "name", "t3");
    assertCount(1, gts.V(v).properties("name"));
    assertCount(2, gts.V().has("id", 2).properties("names"));
    assertCount(2, gts.V().hasLabel("vertex"));
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:27,代码来源:TitanGraphTest.java


示例3: testMultiplicityCardinality

import com.thinkaurelius.titan.core.Cardinality; //导入依赖的package包/类
@Test
public void testMultiplicityCardinality() {
    assertEquals(Multiplicity.MULTI,Multiplicity.convert(Cardinality.LIST));
    assertEquals(Multiplicity.SIMPLE,Multiplicity.convert(Cardinality.SET));
    assertEquals(Multiplicity.MANY2ONE,Multiplicity.convert(Cardinality.SINGLE));

    assertEquals(Multiplicity.MULTI.getCardinality(),Cardinality.LIST);
    assertEquals(Multiplicity.SIMPLE.getCardinality(),Cardinality.SET);
    assertEquals(Multiplicity.MANY2ONE.getCardinality(),Cardinality.SINGLE);

    assertFalse(Multiplicity.MULTI.isConstrained());
    assertTrue(Multiplicity.SIMPLE.isConstrained());
    assertTrue(Multiplicity.ONE2ONE.isConstrained());

    assertTrue(Multiplicity.ONE2ONE.isConstrained(Direction.BOTH));
    assertTrue(Multiplicity.SIMPLE.isConstrained(Direction.BOTH));

    assertFalse(Multiplicity.MULTI.isUnique(Direction.OUT));
    assertTrue(Multiplicity.MANY2ONE.isUnique(Direction.OUT));
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:21,代码来源:TestCoreElements.java


示例4: testSupport

import com.thinkaurelius.titan.core.Cardinality; //导入依赖的package包/类
@Test
public void testSupport() {
    assertTrue(index.supports(of(String.class, Cardinality.SINGLE), Text.CONTAINS));
    assertTrue(index.supports(of(String.class, Cardinality.SINGLE, new Parameter("mapping", Mapping.TEXT)), Text.CONTAINS_PREFIX));
    assertTrue(index.supports(of(String.class, Cardinality.SINGLE, new Parameter("mapping", Mapping.TEXT)), Text.CONTAINS_REGEX));
    assertFalse(index.supports(of(String.class, Cardinality.SINGLE, new Parameter("mapping", Mapping.TEXT)), Text.REGEX));
    assertFalse(index.supports(of(String.class, Cardinality.SINGLE, new Parameter("mapping",Mapping.STRING)), Text.CONTAINS));
    assertTrue(index.supports(of(String.class, Cardinality.SINGLE, new Parameter("mapping", Mapping.STRING)), Text.PREFIX));
    assertTrue(index.supports(of(String.class, Cardinality.SINGLE, new Parameter("mapping", Mapping.STRING)), Text.REGEX));
    assertTrue(index.supports(of(String.class, Cardinality.SINGLE, new Parameter("mapping",Mapping.STRING)), Cmp.EQUAL));
    assertTrue(index.supports(of(String.class, Cardinality.SINGLE, new Parameter("mapping",Mapping.STRING)), Cmp.NOT_EQUAL));

    assertTrue(index.supports(of(Date.class, Cardinality.SINGLE), Cmp.EQUAL));
    assertTrue(index.supports(of(Date.class, Cardinality.SINGLE), Cmp.LESS_THAN_EQUAL));
    assertTrue(index.supports(of(Date.class, Cardinality.SINGLE), Cmp.LESS_THAN));
    assertTrue(index.supports(of(Date.class, Cardinality.SINGLE), Cmp.GREATER_THAN));
    assertTrue(index.supports(of(Date.class, Cardinality.SINGLE), Cmp.GREATER_THAN_EQUAL));
    assertTrue(index.supports(of(Date.class, Cardinality.SINGLE), Cmp.NOT_EQUAL));

    assertTrue(index.supports(of(Boolean.class, Cardinality.SINGLE), Cmp.EQUAL));
    assertTrue(index.supports(of(Boolean.class, Cardinality.SINGLE), Cmp.NOT_EQUAL));

    assertTrue(index.supports(of(UUID.class, Cardinality.SINGLE), Cmp.EQUAL));
    assertTrue(index.supports(of(UUID.class, Cardinality.SINGLE), Cmp.NOT_EQUAL));
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:26,代码来源:ElasticSearchIndexTest.java


示例5: supports

import com.thinkaurelius.titan.core.Cardinality; //导入依赖的package包/类
@Override
public boolean supports(KeyInformation information, TitanPredicate titanPredicate) {
    if (information.getCardinality()!= Cardinality.SINGLE) return false;
    Class<?> dataType = information.getDataType();
    Mapping mapping = Mapping.getMapping(information);
    if (mapping!=Mapping.DEFAULT && !AttributeUtil.isString(dataType)) return false;

    if (Number.class.isAssignableFrom(dataType)) {
        if (titanPredicate instanceof Cmp) return true;
    } else if (dataType == Geoshape.class) {
        return titanPredicate == Geo.WITHIN;
    } else if (AttributeUtil.isString(dataType)) {
        switch(mapping) {
            case DEFAULT:
            case TEXT:
                return titanPredicate == Text.CONTAINS || titanPredicate == Text.CONTAINS_PREFIX; // || titanPredicate == Text.CONTAINS_REGEX;
            case STRING:
                return titanPredicate == Cmp.EQUAL || titanPredicate==Cmp.NOT_EQUAL || titanPredicate==Text.PREFIX || titanPredicate==Text.REGEX;
        }
    }
    return false;
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:23,代码来源:LuceneIndex.java


示例6: Titan1Graph

import com.thinkaurelius.titan.core.Cardinality; //导入依赖的package包/类
public Titan1Graph() {
    //determine multi-properties once at startup
    TitanManagement mgmt = null;
    try {
        mgmt = Titan1GraphDatabase.getGraphInstance().openManagement();
        Iterable<PropertyKey> keys = mgmt.getRelationTypes(PropertyKey.class);
        multiProperties = new HashSet<>();
        for (PropertyKey key : keys) {
            if (key.cardinality() != Cardinality.SINGLE) {
                multiProperties.add(key.name());
            }
        }
    } finally {
        if (mgmt != null) {
            mgmt.rollback();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:19,代码来源:Titan1Graph.java


示例7: Titan0Graph

import com.thinkaurelius.titan.core.Cardinality; //导入依赖的package包/类
public Titan0Graph() {
    //determine multi-properties once at startup
    TitanManagement mgmt = null;
    try {
        mgmt = Titan0GraphDatabase.getGraphInstance().getManagementSystem();
        Iterable<PropertyKey> keys = mgmt.getRelationTypes(PropertyKey.class);
        multiProperties = Collections.synchronizedSet(new HashSet<String>());
        for(PropertyKey key : keys) {
            if (key.getCardinality() != Cardinality.SINGLE) {
                multiProperties.add(key.getName());
            }
        }
    } finally {
        if (mgmt != null) {
            mgmt.rollback();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:19,代码来源:Titan0Graph.java


示例8: makePropertyKey

import com.thinkaurelius.titan.core.Cardinality; //导入依赖的package包/类
@Override
public AtlasPropertyKey makePropertyKey(String propertyName, Class propertyClass, AtlasCardinality cardinality) {

    if (cardinality.isMany()) {
        newMultProperties.add(propertyName);
    }

    PropertyKeyMaker propertyKeyBuilder = management.makePropertyKey(propertyName).dataType(propertyClass);

    if (cardinality != null) {
        Cardinality titanCardinality = TitanObjectFactory.createCardinality(cardinality);
        propertyKeyBuilder.cardinality(titanCardinality);
    }
    PropertyKey propertyKey = propertyKeyBuilder.make();
    return GraphDbObjectFactory.createPropertyKey(propertyKey);
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:17,代码来源:Titan0GraphManagement.java


示例9: getProperty

import com.thinkaurelius.titan.core.Cardinality; //导入依赖的package包/类
@Override
public <O> O getProperty(PropertyKey key) {
    if (!((InternalRelationType)key).isHiddenType() && tx().getConfiguration().hasPropertyPrefetching()) {
        getProperties().iterator().hasNext();
    }
    Iterator<TitanProperty> iter = query().type(key).properties().iterator();
    if (key.getCardinality()== Cardinality.SINGLE) {
        if (iter.hasNext()) return (O)iter.next().getValue();
        else return null;
    } else {
        List<Object> result = new ArrayList<Object>();
        while (iter.hasNext()) {
            result.add(iter.next().getValue());
        }
        return (O)result;
    }
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:18,代码来源:AbstractVertex.java


示例10: createMixedIndex

import com.thinkaurelius.titan.core.Cardinality; //导入依赖的package包/类
private TitanGraphIndex createMixedIndex(String indexName, ElementCategory elementCategory,
                                         TitanSchemaType constraint, String backingIndex) {
    Preconditions.checkArgument(graph.getIndexSerializer().containsIndex(backingIndex), "Unknown external index backend: %s", backingIndex);
    checkIndexName(indexName);

    TypeDefinitionMap def = new TypeDefinitionMap();
    def.setValue(TypeDefinitionCategory.INTERNAL_INDEX, false);
    def.setValue(TypeDefinitionCategory.ELEMENT_CATEGORY, elementCategory);
    def.setValue(TypeDefinitionCategory.BACKING_INDEX, backingIndex);
    def.setValue(TypeDefinitionCategory.INDEXSTORE_NAME, indexName);
    def.setValue(TypeDefinitionCategory.INDEX_CARDINALITY, Cardinality.LIST);
    def.setValue(TypeDefinitionCategory.STATUS, SchemaStatus.ENABLED);
    TitanSchemaVertex indexVertex = transaction.makeSchemaVertex(TitanSchemaCategory.GRAPHINDEX, indexName, def);

    Preconditions.checkArgument(constraint == null || (elementCategory.isValidConstraint(constraint) && constraint instanceof TitanSchemaVertex));
    if (constraint != null) {
        addSchemaEdge(indexVertex, (TitanSchemaVertex) constraint, TypeDefinitionCategory.INDEX_SCHEMA_CONSTRAINT, null);
    }
    updateSchemaVertex(indexVertex);
    return new TitanGraphIndexWrapper(indexVertex.asIndexType());
}
 
开发者ID:graben1437,项目名称:titan1.0.1.kafka,代码行数:22,代码来源:ManagementSystem.java


示例11: supports

import com.thinkaurelius.titan.core.Cardinality; //导入依赖的package包/类
@Override
public boolean supports(KeyInformation information, TitanPredicate titanPredicate) {
    if (information.getCardinality()!= Cardinality.SINGLE) return false;
    Class<?> dataType = information.getDataType();
    Mapping mapping = Mapping.getMapping(information);
    if (mapping!=Mapping.DEFAULT && !AttributeUtil.isString(dataType)) return false;

    if (Number.class.isAssignableFrom(dataType)) {
        if (titanPredicate instanceof Cmp) return true;
    } else if (dataType == Geoshape.class) {
        return titanPredicate == Geo.WITHIN;
    } else if (AttributeUtil.isString(dataType)) {
        switch(mapping) {
            case DEFAULT:
            case TEXT:
                return titanPredicate == Text.CONTAINS || titanPredicate == Text.CONTAINS_PREFIX; // || titanPredicate == Text.CONTAINS_REGEX;
            case STRING:
                return titanPredicate == Cmp.EQUAL || titanPredicate==Cmp.NOT_EQUAL || titanPredicate==Text.PREFIX || titanPredicate==Text.REGEX;
        }
    } else if (dataType == Date.class || dataType == Instant.class) {
        if (titanPredicate instanceof Cmp) return true;
    } else if (dataType == Boolean.class) {
        return titanPredicate == Cmp.EQUAL || titanPredicate == Cmp.NOT_EQUAL;
    } else if (dataType == UUID.class) {
        return titanPredicate == Cmp.EQUAL || titanPredicate == Cmp.NOT_EQUAL;
    }
    return false;
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:29,代码来源:LuceneIndex.java


示例12: supports

import com.thinkaurelius.titan.core.Cardinality; //导入依赖的package包/类
@Override
    public boolean supports(KeyInformation information, TitanPredicate titanPredicate) {
        Class<?> dataType = information.getDataType();
        Mapping mapping = Mapping.getMapping(information);
        if (mapping!=Mapping.DEFAULT && !AttributeUtil.isString(dataType)) return false;

        if(information.getCardinality() != Cardinality.SINGLE) {
            return false;
        }

        if (Number.class.isAssignableFrom(dataType)) {
            return titanPredicate instanceof Cmp;
        } else if (dataType == Geoshape.class) {
            return titanPredicate == Geo.WITHIN;
        } else if (AttributeUtil.isString(dataType)) {
            switch(mapping) {
                case DEFAULT:
                case TEXT:
                    return titanPredicate == Text.CONTAINS || titanPredicate == Text.CONTAINS_PREFIX || titanPredicate == Text.CONTAINS_REGEX;
                case STRING:
                    return titanPredicate == Cmp.EQUAL || titanPredicate==Cmp.NOT_EQUAL || titanPredicate==Text.REGEX || titanPredicate==Text.PREFIX;
//                case TEXTSTRING:
//                    return (titanPredicate instanceof Text) || titanPredicate == Cmp.EQUAL || titanPredicate==Cmp.NOT_EQUAL;
            }
        } else if (dataType == Date.class || dataType == Instant.class) {
            if (titanPredicate instanceof Cmp) return true;
        } else if (dataType == Boolean.class) {
            return titanPredicate == Cmp.EQUAL || titanPredicate == Cmp.NOT_EQUAL;
        } else if (dataType == UUID.class) {
            return titanPredicate == Cmp.EQUAL || titanPredicate==Cmp.NOT_EQUAL;
        }
        return false;
    }
 
开发者ID:graben1437,项目名称:titan1.0.1.kafka,代码行数:34,代码来源:SolrIndex.java


示例13: testPropertyCardinality

import com.thinkaurelius.titan.core.Cardinality; //导入依赖的package包/类
/**
 * This test exercises different types of updates against cardinality restricted properties
 * to ensure that the resulting behavior is fully consistent.
 */
@Test
public void testPropertyCardinality() {
    PropertyKey uid = mgmt.makePropertyKey("uid").dataType(Long.class).cardinality(Cardinality.SINGLE).make();
    PropertyKey name = mgmt.makePropertyKey("name").dataType(String.class).cardinality(Cardinality.SINGLE).make();
    mgmt.buildIndex("byUid", Vertex.class).addKey(uid).unique().buildCompositeIndex();
    mgmt.buildIndex("byName", Vertex.class).addKey(name).buildCompositeIndex();

    finishSchema();

    TitanVertex v1 = tx.addVertex();
    v1.property("name", "name1");
    TitanVertex v2 = tx.addVertex();
    v2.property("uid", 512);

    newTx();

    v1 = tx.getVertex(v1.longId());
    v1.property("name", "name2"); //Ensure that the old index record gets removed
    v2 = tx.getVertex(v2.longId());
    v2.property("uid", 512); //Ensure that replacement is allowed

    newTx();

    assertCount(0, tx.query().has("name", "name1").vertices());
    assertCount(1, tx.query().has("name", "name2").vertices());
    assertCount(1, tx.query().has("uid", 512).vertices());
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:32,代码来源:TitanGraphTest.java


示例14: testReadWideVertexWithManyProperties

import com.thinkaurelius.titan.core.Cardinality; //导入依赖的package包/类
@Test
public void testReadWideVertexWithManyProperties() {
    int numProps = 1 << 16;

    long numV  = 1;
    mgmt.makePropertyKey("p").cardinality(Cardinality.LIST).dataType(Integer.class).make();
    mgmt.commit();
    finishSchema();

    for (int j = 0; j < numV; j++) {
        Vertex v = graph.addVertex();
        for (int i = 0; i < numProps; i++) {
            v.property("p", i);
        }
    }
    graph.tx().commit();

    assertEquals(numV, (long) graph.traversal().V().count().next());
    Map<String, Object> propertiesOnVertex = graph.traversal().V().valueMap().next();
    List<?> valuesOnP = (List)propertiesOnVertex.values().iterator().next();
    assertEquals(numProps, valuesOnP.size());
    Graph g = GraphFactory.open("target/test-classes/cassandra-read.properties");
    GraphTraversalSource t = g.traversal(GraphTraversalSource.computer(SparkGraphComputer.class));
    assertEquals(numV, (long) t.V().count().next());
    propertiesOnVertex = t.V().valueMap().next();
    valuesOnP = (List)propertiesOnVertex.values().iterator().next();
    assertEquals(numProps, valuesOnP.size());
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:29,代码来源:CassandraInputFormatIT.java


示例15: IndexFeatures

import com.thinkaurelius.titan.core.Cardinality; //导入依赖的package包/类
public IndexFeatures(boolean supportsDocumentTTL,
                     Mapping defaultMap,
                     ImmutableSet<Mapping> supportedMap, String wildcardField, ImmutableSet<Cardinality> supportedCardinaities, boolean supportsNanoseconds) {

    Preconditions.checkArgument(defaultMap!=null || defaultMap!=Mapping.DEFAULT);
    Preconditions.checkArgument(supportedMap!=null && !supportedMap.isEmpty()
                                && supportedMap.contains(defaultMap));
    this.supportsDocumentTTL = supportsDocumentTTL;
    this.defaultStringMapping = defaultMap;
    this.supportedStringMappings = supportedMap;
    this.wildcardField = wildcardField;
    this.supportedCardinaities = supportedCardinaities;
    this.supportsNanoseconds = supportsNanoseconds;
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:15,代码来源:IndexFeatures.java


示例16: StandardKeyInformation

import com.thinkaurelius.titan.core.Cardinality; //导入依赖的package包/类
public StandardKeyInformation(Class<?> dataType, Cardinality cardinality, Parameter... parameters) {
    Preconditions.checkNotNull(dataType);
    Preconditions.checkNotNull(parameters);
    this.dataType = dataType;
    this.parameters = parameters;
    this.cardinality = cardinality;
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:8,代码来源:StandardKeyInformation.java


示例17: orderBy

import com.thinkaurelius.titan.core.Cardinality; //导入依赖的package包/类
@Override
public Q orderBy(String keyName, org.apache.tinkerpop.gremlin.process.traversal.Order order) {
    Preconditions.checkArgument(schemaInspector.containsPropertyKey(keyName), "Provided key does not exist: %s", keyName);
    PropertyKey key = schemaInspector.getPropertyKey(keyName);
    Preconditions.checkArgument(key != null && order != null, "Need to specify and key and an order");
    Preconditions.checkArgument(Comparable.class.isAssignableFrom(key.dataType()),
            "Can only order on keys with comparable data type. [%s] has datatype [%s]", key.name(), key.dataType());
    Preconditions.checkArgument(key.cardinality() == Cardinality.SINGLE, "Ordering is undefined on multi-valued key [%s]", key.name());
    Preconditions.checkArgument(!(key instanceof SystemRelationType), "Cannot use system types in ordering: %s", key);
    Preconditions.checkArgument(!orders.containsKey(key));
    Preconditions.checkArgument(orders.isEmpty(), "Only a single sort order is supported on vertex queries");
    orders.add(key, Order.convert(order));
    return getThis();
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:15,代码来源:BaseVertexCentricQueryBuilder.java


示例18: testGraphQueryForEdges

import com.thinkaurelius.titan.core.Cardinality; //导入依赖的package包/类
@Override
public void testGraphQueryForEdges() {
    TitanGraph g = (TitanGraph) graphTest.generateGraph();
    if (g.getRelationType("weight") == null) {
        TitanManagement mgmt = g.getManagementSystem();
        mgmt.makePropertyKey("weight").dataType(Double.class).cardinality(Cardinality.SINGLE).make();
        mgmt.commit();
    }
    g.shutdown();
    super.testGraphQueryForEdges();
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:12,代码来源:TitanGraphQueryTestSuite.java


示例19: createCompositeIndex

import com.thinkaurelius.titan.core.Cardinality; //导入依赖的package包/类
private TitanGraphIndex createCompositeIndex(String indexName, ElementCategory elementCategory, boolean unique, TitanSchemaType constraint, PropertyKey... keys) {
    checkIndexName(indexName);
    Preconditions.checkArgument(keys != null && keys.length > 0, "Need to provide keys to index [%s]", indexName);
    Preconditions.checkArgument(!unique || elementCategory == ElementCategory.VERTEX, "Unique indexes can only be created on vertices [%s]", indexName);
    boolean allSingleKeys = true;
    boolean oneNewKey = false;
    for (PropertyKey key : keys) {
        Preconditions.checkArgument(key != null && key instanceof PropertyKeyVertex, "Need to provide valid keys: %s", key);
        if (key.cardinality() != Cardinality.SINGLE) allSingleKeys = false;
        if (key.isNew()) oneNewKey = true;
        else updatedTypes.add((PropertyKeyVertex) key);
    }

    Cardinality indexCardinality;
    if (unique) indexCardinality = Cardinality.SINGLE;
    else indexCardinality = (allSingleKeys ? Cardinality.SET : Cardinality.LIST);

    TypeDefinitionMap def = new TypeDefinitionMap();
    def.setValue(TypeDefinitionCategory.INTERNAL_INDEX, true);
    def.setValue(TypeDefinitionCategory.ELEMENT_CATEGORY, elementCategory);
    def.setValue(TypeDefinitionCategory.BACKING_INDEX, Token.INTERNAL_INDEX_NAME);
    def.setValue(TypeDefinitionCategory.INDEXSTORE_NAME, indexName);
    def.setValue(TypeDefinitionCategory.INDEX_CARDINALITY, indexCardinality);
    def.setValue(TypeDefinitionCategory.STATUS, oneNewKey ? SchemaStatus.ENABLED : SchemaStatus.INSTALLED);
    TitanSchemaVertex indexVertex = transaction.makeSchemaVertex(TitanSchemaCategory.GRAPHINDEX, indexName, def);
    for (int i = 0; i < keys.length; i++) {
        Parameter[] paras = {ParameterType.INDEX_POSITION.getParameter(i)};
        addSchemaEdge(indexVertex, keys[i], TypeDefinitionCategory.INDEX_FIELD, paras);
    }

    Preconditions.checkArgument(constraint == null || (elementCategory.isValidConstraint(constraint) && constraint instanceof TitanSchemaVertex));
    if (constraint != null) {
        addSchemaEdge(indexVertex, (TitanSchemaVertex) constraint, TypeDefinitionCategory.INDEX_SCHEMA_CONSTRAINT, null);
    }
    updateSchemaVertex(indexVertex);
    TitanGraphIndexWrapper index = new TitanGraphIndexWrapper(indexVertex.asIndexType());
    if (!oneNewKey) updateIndex(index, SchemaAction.REGISTER_INDEX);
    return index;
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:40,代码来源:ManagementSystem.java


示例20: BaseKey

import com.thinkaurelius.titan.core.Cardinality; //导入依赖的package包/类
private BaseKey(String name, Class<?> dataType, int id, Index index, Cardinality cardinality) {
    super(name, id, TitanSchemaCategory.PROPERTYKEY);
    Preconditions.checkArgument(index!=null && cardinality!=null);
    this.dataType = dataType;
    this.index = index;
    this.cardinality = cardinality;
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:8,代码来源:BaseKey.java



注:本文中的com.thinkaurelius.titan.core.Cardinality类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TokenMaker类代码示例发布时间:2022-05-23
下一篇:
Java TextFieldTreeTableCell类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap