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


Java Result.columns方法代码示例

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


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

示例1: prepareEdgeSetFromNeo4jResult

import org.neo4j.graphdb.Result; //导入方法依赖的package包/类
@Deprecated
private Set<AbstractEdge> prepareEdgeSetFromNeo4jResult(Result result, String childVertexHash, String parentVertexHash)
{
    Set<AbstractEdge> edgeSet = new HashSet<>();
    while(result.hasNext())
    {
        AbstractVertex childVertex = getVertex(childVertexHash);
        AbstractVertex parentVertex = getVertex(parentVertexHash);
        AbstractEdge edge = new Edge(childVertex, parentVertex);
        Map<String,Object> row = result.next();
        for (String key : result.columns())
        {
            edge.addAnnotation(key, row.get(key).toString());
        }
        edgeSet.add(edge);
    }

    return edgeSet;
}
 
开发者ID:ashish-gehani,项目名称:SPADE,代码行数:20,代码来源:Neo4j.java

示例2: prepareVertexSetFromNeo4jResult

import org.neo4j.graphdb.Result; //导入方法依赖的package包/类
@Deprecated
private Set<AbstractVertex> prepareVertexSetFromNeo4jResult(Result result)
{
    Set<AbstractVertex> vertexSet = new HashSet<>();
    while(result.hasNext())
    {
        AbstractVertex vertex = new Vertex();
        Map<String,Object> row = result.next();
        for (String key : result.columns())
        {
            vertex.addAnnotation(key, row.get(key).toString());
        }
        vertexSet.add(vertex);
    }

    return vertexSet;
}
 
开发者ID:ashish-gehani,项目名称:SPADE,代码行数:18,代码来源:Neo4j.java

示例3: main

import org.neo4j.graphdb.Result; //导入方法依赖的package包/类
public static void main(String[] args) {

        CommandLineParser parser = new DefaultParser();
        CommandLine cmd = Utils.parseCommandLine(getOptions(), args);

        String graphDbPath = cmd.getOptionValue("d", Owl2Neo4jLoader.GRAPH_DB_PATH);
        GraphDatabaseService graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(new File(graphDbPath));
        String query = "MATCH (n) RETURN n ORDER BY ID(n) DESC LIMIT 30;";
        Transaction tx = graphDb.beginTx();
        try {
            Result result = graphDb.execute(query);
            while (result.hasNext()) {
                Map<String, Object> row = result.next();
                for (String key : result.columns()) {
                    Node node = (Node) row.get(key);
                    Object name = node.getProperty("name");
                    System.out.printf("%s = %s; name = %s%n", key, row.get(key), name);
                }

            }
            tx.success();
        }
        catch (Exception e) {
            System.err.println("Exception caught: " + e.getMessage());
            e.printStackTrace();
            System.exit(ERR_STATUS);
        }
        finally {
            tx.close();
        }
        System.out.println("Exiting with success...");
        System.exit(OK_STATUS);

    }
 
开发者ID:ISA-tools,项目名称:FAIRsharing-Owl2Neo,代码行数:35,代码来源:Neo4jQuery.java

示例4: executeFuzzy

import org.neo4j.graphdb.Result; //导入方法依赖的package包/类
public void executeFuzzy(boolean details) throws CypherException, IOException {
        Result result;
        try (Transaction ignored = graphDatabaseService.beginTx()) {
            String query = "MATCH (cl:Class) WHERE cl.lack_of_cohesion_in_methods >" + high_lcom + " AND cl.number_of_methods > " + high_nom + " AND cl.number_of_attributes > " + high_noa + " RETURN cl.app_key as app_key,cl.lack_of_cohesion_in_methods as lack_of_cohesion_in_methods,cl.number_of_methods as number_of_methods, cl.number_of_attributes as number_of_attributes";
            if(details){
                query += ",cl.name as full_name";
            }
            result = graphDatabaseService.execute(query);
            List<String> columns = new ArrayList<>(result.columns());
            columns.add("fuzzy_value");
            int lcom,noa,nom;
            List<Map> fuzzyResult = new ArrayList<>();
            File fcf = new File(fclFile);
            //We look if the file is in a directory otherwise we look inside the jar
            FIS fis;
            if(fcf.exists() && !fcf.isDirectory()){
                fis = FIS.load(fclFile, false);
            }else{
                fis = FIS.load(getClass().getResourceAsStream(fclFile),false);
            }
            FunctionBlock fb = fis.getFunctionBlock(null);
            while(result.hasNext()){
                HashMap res = new HashMap(result.next());
                lcom = (int) res.get("lack_of_cohesion_in_methods");
                noa = (int) res.get("number_of_attributes");
                nom = (int) res.get("number_of_methods");
                if(lcom >= veryHigh_lcom && noa >= veryHigh_noa && nom >= veryHigh_nom){
                    res.put("fuzzy_value", 1);
                }else {
                    fb.setVariable("lack_of_cohesion_in_methods",lcom);
                    fb.setVariable("number_of_attributes",noa);
                    fb.setVariable("number_of_methods",nom);
                    fb.evaluate();
                    res.put("fuzzy_value", fb.getVariable("res").getValue());
                }
                fuzzyResult.add(res);
                }
                queryEngine.resultToCSV(fuzzyResult,columns,"_BLOB.csv");
        }
}
 
