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


Java KeyIndexableGraph类代码示例

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


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

示例1: getElementIterable

import com.tinkerpop.blueprints.KeyIndexableGraph; //导入依赖的package包/类
private Iterable<?> getElementIterable(final Class<? extends Element> elementClass) {
    if (graph instanceof KeyIndexableGraph) {
        final Set<String> keys = getIndexedKeys(elementClass);
        HasContainer container = null;
        for (final HasContainer hasContainer : hasContainers) {
            if (hasContainer.predicate.equals(com.tinkerpop.blueprints.Compare.EQUAL) && keys.contains(hasContainer.key)) {
                container = hasContainer;
                break;
            }
        }
        if (container != null) {
            if (Vertex.class.isAssignableFrom(elementClass))
                return graph.getVertices(container.key, container.value);
            else
                return graph.getEdges(container.key, container.value);
        }
    }

    if (Vertex.class.isAssignableFrom(elementClass))
        return graph.getVertices();
    else
        return graph.getEdges();
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:24,代码来源:DefaultGraphQuery.java

示例2: RepositoryRegistry

import com.tinkerpop.blueprints.KeyIndexableGraph; //导入依赖的package包/类
/**
 * Initializes Sesame repository for Neo4j based on Blueprints
 * implementation.
 *
 * @param database Neo4j database service
 * @throws RepositoryException if there was a problem initializing the
 * Sesame repository
 */
private RepositoryRegistry(GraphDatabaseService database)
		throws RepositoryException {
	initRio();
	Graph graph = new Neo4j2Graph(database);
	String patterns = SPARQLExtensionProps.getProperty("query.patterns");
	Sail sail = new GraphSail((KeyIndexableGraph) graph, patterns);
	this.rep = new SailRepository(sail);
	rep.initialize();
}
 
开发者ID:lszeremeta,项目名称:neo4j-sparql-extension-yars,代码行数:18,代码来源:RepositoryRegistry.java

示例3: BlueprintsPersistenceBackend

import com.tinkerpop.blueprints.KeyIndexableGraph; //导入依赖的package包/类
/**
 * Constructs a new {@code BlueprintsPersistenceBackend} wrapping the provided {@code baseGraph}.
 * <p>
 * This constructor initialize the caches and create the metaclass index.
 * <p>
 * This constructor is protected. To create a new {@code BlueprintsPersistenceBackend} use {@link
 * BlueprintsPersistenceBackendFactory#createPersistentBackend(java.io.File, Map)}.
 *
 * @param baseGraph the base {@link KeyIndexableGraph} used to access the database
 *
 * @see BlueprintsPersistenceBackendFactory
 */
protected BlueprintsPersistenceBackend(KeyIndexableGraph baseGraph) {
    this.graph = new AutoCleanerIdGraph(baseGraph);
    this.persistentObjectsCache = Caffeine.newBuilder().softValues().build();
    this.verticesCache = Caffeine.newBuilder().softValues().build();
    this.indexedEClasses = new ArrayList<>();

    Index<Vertex> metaclasses = graph.getIndex(KEY_METACLASSES, Vertex.class);
    if (isNull(metaclasses)) {
        metaclassIndex = graph.createIndex(KEY_METACLASSES, Vertex.class);
    }
    else {
        metaclassIndex = metaclasses;
    }
}
 
开发者ID:atlanmod,项目名称:NeoEMF,代码行数:27,代码来源:BlueprintsPersistenceBackend.java

示例4: init

import com.tinkerpop.blueprints.KeyIndexableGraph; //导入依赖的package包/类
/**
 * Initialize versioned graph data, this method expected to be invoked only
 * once for the whole life of the graph database.
 */
public void init() {
    Vertex vertex = null;
    try {
        vertex = getRootVertex();
    } catch (IllegalStateException e) {
        log.info("Initializing graph...");
    }

    if (vertex != null) {
        return;
    }

    // Create the natural ID key indices
    KeyIndexableGraph keyIndexedGraph = getBaseGraph();
    if (!keyIndexedGraph.getIndexedKeys(Vertex.class).contains(VEProps.NATURAL_VERTEX_ID_PROP_KEY)) {
        keyIndexedGraph.createKeyIndex(VEProps.NATURAL_VERTEX_ID_PROP_KEY, Vertex.class);
    }

    if (!keyIndexedGraph.getIndexedKeys(Edge.class).contains(VEProps.NATURAL_EDGE_ID_PROP_KEY)) {
        keyIndexedGraph.createKeyIndex(VEProps.NATURAL_EDGE_ID_PROP_KEY, Edge.class);
    }

    //TODO: ROOT vertices should have a static unique known UUID for fast access
    Vertex historicRoot = utils.getNonEventableVertex(addActiveVertexInUnderline(null));
    historicRoot.setProperty(VEProps.ROOT_GRAPH_VERTEX_ID, VEProps.HISTORIC_ROOT_GRAPH_VERTEX_VALUE);
    historicRoot.setProperty(VEProps.HISTORIC_ELEMENT_PROP_KEY, true);

    Vertex activeRoot = utils.getNonEventableVertex(addActiveVertexInUnderline(null));
    activeRoot.setProperty(VEProps.ROOT_GRAPH_VERTEX_ID, VEProps.ACTIVE_ROOT_GRAPH_VERTEX_VALUE);
    activeRoot.setProperty(VEProps.HISTORIC_ELEMENT_PROP_KEY, false);

    if (getUneventableGraph() instanceof TransactionalGraph) {
        ((TransactionalGraph) getBaseGraph()).commit();
    }
}
 
开发者ID:indexiatech,项目名称:antiquity,代码行数:40,代码来源:ActiveVersionedGraph.java

示例5: simpleIterator

import com.tinkerpop.blueprints.KeyIndexableGraph; //导入依赖的package包/类
/**
 * Used for simple iteration, uses the key index if available, but will
 * defer to graph query if not.
 * 
 * @return
 */
private Iterator simpleIterator() {
	if (iterator == null) {
		final Iterator delegateIterator;
		if (key != null) {
			if (delegate instanceof TinkerGraph) {
				// Tinker graph will do it's own check to see if it supports
				// the key
				delegateIterator = delegate.getVertices(key, value).iterator();
			} else if (delegate instanceof KeyIndexableGraph) {
				if (((KeyIndexableGraph) delegate).getIndexedKeys(Vertex.class).contains(key)) {
					// This graph supports lookups for this key
					delegateIterator = delegate.getVertices(key, value).iterator();
				} else {
					// This graph does not support lookup of this key, but
					// it may still be supported via the query interface.
					delegateIterator = delegate.query().has(key, value).vertices().iterator();
				}
			} else {

				// This graph does not support lookup of this key, but it
				// may still be supported via the query interface.
				delegateIterator = delegate.query().has(key, value).vertices().iterator();

			}
		} else {
			// There is no key so it is a full traversal.
			delegateIterator = delegate.getVertices().iterator();
		}
		iterator = new Iterator() {
			private Element current;

			@Override
			public boolean hasNext() {
				return delegateIterator.hasNext();
			}

			@Override
			public Object next() {
				current = (Element) delegateIterator.next();
				return current;
			}

			@Override
			public void remove() {
				if (current != null) {
					current.remove();
					current = null;
				} else {
					throw new IllegalStateException();
				}
			}
		};
	}
	return iterator;
}
 
开发者ID:BrynCooke,项目名称:totorom,代码行数:62,代码来源:GlobalVertexTraversal.java

示例6: getIndexedKeys

import com.tinkerpop.blueprints.KeyIndexableGraph; //导入依赖的package包/类
protected Set<String> getIndexedKeys(final Class<? extends Element> elementClass) {
  return ((KeyIndexableGraph) graph).getIndexedKeys(elementClass);
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:4,代码来源:DefaultGraphQuery.java

示例7: getIndexedKeys

import com.tinkerpop.blueprints.KeyIndexableGraph; //导入依赖的package包/类
public <T extends Element> Set<String> getIndexedKeys(Class<T> elementClass) {
    return ((KeyIndexableGraph) this.baseGraph).getIndexedKeys(elementClass);
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:4,代码来源:ReadOnlyKeyIndexableGraph.java

示例8: getGraph

import com.tinkerpop.blueprints.KeyIndexableGraph; //导入依赖的package包/类
/**
 * Provides a direct access to the underlying graph.
 * <p>
 * This method is public for tool compatibility (see the
 * <a href="https://github.com/atlanmod/Mogwai">Mogwaï</a>) framework, NeoEMF consistency is not guaranteed if
 * the graph is modified manually.
 *
 * @return the underlying Blueprints graph
 */
public IdGraph<KeyIndexableGraph> getGraph() {
    return graph;
}
 
开发者ID:atlanmod,项目名称:NeoEMF,代码行数:13,代码来源:BlueprintsPersistenceBackend.java

示例9: AutoCleanerIdGraph

import com.tinkerpop.blueprints.KeyIndexableGraph; //导入依赖的package包/类
/**
 * Constructs a new {@code AutoCleanerIdGraph} on the specified {@code baseGraph}.
 *
 * @param baseGraph the base graph
 */
public AutoCleanerIdGraph(KeyIndexableGraph baseGraph) {
    super(baseGraph);
}
 
开发者ID:atlanmod,项目名称:NeoEMF,代码行数:9,代码来源:BlueprintsPersistenceBackend.java


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