本文整理汇总了Java中org.neo4j.server.plugins.Name类的典型用法代码示例。如果您正苦于以下问题:Java Name类的具体用法?Java Name怎么用?Java Name使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Name类属于org.neo4j.server.plugins包,在下文中一共展示了Name类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: executeScript
import org.neo4j.server.plugins.Name; //导入依赖的package包/类
@Name("execute_script")
@Description("execute a Gremlin script with 'g' set to the Neo4j2Graph and 'results' containing the results. Only results of one object type is supported.")
@PluginTarget(GraphDatabaseService.class)
public Representation executeScript(
@Source final GraphDatabaseService neo4j,
@Description("The Gremlin script") @Parameter(name = "script", optional = false) final String script,
@Description("JSON Map of additional parameters for script variables") @Parameter(name = "params", optional = true) final Map params ) throws BadInputException
{
Neo4j2Graph neo4jGraph = getOrCreateGremlin( (GraphDatabaseAPI) neo4j );
try(Transaction tx = neo4j.beginTx())
{
engineReplacementDecision.beforeExecution( script );
final Bindings bindings = createBindings(params, neo4jGraph);
final Object result = engine().eval( script, bindings );
Representation representation = GremlinObjectToRepresentationConverter.convert(result);
tx.success();
return representation;
}
catch ( final Exception e )
{
throw new BadInputException( e.getMessage(), e );
}
}
开发者ID:neo4j-contrib,项目名称:gremlin-plugin,代码行数:24,代码来源:GremlinPlugin.java
示例2: getAllNodes
import org.neo4j.server.plugins.Name; //导入依赖的package包/类
@Name("get_all_nodes")
@Description("Get all nodes from the Neo4j graph database")
@PluginTarget(GraphDatabaseService.class)
public Iterable<Node> getAllNodes( @Source GraphDatabaseService graphDb )
{
ArrayList<Node> nodes = new ArrayList<>();
try ( Transaction tx = graphDb.beginTx() )
{
for ( Node node : graphDb.getAllNodes() )
{
nodes.add( node );
}
tx.success();
}
return nodes;
}
开发者ID:AtomRain,项目名称:neo4j-extensions,代码行数:17,代码来源:GetAll.java
示例3: neonetworkanalyzer
import org.neo4j.server.plugins.Name; //导入依赖的package包/类
@Name( "neonetworkanalyzer" )
@Description( "runs the whole network analyzer on the graph" )
@PluginTarget( GraphDatabaseService.class )
public Iterable<String> neonetworkanalyzer( @Source GraphDatabaseService graph,
@Description( "flag to indicate if the statistics should be stored in the graph database" )
@Parameter( name = "saveInGraph", optional = false ) boolean saveInGraph,
@Description( "flag to indicate if the eccentricity should be calculated" )
@Parameter( name = "eccentricity", optional = false ) boolean eccentricity,
@Description( "flag to indicate if the betweenness should be calculated" )
@Parameter( name = "betweenness", optional = false ) boolean betweenness,
@Description( "flag to indicate if the stress should be calculated" )
@Parameter( name = "stress", optional = false ) boolean stress,
@Description( "flag to indicate if the avgSP should be calculated" )
@Parameter( name = "avgSP", optional = false ) boolean avgSP,
@Description( "flag to indicate if the radiality should be calculated" )
@Parameter( name = "radiality", optional = false ) boolean radiality,
@Description( "flag to indicate if the topoCoeff should be calculated" )
@Parameter( name = "topoCoeff", optional = false ) boolean topoCoeff,
@Description( "flag to indicate if the neighbourhood should be calculated" )
@Parameter( name = "neighbourhood", optional = false ) boolean neighbourhood,
@Description( "flag to indicate if the multiEdgePairs should be calculated" )
@Parameter( name = "multiEdgePairs", optional = false ) boolean multiEdgePairs,
@Description( "flag to indicate if the closeness should be calculated" )
@Parameter( name = "closeness", optional = false ) boolean closeness,
@Description( "flag to indicate if the clustCoeff should be calculated" )
@Parameter( name = "clustCoeff", optional = false ) boolean clustCoeff)
{
List<String> result = null;
long start = System.currentTimeMillis();
NeoAnalyzer analyzer = new NeoAnalyzerImplMT(eccentricity,betweenness,stress,avgSP,radiality,topoCoeff,neighbourhood,multiEdgePairs,closeness,clustCoeff);
result = analyzer.analyze(graph,saveInGraph);
long end = System.currentTimeMillis();
System.out.println("analysis ran for " + (end - start) + " ms");
return result;
}
开发者ID:gsummer,项目名称:neoNetworkAnalyzer,代码行数:39,代码来源:NeoAnalyzerExt.java
示例4: openord
import org.neo4j.server.plugins.Name; //导入依赖的package包/类
@Name( "openord" )
@Description( "calculates the openord layout" )
@PluginTarget( GraphDatabaseService.class )
public Iterable<Double> openord( @Source GraphDatabaseService graph )
{
return null;
}
开发者ID:gsummer,项目名称:neoLayouts,代码行数:8,代码来源:OpenOrdLayout.java
示例5: gridlayout
import org.neo4j.server.plugins.Name; //导入依赖的package包/类
@Name( "gridlayout" )
@Description( "calculates a grid layout" )
@PluginTarget( GraphDatabaseService.class )
public Iterable<Double> gridlayout( @Source GraphDatabaseService graph,
@Description( "flag to indicate if the layout should be stored in the graph database" )
@Parameter( name = "saveInGraph", optional = false ) boolean saveInGraph)
{
ExecutionEngine engine = new ExecutionEngine( graph );
int n = 0;
int distanceBetweenNodesX = 80; // would normally add the node size here
int distanceBetweenNodesY = 40;
try (Transaction tx = graph.beginTx()){
String query = "match (n) return count(n) as num";
ResourceIterator<Long> resultIterator = engine.execute( query).columnAs( "num" );
n = new Long(resultIterator.next()).intValue();
tx.success();
}
List<Double> result = new ArrayList<Double>(n*3);
int nCols = (int)Math.ceil(Math.sqrt(n));
// int i = 0;
int currCol = 0;
int currRow = 0;
try (Transaction tx = graph.beginTx()){
for(Node node : GlobalGraphOperations.at(graph).getAllNodes()){
if(currCol == nCols){
currCol = 0;
currRow = currRow + 1;
}
double currX = currCol * distanceBetweenNodesX;
double currY = currRow * distanceBetweenNodesY;
addToResult(node,currX,currY,result,saveInGraph);
// result.add(i, new Long(node.getId()).doubleValue());
// i=i+1; // go to x
// result.add(i, currX);
// i=i+1;
// result.add(i, currY);
// i=i+1;
currCol = currCol + 1;
// if(saveInGraph){
// node.setProperty(PREFIX_X, currX);
// node.setProperty(PREFIX_Y, currY);
// }
}
tx.success();
}
return result;
}
开发者ID:gsummer,项目名称:neoLayouts,代码行数:59,代码来源:GridLayoutExtension.java
注:本文中的org.neo4j.server.plugins.Name类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论