开发者ID:GeoffreyHecht,项目名称:paprika,代码行数:41,代码来源:BLOBQuery.java

示例5: resultToCSV

import org.neo4j.graphdb.Result; //导入方法依赖的package包/类
public void resultToCSV(Result result, String csvSuffix) throws IOException {
    String name = csvPrefix+csvSuffix;
    FileWriter fw = new FileWriter(name);
    BufferedWriter writer = new BufferedWriter( fw );
    List<String> columns = result.columns();
    Object val;
    int i;
    int columns_size = columns.size()-1;
    for(i=0;i<columns_size;i++){
        writer.write(columns.get(i));
        writer.write(',');
    }
    writer.write(columns.get(i));
    writer.newLine();
    while ( result.hasNext()){
        Map<String,Object> row = result.next();
        for(i=0;i<columns_size;i++){
            val = row.get(columns.get(i));
            if(val != null){
                writer.write(val.toString());
                writer.write(',');
            }
        }
        val = row.get(columns.get(i));
        if(val != null){
            writer.write(val.toString());
        }
        writer.newLine();
    }
    writer.close();
    fw.close();
}
 
开发者ID:GeoffreyHecht,项目名称:paprika,代码行数:33,代码来源:QueryEngine.java

示例6: executeFuzzy

import org.neo4j.graphdb.Result; //导入方法依赖的package包/类
public void executeFuzzy(boolean details) throws CypherException, IOException {
        Result result;
        try (Transaction ignored = graphDatabaseService.beginTx()) {
            String query = "MATCH (c:Class{is_broadcast_receiver:true})-[:CLASS_OWNS_METHOD]->(m:Method{name:'onReceive'}) WHERE m.number_of_instructions > "+high_noi+" AND m.cyclomatic_complexity>"+high_cc+" return m.app_key as app_key,m.cyclomatic_complexity as cyclomatic_complexity, m.number_of_instructions as number_of_instructions";
            if(details){
                query += ",m.full_name as full_name";
            }
            result = graphDatabaseService.execute(query);
            List<String> columns = new ArrayList<>(result.columns());
            columns.add("fuzzy_value");
            int noi,cc;
            List<Map> fuzzyResult = new ArrayList<>();
            File fcf = new File(fclFile);
            //We look if the file is in a directory otherwise we look inside the jar
            FIS fis;
            if(fcf.exists() && !fcf.isDirectory()){
                fis = FIS.load(fclFile, false);
            }else{
                fis = FIS.load(getClass().getResourceAsStream(fclFile),false);
            }
            FunctionBlock fb = fis.getFunctionBlock(null);
            while(result.hasNext()){
                HashMap res = new HashMap(result.next());
                cc = (int) res.get("cyclomatic_complexity");
                noi = (int) res.get("number_of_instructions");
                if(cc >= veryHigh_cc && noi >= veryHigh_noi){
                    res.put("fuzzy_value", 1);
                }else {
                    fb.setVariable("cyclomatic_complexity",cc);
                    fb.setVariable("number_of_instructions",noi);
                    fb.evaluate();
                    res.put("fuzzy_value", fb.getVariable("res").getValue());
                }
                fuzzyResult.add(res);
                }
                queryEngine.resultToCSV(fuzzyResult,columns,"_HBR.csv");
        }
}
 
开发者ID:GeoffreyHecht,项目名称:paprika,代码行数:39,代码来源:HeavyBroadcastReceiverQuery.java

示例7: executeFuzzy

