Project

General

Profile

« Previous | Next » 

Revision 9e235ff9

Added by Andreas Kohlbecker over 8 years ago

upgrading to neo4j 2.0.4 and first working implementation of all search modes, all tests successful

View differences:

src/main/java/org/bgbm/biovel/drf/query/TinkerPopClient.java
22 22
import org.bgbm.biovel.drf.checklist.DRFChecklistException;
23 23
import org.bgbm.biovel.drf.checklist.EEA_BDC_Client.RdfSchema;
24 24
import org.bgbm.biovel.drf.store.Neo4jStore;
25
import org.neo4j.graphdb.Node;
26
import org.neo4j.graphdb.index.AutoIndexer;
27
import org.neo4j.graphdb.index.IndexHits;
25 28
import org.openrdf.query.BindingSet;
26 29
import org.openrdf.query.MalformedQueryException;
27 30
import org.openrdf.query.QueryEvaluationException;
......
36 39
import com.tinkerpop.blueprints.Direction;
37 40
import com.tinkerpop.blueprints.Graph;
38 41
import com.tinkerpop.blueprints.Vertex;
42
import com.tinkerpop.blueprints.impls.neo4j2.Neo4j2Graph;
43
import com.tinkerpop.blueprints.impls.neo4j2.Neo4j2Vertex;
39 44
import com.tinkerpop.blueprints.oupls.sail.GraphSail;
40 45
import com.tinkerpop.gremlin.java.GremlinPipeline;
41 46
import com.tinkerpop.pipes.PipeFunction;
......
398 403
        return uri;
399 404
    }
400 405

  
406
    /**
407
     * by using the Neo4j index directly it is possible to
408
     * take full advantage of the underlying Lucene search engine
409
     *
410
     * @param luceneQuery
411
     * @return
412
     */
413
    public ArrayList<Vertex> vertexIndexQuery(String luceneQuery) {
414
        Neo4j2Graph graph = (Neo4j2Graph)graph();
415
        AutoIndexer<Node> nodeAutoIndex = graph.getRawGraph().index().getNodeAutoIndexer();
416
        IndexHits<Node> nodes = nodeAutoIndex.getAutoIndex().query(luceneQuery);
417
        ArrayList<Vertex> hitVs = new ArrayList<Vertex>();
418
        while(nodes.hasNext()) {
419
            hitVs.add(new Neo4j2Vertex(nodes.next(), graph));
420
        }
421
        return hitVs;
422
    }
423

  
401 424
    /**
402 425
     * @param subject
403 426
     */

Also available in: Unified diff