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


Java Parameter类代码示例

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


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

示例1: createIndex

import com.tinkerpop.blueprints.Parameter; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public <T extends Element> Index<T> createIndex(String indexName,
    Class<T> indexClass, Parameter... indexParameters) {
  if (indexClass == null) {
    throw ExceptionFactory.classForElementCannotBeNull();
  }
  else if (globals.getConfig().getIndexableGraphDisabled()) {
    throw new UnsupportedOperationException("IndexableGraph is disabled via the configuration");
  }

  for (Index<?> index : globals.getIndexMetadataWrapper().getIndices()) {
    if (index.getIndexName().equals(indexName)) {
      throw ExceptionFactory.indexAlreadyExists(indexName);
    }
  }

  return globals.getIndexMetadataWrapper().createIndex(indexName, indexClass);
}
 
开发者ID:JHUAPL,项目名称:AccumuloGraph,代码行数:20,代码来源:AccumuloGraph.java

示例2: createKeyIndex

import com.tinkerpop.blueprints.Parameter; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public <T extends Element> void createKeyIndex(String key,
    Class<T> elementClass, Parameter... indexParameters) {
  // TODO Move below to somewhere appropriate.
  if (elementClass == null) {
    throw ExceptionFactory.classForElementCannotBeNull();
  }

  // Add key to indexed keys list.
  globals.getIndexMetadataWrapper().writeKeyMetadataEntry(key, elementClass);
  globals.checkedFlush();

  // Reindex graph.
  globals.getKeyIndexTableWrapper(elementClass).rebuildIndex(key, elementClass);
  globals.getVertexKeyIndexWrapper().dump();
  globals.checkedFlush();
}
 
开发者ID:JHUAPL,项目名称:AccumuloGraph,代码行数:19,代码来源:AccumuloGraph.java

示例3: testCreateEdgeIndex

