Package org.gephi.io.importer.api

Examples of org.gephi.io.importer.api.ColumnDraft


                report.log("Node property found: label");
            } else if (columnName.equals("labelvisible")) {
                nodeColumns[i - 1] = new GDFColumn(GDFColumn.NodeGuessColumn.LABELVISIBLE);
                report.log("Node property found: labelvisible");
            } else {
                ColumnDraft column = container.getNodeColumn(columnName);
                if (column == null) {
                    column = container.addNodeColumn(columnName, type);
                    nodeColumns[i - 1] = new GDFColumn(column);
                    report.log("Node attribute " + columnName + " (" + type.getSimpleName() + ")");
                } else {
View Full Code Here


                report.log("Edge property found: label");
            } else if (columnName.equals("labelvisible")) {
                edgeColumns[i - 2] = new GDFColumn(GDFColumn.EdgeGuessColumn.LABELVISIBLE);
                report.log("Edge property found: labelvisible");
            } else {
                ColumnDraft column = container.getEdgeColumn(columnName);
                if (column == null) {
                    column = container.addEdgeColumn(columnName, type);
                    edgeColumns[i - 2] = new GDFColumn(column);
                    report.log("Edge attribute " + columnName + " (" + type.getSimpleName() + ")");
                } else {
View Full Code Here

                }
                return;
            }

            //Data attribute value
            ColumnDraft column = container.getNodeColumn(fore);
            if (column != null) {
                try {
                    node.parseAndSetValue(column.getId(), value);
                } catch (Exception e) {
                    report.logIssue(new Issue(NbBundle.getMessage(ImporterGraphML.class, "importerGraphML_error_datavalue", fore, node, column.getTitle()), Issue.Level.SEVERE));
                }
            }
        }
    }
View Full Code Here

                }
                return;
            }

            //Data attribute value
            ColumnDraft column = container.getEdgeColumn(fore);
            if (column != null) {
                try {
                    edge.parseAndSetValue(column.getId(), value);
                } catch (Exception e) {
                    report.logIssue(new Issue(NbBundle.getMessage(ImporterGraphML.class, "importerGraphML_error_datavalue", fore, edge, column.getTitle()), Issue.Level.SEVERE));
                }
            }
        }
    }
View Full Code Here

                report.logIssue(new Issue(NbBundle.getMessage(ImporterGraphML.class, "importerGraphML_error_attributetype2", type), Issue.Level.SEVERE));
                return;
            }

            //Add to model
            ColumnDraft column = null;
            if ("node".equalsIgnoreCase(forStr) || "all".equalsIgnoreCase(forStr)) {
                if (container.getNodeColumn(id) != null) {
                    report.log(NbBundle.getMessage(ImporterGraphML.class, "importerGraphML_error_attributecolumn_exist", id));
                    return;
                }
                column = container.addNodeColumn(id, attributeType);
                column.setTitle(title);
                report.log(NbBundle.getMessage(ImporterGraphML.class, "importerGraphML_log_nodeattribute", title, attributeType.getCanonicalName()));
            } else if ("edge".equalsIgnoreCase(forStr) || "all".equalsIgnoreCase(forStr)) {
                if (container.getEdgeColumn(id) != null) {
                    report.log(NbBundle.getMessage(ImporterGraphML.class, "importerGraphML_error_attributecolumn_exist", id));
                    return;
                }
                column = container.addEdgeColumn(id, attributeType);
                column.setTitle(title);
                report.log(NbBundle.getMessage(ImporterGraphML.class, "importerGraphML_log_edgeattribute", title, attributeType.getCanonicalName()));
            }

            if (column != null && !defaultStr.isEmpty()) {
                try {
                    column.setDefaultValueString(defaultStr);
                    report.log(NbBundle.getMessage(ImporterGraphML.class, "importerGraphML_log_default", defaultStr, title));
                } catch (Exception e) {
                    report.logIssue(new Issue(NbBundle.getMessage(ImporterGraphML.class, "importerGraphML_error_attributedefault", title, attributeType.getCanonicalName()), Issue.Level.SEVERE));
                }
            }