import org.neo4j.graphdb.Result; //导入方法依赖的package包/类
public void executeFuzzy(boolean details) throws CypherException, IOException {
        Result result;
        try (Transaction ignored = graphDatabaseService.beginTx()) {
            String query = "MATCH (cl:Class) WHERE HAS(cl.is_interface) AND cl.number_of_methods > " + high + " RETURN cl.app_key as app_key,cl.number_of_methods as number_of_methods";
            if(details){
                query += ",cl.name as full_name";
            }
            result = graphDatabaseService.execute(query);
            List<String> columns = new ArrayList<>(result.columns());
            columns.add("fuzzy_value");
            int cc;
            List<Map> fuzzyResult = new ArrayList<>();
            File fcf = new File(fclFile);
            //We look if the file is in a directory otherwise we look inside the jar
            FIS fis;
            if(fcf.exists() && !fcf.isDirectory()){
                fis = FIS.load(fclFile, false);
            }else{
                fis = FIS.load(getClass().getResourceAsStream(fclFile),false);
            }
            FunctionBlock fb = fis.getFunctionBlock(null);
            while(result.hasNext()){
                HashMap res = new HashMap(result.next());
                cc = (int) res.get("number_of_methods");
                if(cc >= veryHigh){
                    res.put("fuzzy_value", 1);
                }else {
                    fb.setVariable("number_of_methods",cc);
                    fb.evaluate();
                    res.put("fuzzy_value", fb.getVariable("res").getValue());
                }
                fuzzyResult.add(res);
                }
                queryEngine.resultToCSV(fuzzyResult,columns,"_SAK.csv");
        }
}
 
开发者ID:GeoffreyHecht,项目名称:paprika,代码行数:37,代码来源:SAKQuery.java

示例8: executeFuzzy

import org.neo4j.graphdb.Result; //导入方法依赖的package包/类
public void executeFuzzy(boolean details) throws CypherException, IOException {
        Result result;
        try (Transaction ignored = graphDatabaseService.beginTx()) {
            String query =  "MATCH (m:Method) WHERE m.number_of_instructions >" + high + " RETURN m.app_key as app_key,m.number_of_instructions as number_of_instructions";
            if(details){
                query += ",m.full_name as full_name";
            }
            result = graphDatabaseService.execute(query);
            List<String> columns = new ArrayList<>(result.columns());
            columns.add("fuzzy_value");
            int cc;
            List<Map> fuzzyResult = new ArrayList<>();
            File fcf = new File(fclFile);
            //We look if the file is in a directory otherwise we look inside the jar
            FIS fis;
            if(fcf.exists() && !fcf.isDirectory()){
                fis = FIS.load(fclFile, false);
            }else{
                fis = FIS.load(getClass().getResourceAsStream(fclFile),false);
            }
            FunctionBlock fb = fis.getFunctionBlock(null);
            while(result.hasNext()){
                HashMap res = new HashMap(result.next());
                cc = (int) res.get("number_of_instructions");
                if(cc >= veryHigh){
                    res.put("fuzzy_value", 1);
                }else {
                    fb.setVariable("number_of_instructions",cc);
                    fb.evaluate();
                    res.put("fuzzy_value", fb.getVariable("res").getValue());
                }
                fuzzyResult.add(res);
                }
                queryEngine.resultToCSV(fuzzyResult,columns,"_LM.csv");
        }
}
 
开发者ID:GeoffreyHecht,项目名称:paprika,代码行数:37,代码来源:LMQuery.java

示例9: executeFuzzy

import org.neo4j.graphdb.Result; //导入方法依赖的package包/类
public void executeFuzzy(boolean details) throws CypherException, IOException {
        Result result;
        try (Transaction ignored = graphDatabaseService.beginTx()) {
            String query = "MATCH (c:Class{parent_name:'android.os.AsyncTask'})-[:CLASS_OWNS_METHOD]->(m:Method) WHERE (m.name='onPreExecute' OR m.name='onProgressUpdate' OR m.name='onPostExecute') AND  m.number_of_instructions >"+high_noi+" AND m.cyclomatic_complexity > "+high_cc+" return m.app_key as app_key,m.cyclomatic_complexity as cyclomatic_complexity, m.number_of_instructions as number_of_instructions";
            if(details){
                query += ",m.full_name as full_name";
            }
            result = graphDatabaseService.execute(query);
            List<String> columns = new ArrayList<>(result.columns());
            columns.add("fuzzy_value");
            int noi,cc;
            List<Map> fuzzyResult = new ArrayList<>();
            File fcf = new File(fclFile);
            //We look if the file is in a directory otherwise we look inside the jar
            FIS fis;
            if(fcf.exists() && !fcf.isDirectory()){
                fis = FIS.load(fclFile, false);
            }else{
                fis = FIS.load(getClass().getResourceAsStream(fclFile),false);
            }
            FunctionBlock fb = fis.getFunctionBlock(null);
            while(result.hasNext()){
                HashMap res = new HashMap(result.next());
                cc = (int) res.get("cyclomatic_complexity");
                noi = (int) res.get("number_of_instructions");
                if(cc >= veryHigh_cc && noi >= veryHigh_noi){
                    res.put("fuzzy_value", 1);
                }else {
                    fb.setVariable("cyclomatic_complexity",cc);
                    fb.setVariable("number_of_instructions",noi);
                    fb.evaluate();
                    res.put("fuzzy_value", fb.getVariable("res").getValue());
                }
                fuzzyResult.add(res);
                }
                queryEngine.resultToCSV(fuzzyResult,columns,"_HAS.csv");
        }
}
 
