本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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");
}
}
示例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();
}
示例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");
}
}
示例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");
}
}
示例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");
}
}
示例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");
}
}
示例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");
}
}
示例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");
}
}