本文整理汇总了Java中org.neo4j.graphdb.Label类的典型用法代码示例。如果您正苦于以下问题:Java Label类的具体用法?Java Label怎么用?Java Label使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Label类属于org.neo4j.graphdb包,在下文中一共展示了Label类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeLabels
import org.neo4j.graphdb.Label; //导入依赖的package包/类
protected Label[] computeLabels(Object incoming) throws IllegalAccessException {
Label[] labels = new Label[0];
if (StringUtils.isNotEmpty(this.labelsField)) {
String labelList = (String) this.getObjectProperty(incoming, this.labelsField);
if (StringUtils.isNotEmpty(labelList)) {
String[] labelTab = labelList.split(";");
labels = new Label[labelTab.length];
for (int i = 0; i < labelTab.length; i++) {
labels[i] = DynamicLabel.label(labelTab[i]);
}
}
}
return labels;
}
示例2: run
import org.neo4j.graphdb.Label; //导入依赖的package包/类
public void run(GraphDatabaseService db) {
this.db = db;
codeIndexes = new CodeIndexes(db);
try (Transaction tx=db.beginTx()){
for (Node node:db.getAllNodes()){
if (!node.hasProperty(TextExtractor.IS_TEXT)||!(boolean)node.getProperty(TextExtractor.IS_TEXT))
continue;
if (node.hasLabel(Label.label(JavaCodeExtractor.CLASS)))
continue;
if (node.hasLabel(Label.label(JavaCodeExtractor.METHOD)))
continue;
if (node.hasLabel(Label.label(JavaCodeExtractor.INTERFACE)))
continue;
if (node.hasLabel(Label.label(JavaCodeExtractor.FIELD)))
continue;
textNodes.add(node);
}
fromHtmlToCodeElement();
fromTextToJira();
fromDiffToCodeElement();
tx.success();
}
}
示例3: fromTextToJira
import org.neo4j.graphdb.Label; //导入依赖的package包/类
private void fromTextToJira(){
Map<String, Node> jiraMap=new HashMap<>();
try (Transaction tx = db.beginTx()) {
for (Node node:db.getAllNodes()){
if (node.hasLabel(Label.label(JiraExtractor.ISSUE))){
String name=(String) node.getProperty(JiraExtractor.ISSUE_NAME);
jiraMap.put(name, node);
}
}
tx.success();
}
try (Transaction tx = db.beginTx()) {
for (Node srcNode : textNodes) {
String content = text(srcNode);
Set<String> tokenSet=new HashSet<>();
for (String e:content.split("[^A-Za-z0-9\\-_]+"))
tokenSet.add(e);
for (String jiraName:jiraMap.keySet()){
if (tokenSet.contains(jiraName))
srcNode.createRelationshipTo(jiraMap.get(jiraName), RelationshipType.withName(REFERENCE));
}
}
tx.success();
}
}
示例4: createIssueNode
import org.neo4j.graphdb.Label; //导入依赖的package包/类
public static void createIssueNode(IssueInfo issueInfo, Node node) {
node.addLabel(Label.label(JiraExtractor.ISSUE));
node.setProperty(JiraExtractor.ISSUE_ID, issueInfo.getIssueId());
node.setProperty(JiraExtractor.ISSUE_NAME, issueInfo.getIssueName());
node.setProperty(JiraExtractor.ISSUE_SUMMARY, issueInfo.getSummary());
node.setProperty(JiraExtractor.ISSUE_TYPE, issueInfo.getType());
node.setProperty(JiraExtractor.ISSUE_STATUS, issueInfo.getStatus());
node.setProperty(JiraExtractor.ISSUE_PRIORITY, issueInfo.getPriority());
node.setProperty(JiraExtractor.ISSUE_RESOLUTION, issueInfo.getResolution());
node.setProperty(JiraExtractor.ISSUE_VERSIONS, issueInfo.getVersions());
node.setProperty(JiraExtractor.ISSUE_FIX_VERSIONS, issueInfo.getFixVersions());
node.setProperty(JiraExtractor.ISSUE_COMPONENTS, issueInfo.getComponents());
node.setProperty(JiraExtractor.ISSUE_LABELS, issueInfo.getLabels());
node.setProperty(JiraExtractor.ISSUE_DESCRIPTION, issueInfo.getDescription());
node.setProperty(JiraExtractor.ISSUE_CREATOR_NAME, issueInfo.getCrearorName());
node.setProperty(JiraExtractor.ISSUE_ASSIGNEE_NAME, issueInfo.getAssigneeName());
node.setProperty(JiraExtractor.ISSUE_REPORTER_NAME, issueInfo.getReporterName());
node.setProperty(JiraExtractor.ISSUE_CREATED_DATE, issueInfo.getCreatedDate());
node.setProperty(JiraExtractor.ISSUE_UPDATED_DATE, issueInfo.getUpdatedDate());
node.setProperty(JiraExtractor.ISSUE_RESOLUTION_DATE, issueInfo.getResolutionDate());
}
示例5: createUserNode
import org.neo4j.graphdb.Label; //导入依赖的package包/类
private void createUserNode(Node mailNode, String userName, String userAddress, boolean sender) {
Node userNode;
if (!mailUserMap.containsKey(userAddress)) {
userNode = db.createNode();
userNode.addLabel(Label.label(MailListExtractor.MAILUSER));
userNode.setProperty(MailListExtractor.MAILUSER_MAIL, userAddress);
mailUserMap.put(userAddress, userNode);
}
userNode = mailUserMap.get(userAddress);
if (!mailUserNameMap.containsKey(userAddress))
mailUserNameMap.put(userAddress, new HashSet<>());
mailUserNameMap.get(userAddress).add(userName);
if (sender)
mailNode.createRelationshipTo(userNode, RelationshipType.withName(MailListExtractor.MAIL_SENDER));
else
mailNode.createRelationshipTo(userNode, RelationshipType.withName(MailListExtractor.MAIL_RECEIVER));
}
示例6: creatBugzillaIssueNode
import org.neo4j.graphdb.Label; //导入依赖的package包/类
public static void creatBugzillaIssueNode(BugInfo bugInfo, Node node) {
node.addLabel(Label.label(BugzillaExtractor.BUGZILLAISSUE));
node.setProperty(BugzillaExtractor.ISSUE_BUGID, bugInfo.getBugId());
node.setProperty(BugzillaExtractor.ISSUE_CREATIONTS, bugInfo.getCreationTs());
node.setProperty(BugzillaExtractor.ISSUE_SHORTDESC, bugInfo.getShortDesc());
node.setProperty(BugzillaExtractor.ISSUE_DELTATS, bugInfo.getDeltaTs());
node.setProperty(BugzillaExtractor.ISSUE_CLASSIFICATION, bugInfo.getClassification());
node.setProperty(BugzillaExtractor.ISSUE_PRODUCT, bugInfo.getProduct());
node.setProperty(BugzillaExtractor.ISSUE_COMPONENT, bugInfo.getComponent());
node.setProperty(BugzillaExtractor.ISSUE_VERSION, bugInfo.getVersion());
node.setProperty(BugzillaExtractor.ISSUE_REPPLATFORM, bugInfo.getRepPlatform());
node.setProperty(BugzillaExtractor.ISSUE_OPSYS, bugInfo.getOpSys());
node.setProperty(BugzillaExtractor.ISSUE_BUGSTATUS, bugInfo.getBugStatus());
node.setProperty(BugzillaExtractor.ISSUE_RESOLUTION, bugInfo.getResolution());
node.setProperty(BugzillaExtractor.ISSUE_PRIORITY, bugInfo.getPriority());
node.setProperty(BugzillaExtractor.ISSUE_BUGSEVERITIY, bugInfo.getBugSeverity());
node.setProperty(BugzillaExtractor.ISSUE_REPROTER, bugInfo.getReporter());
node.setProperty(BugzillaExtractor.ISSUE_REPROTERNAME, bugInfo.getReporterName());
node.setProperty(BugzillaExtractor.ISSUE_ASSIGNEDTO, bugInfo.getAssignedTo());
node.setProperty(BugzillaExtractor.ISSUE_ASSIGNEENAME, bugInfo.getAssignedToName());
}
示例7: createSectionNode
import org.neo4j.graphdb.Label; //导入依赖的package包/类
public static void createSectionNode(SectionInfo section, Node node) {
node.addLabel(Label.label(WordKnowledgeExtractor.DOCX_SECTION));
if(section.getTitle() != null) node.setProperty(WordKnowledgeExtractor.SECTION_TITLE, section.getTitle());
else node.setProperty(WordKnowledgeExtractor.SECTION_TITLE, "");
node.setProperty(WordKnowledgeExtractor.SECTION_LAYER, section.getLayer());
if(section.getSectionNumber() != null) node.setProperty(WordKnowledgeExtractor.SECTION_NUMBER, section.getSectionNumber());
else node.setProperty(WordKnowledgeExtractor.SECTION_NUMBER, "");
if(section.getUsageType() != null) node.setProperty(WordKnowledgeExtractor.SECTION_USAGE_TYPE, section.getUsageType());
else node.setProperty(WordKnowledgeExtractor.SECTION_USAGE_TYPE, "");
if(section.getPackageName() != null) node.setProperty(WordKnowledgeExtractor.SECTION_PACKAGE, section.getPackageName());
else node.setProperty(WordKnowledgeExtractor.SECTION_PACKAGE, "");
HashSet<String> sectionApis = section.getApiList();
String nodeApiList = "";
for(String api : sectionApis) {
nodeApiList = nodeApiList + "\n" + api;
}
node.setProperty(WordKnowledgeExtractor.SECTION_APIS, nodeApiList);
if(section.getProjectName() != null) node.setProperty(WordKnowledgeExtractor.SECTION_PROJECT_NAME, section.getProjectName());
else node.setProperty(WordKnowledgeExtractor.SECTION_PROJECT_NAME, "");
}
示例8: QaUserInfo
import org.neo4j.graphdb.Label; //导入依赖的package包/类
public QaUserInfo(Node node, int id, int reputation, String creationDate, String displayName, String lastAccessDate, int views, int upVotes, int downVotes) {
this.node = node;
this.userId = id;
this.displayName = displayName;
node.addLabel(Label.label(StackOverflowExtractor.USER));
node.setProperty(StackOverflowExtractor.USER_ID, id);
node.setProperty(StackOverflowExtractor.USER_REPUTATION, reputation);
node.setProperty(StackOverflowExtractor.USER_CREATION_DATE, creationDate);
node.setProperty(StackOverflowExtractor.USER_DISPLAY_NAME, displayName);
node.setProperty(StackOverflowExtractor.USER_LAST_ACCESS_dATE, lastAccessDate);
node.setProperty(StackOverflowExtractor.USER_VIEWS, views);
node.setProperty(StackOverflowExtractor.USER_UP_VOTES, upVotes);
node.setProperty(StackOverflowExtractor.USER_DOWN_VOTES, downVotes);
}
示例9: AnswerInfo
import org.neo4j.graphdb.Label; //导入依赖的package包/类
public AnswerInfo(Node node, int id, int parentId, String creationDate, int score, String body, int ownerUserId) {
this.node = node;
this.answerId = id;
this.parentQuestionId = parentId;
this.ownerUserId = ownerUserId;
node.addLabel(Label.label(StackOverflowExtractor.ANSWER));
node.setProperty(StackOverflowExtractor.ANSWER_ID, id);
node.setProperty(StackOverflowExtractor.ANSWER_PARENT_QUESTION_ID, parentId);
node.setProperty(StackOverflowExtractor.ANSWER_CREATION_DATE, creationDate);
node.setProperty(StackOverflowExtractor.ANSWER_SCORE, score);
node.setProperty(StackOverflowExtractor.ANSWER_BODY, body);
node.setProperty(StackOverflowExtractor.ANSWER_OWNER_USER_ID, ownerUserId);
node.setProperty(StackOverflowExtractor.ANSWER_ACCEPTED, false);
}
示例10: QuestionInfo
import org.neo4j.graphdb.Label; //导入依赖的package包/类
public QuestionInfo(Node node, int id, String creationDate, int score, int viewCount, String body, int ownerUserId, String title, String tags, int acceptedAnswerId) {
this.node = node;
this.questionId = id;
this.acceptedAnswerId = acceptedAnswerId;
this.ownerUserId = ownerUserId;
node.addLabel(Label.label(StackOverflowExtractor.QUESTION));
node.setProperty(StackOverflowExtractor.QUESTION_ID, id);
node.setProperty(StackOverflowExtractor.QUESTION_CREATION_DATE, creationDate);
node.setProperty(StackOverflowExtractor.QUESTION_SCORE, score);
node.setProperty(StackOverflowExtractor.QUESTION_VIEW_COUNT, viewCount);
node.setProperty(StackOverflowExtractor.QUESTION_BODY, body);
node.setProperty(StackOverflowExtractor.QUESTION_OWNER_USER_ID, ownerUserId);
node.setProperty(StackOverflowExtractor.QUESTION_TITLE, title);
node.setProperty(StackOverflowExtractor.QUESTION_TAGS, tags);
}
示例11: QaCommentInfo
import org.neo4j.graphdb.Label; //导入依赖的package包/类
public QaCommentInfo(Node node, int id, int parentId, int score, String text, String creationDate, int userId) {
this.node = node;
this.commentId = id;
this.parentId = parentId;
this.userId = userId;
node.addLabel(Label.label(StackOverflowExtractor.COMMENT));
node.setProperty(StackOverflowExtractor.COMMENT_ID, id);
node.setProperty(StackOverflowExtractor.COMMENT_PARENT_ID, parentId);
node.setProperty(StackOverflowExtractor.COMMENT_SCORE, score);
node.setProperty(StackOverflowExtractor.COMMENT_TEXT, text);
node.setProperty(StackOverflowExtractor.COMMENT_CREATION_DATE, creationDate);
node.setProperty(StackOverflowExtractor.COMMENT_USER_ID, userId);
}
示例12: createMethodNode
import org.neo4j.graphdb.Label; //导入依赖的package包/类
public static void createMethodNode(MethodInfo methodInfo, Node node) {
node.addLabel(Label.label(JavaCodeExtractor.METHOD));
node.setProperty(JavaCodeExtractor.METHOD_NAME, methodInfo.name);
node.setProperty(JavaCodeExtractor.METHOD_RETURN, methodInfo.returnString);
node.setProperty(JavaCodeExtractor.METHOD_ACCESS, methodInfo.visibility);
node.setProperty(JavaCodeExtractor.METHOD_IS_CONSTRUCTOR, methodInfo.isConstruct);
node.setProperty(JavaCodeExtractor.METHOD_IS_ABSTRACT, methodInfo.isAbstract);
node.setProperty(JavaCodeExtractor.METHOD_IS_FINAL, methodInfo.isFinal);
node.setProperty(JavaCodeExtractor.METHOD_IS_STATIC, methodInfo.isStatic);
node.setProperty(JavaCodeExtractor.METHOD_IS_SYNCHRONIZED, methodInfo.isSynchronized);
node.setProperty(JavaCodeExtractor.METHOD_CONTENT, methodInfo.content);
node.setProperty(JavaCodeExtractor.METHOD_COMMENT, methodInfo.comment);
node.setProperty(JavaCodeExtractor.METHOD_BELONGTO, methodInfo.belongTo);
node.setProperty(JavaCodeExtractor.METHOD_PARAMS, methodInfo.paramString);
node.setProperty(JavaCodeExtractor.METHOD_THROWS, String.join(", ", methodInfo.throwSet));
node.setProperty(JavaCodeExtractor.SIGNATURE, methodInfo.belongTo+"."+methodInfo.name+"("+methodInfo.paramString+")");
}
示例13: accept
import org.neo4j.graphdb.Label; //导入依赖的package包/类
@Override
public <R, E extends Throwable> R accept(Visitor<R, E> visitor) throws E {
for (Node node : dbServices.getAllNodes()) {
if (node.hasLabel(Label.label("CompilationUnit"))) {
continue;
}
if (node.hasLabel(Label.label("SourceSpan"))) {
continue;
}
if (node.hasLabel(Label.label("SourceLocation"))) {
continue;
}
visitor.visitNode(node);
for (Relationship edge : node.getRelationships(Direction.OUTGOING)) {
if (edge.isType(RelationshipType.withName("location"))) {
continue;
}
visitor.visitRelationship(edge);
}
}
return visitor.done();
}
示例14: newContext
import org.neo4j.graphdb.Label; //导入依赖的package包/类
/**
* Get current configuration manager
* @return
*/
public static DocumentGrapherExecutionContext newContext(GraphDatabaseService db, Log log)
{
if(instance == null)
{
Node configurationNode = db.findNode(Label.label("JSON_CONFIG"), "configuration", "byNode");
if(configurationNode == null)
{
log.info("Load default configuration: "+JsonHelperConfigurationDefault.class);
instance = new JsonHelperConfigurationDefault();
}else
{
log.info("Load configuration from node: "+JsonHelperConfigurationByNode.class);
instance = new JsonHelperConfigurationByNode(configurationNode);
}
}
return instance.buildContext(db, log);
}
示例15: findNodeIntoGraphDb
import org.neo4j.graphdb.Label; //导入依赖的package包/类
/**
* Search into database if exists a node with documentId
* @param label
* @param documentId
* @return
*/
private Node findNodeIntoGraphDb(Label label, DocumentId documentId) {
Node node = null;
//check if node already exists
String query = "MATCH (n:"+label.name()+" {"+documentId.toCypherFilter()+"}) RETURN n";
if(log.isDebugEnabled())
{
log.debug(query);
}
Result result = db.execute(query);
while (result.hasNext()) {
Map<String, Object> row = result.next();
node = (Node) row.get("n");
if(log.isDebugEnabled())
{
log.debug("Found: "+node);
}
}
return node;
}