import com.tinkerpop.blueprints.Parameter; //导入依赖的package包/类
public void testCreateEdgeIndex() {
	try {
		ArangoDBGraph graph = new ArangoDBGraph(configuration, graphName, vertices, edges);

		Parameter<String, String> type = new Parameter<String, String>("type", "skiplist");
		Parameter<String, Boolean> unique = new Parameter<String, Boolean>("unique", false);

		graph.createKeyIndex("key1", Edge.class, type, unique);

		type = new Parameter<String, String>("type", "hash");
		unique = new Parameter<String, Boolean>("unique", true);

		graph.createKeyIndex("key2", Edge.class, type, unique);

		graph.shutdown();

	} catch (ArangoDBGraphException e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
开发者ID:arangodb,项目名称:blueprints-arangodb-graph,代码行数:22,代码来源:ArangoEdgeTest.java

示例4: testCreateVertexWithUniqueIndex

import com.tinkerpop.blueprints.Parameter; //导入依赖的package包/类
@Test
public void testCreateVertexWithUniqueIndex() throws ArangoDBGraphException {

	ArangoDBGraph graph = new ArangoDBGraph(configuration, graphName, vertices, edges);

	Parameter<String, String> type = new Parameter<String, String>("type", "skiplist");
	Parameter<String, Boolean> unique = new Parameter<String, Boolean>("unique", true);

	graph.createKeyIndex("key1", Vertex.class, type, unique);

	ArangoDBVertex a = (ArangoDBVertex) graph.addVertex("v1");
	a.setProperty("key1", "value1");

	ArangoDBVertex b = (ArangoDBVertex) graph.addVertex("v2");
	try {
		// this fails
		b.setProperty("key1", "value1");
		Assert.fail("this should throw a IllegalArgumentException because of a unique constraint violation");
	} catch (IllegalArgumentException e) {
	}
}
 
开发者ID:arangodb,项目名称:blueprints-arangodb-graph,代码行数:22,代码来源:ArangoVertexTest.java

示例5: testCreateVertexWithUniqueIndexAndNoDelay

import com.tinkerpop.blueprints.Parameter; //导入依赖的package包/类
@Test
public void testCreateVertexWithUniqueIndexAndNoDelay() throws ArangoDBGraphException {

	ArangoDBGraph graph = new ArangoDBGraph(configuration, graphName, vertices, edges);

	Parameter<String, String> type = new Parameter<String, String>("type", "skiplist");
	Parameter<String, Boolean> unique = new Parameter<String, Boolean>("unique", true);

	graph.createKeyIndex("key1", Vertex.class, type, unique);

	Vertex a = graph.addVertex("v1");
	a.setProperty("key1", "value1");

	Vertex b = graph.addVertex("v2");

	try {
		// this fails
		b.setProperty("key1", "value1");
		Assert.fail("this should throw a IllegalArgumentException because of a unique constraint violation");
	} catch (IllegalArgumentException e) {
		assertTrue(true);
	}
}
 
开发者ID:arangodb,项目名称:blueprints-arangodb-graph,代码行数:24,代码来源:ArangoVertexTest.java

示例6: createKeyIndex

import com.tinkerpop.blueprints.Parameter; //导入依赖的package包/类
@Override
    public <T extends Element> void createKeyIndex(String key, Class<T> elementClass, Parameter... indexParameters) {
        throw new UnsupportedOperationException("Use Titan's Management API to create indices");
//        Preconditions.checkNotNull(key);
//        Preconditions.checkArgument(elementClass == Element.class || elementClass == Vertex.class || elementClass == Edge.class,
//                "Expected vertex, edge or element");
//
//        if (indexParameters == null || indexParameters.length == 0) {
//            indexParameters = new Parameter[]{new Parameter(Titan.Token.STANDARD_INDEX, "")};
//        }
//
//        if (containsType(key)) {
//            TitanType type = getType(key);
//            if (!type.isPropertyKey())
//                throw new IllegalArgumentException("Key string does not denote a property key but a label");
//            List<String> indexes = new ArrayList<String>(indexParameters.length);
//            for (Parameter p : indexParameters) {
//                Preconditions.checkArgument(p.getKey() instanceof String, "Invalid index argument: " + p);
//                indexes.add((String) p.getKey());
//            }
//            boolean indexesCovered;
//            if (elementClass == Element.class) {
//                indexesCovered = hasIndexes((TitanKey) type, Vertex.class, indexes) &&
//                        hasIndexes((TitanKey) type, Edge.class, indexes);
//            } else {
//                indexesCovered = hasIndexes((TitanKey) type, elementClass, indexes);
//            }
//            if (!indexesCovered)
//                throw new UnsupportedOperationException("Cannot add an index to an already existing property key: " + type.getName());
//        } else {
//            KeyMaker tm = makeKey(key).dataType(Object.class);
//            for (Parameter p : indexParameters) {
//                Preconditions.checkArgument(p.getKey() instanceof String, "Invalid index argument: " + p);
//                tm.indexed((String) p.getKey(), elementClass);
//            }
//            tm.make();
//        }
    }
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:39,代码来源:TitanBlueprintsTransaction.java

示例7: makeIndexParamterDocument

import com.tinkerpop.blueprints.Parameter; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes" })
public static BsonDocument makeIndexParamterDocument(Parameter... indexParameters) {
	BsonDocument index = new BsonDocument();
	for (Parameter param : indexParameters) {
		validateIndexParameter(param);
		index.append(param.getKey().toString(), new BsonInt32((Integer) param.getValue()));
	}
	return index;
}
 
开发者ID:JaewookByun,项目名称:epcis,代码行数:10,代码来源:Converter.java

示例8: validateIndexParameter

import com.tinkerpop.blueprints.Parameter; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public static void validateIndexParameter(Parameter param) {
	Object objKey = param.getKey();
	Object objValue = param.getValue();
	if (!(objKey instanceof String))
		throw ExceptionFactory.indexKeyShouldBeString();
	if (!(objValue instanceof Integer))
		throw ExceptionFactory.indexValueShouldBeInteger();
	Integer value = (Integer) objValue;
	if (value != 1 && value != -1)
		throw ExceptionFactory.indexValueShouldBeIntegerOneOrMinusOne();
}
 
开发者ID:JaewookByun,项目名称:epcis,代码行数:13,代码来源:Converter.java

示例9: setUp

import com.tinkerpop.blueprints.Parameter; //导入依赖的package包/类
@Before
public void setUp() {
  super.setUp();
  OGlobalConfiguration.USE_WAL.setValue(true);

  graph.createVertexType("Person");
  graph.createKeyIndex("name", Vertex.class, new Parameter<String, String>("type", "UNIQUE"), new Parameter<String, String>(
      "class", "Person"));
  graph.commit();
}
 
开发者ID:orientechnologies,项目名称:orientdb-etl,代码行数:11,代码来源:OVertexTransformerTest.java

示例10: createIndex

import com.tinkerpop.blueprints.Parameter; //导入依赖的package包/类
@Override
    public <T extends Element> Index<T> createIndex(final String indexName, final Class<T> indexClass,
            final Parameter... indexParameters) {
//        return new ActiveVersionedIndex<T, V>(getEventableGraph().createIndex(indexName, indexClass, indexParameters),
//                this);
        throw new IllegalStateException("Currently not supported.");
    }
 
开发者ID:indexiatech,项目名称:antiquity,代码行数:8,代码来源:IndexableTransactionalVersionedGraphImpl.java

示例11: createKeyIndex

import com.tinkerpop.blueprints.Parameter; //导入依赖的package包/类
@Override
public <T extends Element> void createKeyIndex(final String key, final Class<T> elementClass,
        final Parameter... indexParameters) {
    if (key.equals(VEProps.NATURAL_VERTEX_ID_PROP_KEY) || key.equals(VEProps.NATURAL_EDGE_ID_PROP_KEY)) {
        throw new IllegalArgumentException(String.format("Index key [%s] is reserved and cannot be created",
                VEProps.NATURAL_VERTEX_ID_PROP_KEY));
    }

    getEventableGraph().getBaseGraph().createKeyIndex(key, elementClass, indexParameters);
}
 
开发者ID:indexiatech,项目名称:antiquity,代码行数:11,代码来源:ActiveVersionedGraph.java

示例12: createSchema

import com.tinkerpop.blueprints.Parameter; //导入依赖的package包/类
protected void createSchema()
{
    graph.executeOutsideTx(new OCallable<Object, OrientBaseGraph>() {
        @SuppressWarnings({ "unchecked", "rawtypes" })
        @Override
        public Object call(final OrientBaseGraph g)
        {
            OrientVertexType v = g.getVertexBaseType();
            if(!v.existsProperty(NODE_ID)) { // TODO fix schema detection hack later
                v.createProperty(NODE_ID, OType.INTEGER);
                g.createKeyIndex(NODE_ID, Vertex.class, new Parameter("type", "UNIQUE_HASH_INDEX"), new Parameter(
                    "keytype", "INTEGER"));

                v.createEdgeProperty(Direction.OUT, SIMILAR, OType.LINKBAG);
                v.createEdgeProperty(Direction.IN, SIMILAR, OType.LINKBAG);
                OrientEdgeType similar = g.createEdgeType(SIMILAR);
                similar.createProperty("out", OType.LINK, v);
                similar.createProperty("in", OType.LINK, v);
                g.createKeyIndex(COMMUNITY, Vertex.class, new Parameter("type", "NOTUNIQUE_HASH_INDEX"),
                    new Parameter("keytype", "INTEGER"));
                g.createKeyIndex(NODE_COMMUNITY, Vertex.class, new Parameter("type", "NOTUNIQUE_HASH_INDEX"),
                    new Parameter("keytype", "INTEGER"));
            }

            return null;
        }
    });
}
 
开发者ID:socialsensor,项目名称:graphdb-benchmarks,代码行数:29,代码来源:OrientGraphDatabase.java

示例13: createKeyIndex

import com.tinkerpop.blueprints.Parameter; //导入依赖的package包/类
@Override
public <T extends Element> void createKeyIndex(String key,
		Class<T> elementClass, @SuppressWarnings("rawtypes") Parameter... indexParameters) {
	if (keyIndex != null) {
		keyIndex.createKeyIndex(key,
				elementClass.equals(Vertex.class) ? AccumuloVertex.class : AccumuloEdge.class);
	}
}
 
开发者ID:mikelieberman,项目名称:blueprints-accumulo-graph,代码行数:9,代码来源:AccumuloGraph.java

示例14: createKeyIndex

import com.tinkerpop.blueprints.Parameter; //导入依赖的package包/类
public <T extends Element> void createKeyIndex(final String key,
                                               final Class<T> elementClass,
                                               final Parameter... indexParameters) {
    if (elementClass == null)
        throw ExceptionFactory.classForElementCannotBeNull();

    boolean v = isVertexClass(elementClass);
    boolean supported = ((v && supportVertexIds) || (!v && supportEdgeIds));

    if (supported && key.equals(ID)) {
        throw new IllegalArgumentException("index key " + ID + " is reserved by IdGraph");
    } else {
        baseGraph.createKeyIndex(key, elementClass, indexParameters);
    }
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:16,代码来源:IdGraph.java

示例15: createIndex

import com.tinkerpop.blueprints.Parameter; //导入依赖的package包/类
public <T extends Element> Index<T> createIndex(final String indexName,
                                                final Class<T> indexClass,
                                                final Parameter... indexParameters) {
    verifyBaseGraphIsIndexableGraph();

    return isVertexClass(indexClass)
            ? (Index<T>) new IdVertexIndex((Index<Vertex>) ((IndexableGraph) baseGraph).createIndex(indexName, indexClass, indexParameters), this)
            : (Index<T>) new IdEdgeIndex((Index<Edge>) ((IndexableGraph) baseGraph).createIndex(indexName, indexClass, indexParameters), this);
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:10,代码来源:IdGraph.java


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