开发者ID:GeoffreyHecht,项目名称:paprika,代码行数:39,代码来源:HeavyAsyncTaskStepsQuery.java

示例10: executeFuzzy

import org.neo4j.graphdb.Result; //导入方法依赖的package包/类
public void executeFuzzy(boolean details) throws CypherException, IOException {
        Result result;
        try (Transaction ignored = graphDatabaseService.beginTx()) {
            String query = "MATCH (cl:Class) WHERE cl.class_complexity > " + high + " RETURN cl.app_key as app_key, cl.class_complexity as class_complexity";
            if(details){
                query += ",cl.name as full_name";
            }
            result = graphDatabaseService.execute(query);
            List<String> columns = new ArrayList<>(result.columns());
            columns.add("fuzzy_value");
            int cc;
            List<Map> fuzzyResult = new ArrayList<>();
            File fcf = new File(fclFile);
            //We look if the file is in a directory otherwise we look inside the jar
            FIS fis;
            if(fcf.exists() && !fcf.isDirectory()){
                fis = FIS.load(fclFile, false);
            }else{
                fis = FIS.load(getClass().getResourceAsStream(fclFile),false);
            }
            FunctionBlock fb = fis.getFunctionBlock(null);
            while(result.hasNext()){
                HashMap res = new HashMap(result.next());
                cc = (int) res.get("class_complexity");
                if(cc >= veryHigh){
                    res.put("fuzzy_value", 1);
                }else {
                    fb.setVariable("class_complexity",cc);
                    fb.evaluate();
                    res.put("fuzzy_value", fb.getVariable("res").getValue());
                }
                fuzzyResult.add(res);
                }
                queryEngine.resultToCSV(fuzzyResult,columns,"_CC.csv");
        }
}
 
开发者ID:GeoffreyHecht,项目名称:paprika,代码行数:37,代码来源:CCQuery.java

示例11: executeFuzzy

import org.neo4j.graphdb.Result; //导入方法依赖的package包/类
public void executeFuzzy(boolean details) throws CypherException, IOException {
        Result result;
        try (Transaction ignored = graphDatabaseService.beginTx()) {
            String query = "MATCH (c:Class{is_service:true})-[:CLASS_OWNS_METHOD]->(m:Method{name:'onStartCommand'}) WHERE m.number_of_instructions > "+high_noi+" AND m.cyclomatic_complexity>"+high_cc+" return m.app_key as app_key,m.cyclomatic_complexity as cyclomatic_complexity, m.number_of_instructions as number_of_instructions";
            if(details){
                query += ",m.full_name as full_name";
            }
            result = graphDatabaseService.execute(query);
            List<String> columns = new ArrayList<>(result.columns());
            columns.add("fuzzy_value");
            int noi,cc;
            List<Map> fuzzyResult = new ArrayList<>();
            File fcf = new File(fclFile);
            //We look if the file is in a directory otherwise we look inside the jar
            FIS fis;
            if(fcf.exists() && !fcf.isDirectory()){
                fis = FIS.load(fclFile, false);
            }else{
                fis = FIS.load(getClass().getResourceAsStream(fclFile),false);
            }
            FunctionBlock fb = fis.getFunctionBlock(null);
            while(result.hasNext()){
                HashMap res = new HashMap(result.next());
                cc = (int) res.get("cyclomatic_complexity");
                noi = (int) res.get("number_of_instructions");
                if(cc >= veryHigh_cc && noi >= veryHigh_noi){
                    res.put("fuzzy_value", 1);
                }else {
                    fb.setVariable("cyclomatic_complexity",cc);
                    fb.setVariable("number_of_instructions",noi);
                    fb.evaluate();
                    res.put("fuzzy_value", fb.getVariable("res").getValue());
                }
                fuzzyResult.add(res);
                }
                queryEngine.resultToCSV(fuzzyResult,columns,"_HSS.csv");
        }
}
 
开发者ID:GeoffreyHecht,项目名称:paprika,代码行数:39,代码来源:HeavyServiceStartQuery.java


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