View Full Code Here

                NodeProperties p = properties.getNodeProperty(columnName);
                if (p != null) {
                    injectNodeProperty(p, rs, i + 1, node);
                } else {
                    //Inject node attributes
                    ColumnDraft col = container.getNodeColumn(columnName);
                    injectElementAttribute(rs, i + 1, col, node);
                }
            }
//            injectTimeIntervalProperty(node);
            container.addNode(node);
View Full Code Here

                EdgeProperties p = properties.getEdgeProperty(columnName);
                if (p != null) {
                    injectEdgeProperty(p, rs, i + 1, edge);
                } else {
                    //Inject edge attributes
                    ColumnDraft col = container.getEdgeColumn(columnName);
                    injectElementAttribute(rs, i + 1, col, edge);
                }
            }
//            injectTimeIntervalProperty(edge);
            container.addEdge(edge);
View Full Code Here

    public void generate(ContainerLoader container) {
        Random random = new Random();
        double start = 2000.0;
        double end = 2015.0;
        double tick = 1.0;
        ColumnDraft col = container.addNodeColumn("score", Integer.class, true);

        NodeDraft[] nodeArray = new NodeDraft[numberOfNodes];
        for (int i = 0; i < numberOfNodes; i++) {
            NodeDraft nodeDraft = container.factory().newNodeDraft("n" + i);
            container.addNode(nodeDraft);

            Random r = new Random();
            for (double t = start; t < end; t += tick) {
                if (r.nextBoolean()) {
                    nodeDraft.addTimestamp(t);
                    nodeDraft.setValue(col.getId(), r.nextInt(5), t);
                }
            }

            nodeArray[i] = nodeDraft;
        }
View Full Code Here

        return addNodeColumn(key, typeClass, false);
    }

    @Override
    public ColumnDraft addNodeColumn(String key, Class typeClass, boolean dynamic) {
        ColumnDraft column = nodeColumns.get(key);
        if (column == null) {
            int index = nodeColumns.size();
            column = new ColumnDraftImpl(key, index, dynamic, typeClass);
            nodeColumns.put(key, column);
            if (dynamic) {
                report.log(NbBundle.getMessage(ImportContainerImpl.class, "ImportContainerLog.AddDynamicNodeColumn", key, typeClass.getSimpleName()));
            } else {
                report.log(NbBundle.getMessage(ImportContainerImpl.class, "ImportContainerLog.AddNodeColumn", key, typeClass.getSimpleName()));
            }
        } else {
            if (!column.getTypeClass().equals(typeClass)) {
                report.logIssue(new Issue(NbBundle.getMessage(ImportContainerImpl.class, "ImportContainerException_Column_Type_Mismatch", key, column.getTypeClass()), Level.SEVERE));
            }
        }
        return column;
    }
View Full Code Here

        return addEdgeColumn(key, typeClass, false);
    }

    @Override
    public ColumnDraft addEdgeColumn(String key, Class typeClass, boolean dynamic) {
        ColumnDraft column = edgeColumns.get(key);
        if (column == null) {
            int index = edgeColumns.size();
            column = new ColumnDraftImpl(key, index, dynamic, typeClass);
            edgeColumns.put(key, column);
            if (dynamic) {
                report.log(NbBundle.getMessage(ImportContainerImpl.class, "ImportContainerLog.AddDynamicEdgeColumn", key, typeClass.getSimpleName()));
            } else {
                report.log(NbBundle.getMessage(ImportContainerImpl.class, "ImportContainerLog.AddEdgeColumn", key, typeClass.getSimpleName()));
            }
        } else {
            if (!column.getTypeClass().equals(typeClass)) {
                report.logIssue(new Issue(NbBundle.getMessage(ImportContainerImpl.class, "ImportContainerException_Column_Type_Mismatch", key, column.getTypeClass()), Level.SEVERE));
            }
        }
        return column;
    }
View Full Code Here

TOP

Related Classes of org.gephi.io.importer.api.ColumnDraft

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.