Package org.gephi.io.importer.api.PropertiesAssociations

Examples of org.gephi.io.importer.api.PropertiesAssociations.EdgeProperties


        int count = 0;
        while (rs.next()) {
            EdgeDraft edge = factory.newEdgeDraft();
            for (int i = 0; i < columnsCount; i++) {
                String columnName = metaData.getColumnLabel(i + 1);
                EdgeProperties p = properties.getEdgeProperty(columnName);
                if (p != null) {
                    injectEdgeProperty(p, rs, i + 1, edge);
                } else {
                    //Inject edge attributes
                    AttributeColumn col = edgeClass.getColumn(columnName);
View Full Code Here


        ResultSetMetaData metaData = rs.getMetaData();
        int columnsCount = metaData.getColumnCount();
        AttributeTable edgeClass = container.getAttributeModel().getEdgeTable();
        for (int i = 0; i < columnsCount; i++) {
            String columnName = metaData.getColumnLabel(i + 1);
            EdgeProperties p = database.getPropertiesAssociations().getEdgeProperty(columnName);
            if (p == null) {
                //No property associated to this column is found, so we append it as an attribute
                AttributeType type = AttributeType.STRING;
                switch (metaData.getColumnType(i + 1)) {
                    case Types.BIGINT:
View Full Code Here

                    break;
            }
        }

        if (!value.isEmpty()) {
            EdgeProperties prop = edgePropertiesAttributes.get(fore);
            if (prop != null) {
                try {
                    switch (prop) {
                        case WEIGHT:
                            edge.setWeight(parseFloat(value));
                            break;
                        case LABEL:
                            edge.setLabel(value);
                            break;
                        case ID:
                            edge.setId(value);
                            break;
                        case R:
                            if (edge.getColor() == null) {
                                edge.setColor(Integer.parseInt(value), 0, 0);
                            } else {
                                edge.setColor(Integer.parseInt(value), edge.getColor().getGreen(), edge.getColor().getBlue());
                            }
                            break;
                        case G:
                            if (edge.getColor() == null) {
                                edge.setColor(0, Integer.parseInt(value), 0);
                            } else {
                                edge.setColor(edge.getColor().getRed(), Integer.parseInt(value), edge.getColor().getBlue());
                            }
                            break;
                        case B:
                            if (edge.getColor() == null) {
                                edge.setColor(0, 0, Integer.parseInt(value));
                            } else {
                                edge.setColor(edge.getColor().getRed(), edge.getColor().getGreen(), Integer.parseInt(value));
                            }
                            break;
                    }
                } catch (Exception e) {
                    report.logIssue(new Issue(NbBundle.getMessage(ImporterGraphML.class, "importerGraphML_error_datavalue", fore, edge, prop.toString()), Issue.Level.SEVERE));
                }
                return;
            }

            //Data attribute value
View Full Code Here

                    nodePropertiesAttributes.put(id, prop);
                    report.log(NbBundle.getMessage(ImporterGraphML.class, "importerGraphML_log_nodeproperty", title));
                    property = true;
                }
            } else if (forStr.equalsIgnoreCase("edge")) {
                EdgeProperties prop = properties.getEdgeProperty(id) == null ? properties.getEdgeProperty(title) : properties.getEdgeProperty(id);
                if (prop != null) {
                    edgePropertiesAttributes.put(id, prop);
                    report.log(NbBundle.getMessage(ImporterGraphML.class, "importerGraphML_log_edgeproperty", title));
                    property = true;
                }
View Full Code Here

                    break;
            }
        }

        if (!value.isEmpty()) {
            EdgeProperties prop = edgePropertiesAttributes.get(fore);
            if (prop != null) {
                try {
                    switch (prop) {
                        case WEIGHT:
                            edge.setWeight(parseFloat(value));
                            break;
                        case LABEL:
                            edge.setLabel(value);
                            break;
                        case R:
                            if (edge.getColor() == null) {
                                edge.setColor(Integer.parseInt(value), 0, 0);
                            } else {
                                edge.setColor(Integer.parseInt(value), edge.getColor().getGreen(), edge.getColor().getBlue());
                            }
                            break;
                        case G:
                            if (edge.getColor() == null) {
                                edge.setColor(0, Integer.parseInt(value), 0);
                            } else {
                                edge.setColor(edge.getColor().getRed(), Integer.parseInt(value), edge.getColor().getBlue());
                            }
                            break;
                        case B:
                            if (edge.getColor() == null) {
                                edge.setColor(0, 0, Integer.parseInt(value));
                            } else {
                                edge.setColor(edge.getColor().getRed(), edge.getColor().getGreen(), Integer.parseInt(value));
                            }
                            break;
                    }
                } catch (Exception e) {
                    report.logIssue(new Issue(NbBundle.getMessage(ImporterGraphML.class, "importerGraphML_error_datavalue", fore, edge, prop.toString()), Issue.Level.SEVERE));
                }
                return;
            }

            //Data attribute value
View Full Code Here

                    nodePropertiesAttributes.put(id, prop);
                    report.log(NbBundle.getMessage(ImporterGraphML.class, "importerGraphML_log_nodeproperty", title));
                    property = true;
                }
            } else if (forStr.equalsIgnoreCase("edge")) {
                EdgeProperties prop = properties.getEdgeProperty(id) == null ? properties.getEdgeProperty(title) : properties.getEdgeProperty(id);
                if (prop != null) {
                    edgePropertiesAttributes.put(id, prop);
                    report.log(NbBundle.getMessage(ImporterGraphML.class, "importerGraphML_log_edgeproperty", title));
                    property = true;
                }
View Full Code Here

        int count = 0;
        while (rs.next()) {
            String id = null;
            for (int i = 0; i < columnsCount; i++) {
                String columnName = metaData.getColumnLabel(i + 1);
                EdgeProperties p = properties.getEdgeProperty(columnName);
                if (p.equals(EdgeProperties.ID)) {
                    String ide = rs.getString(i + 1);
                    if (ide != null) {
                        id = ide;
                    }
                }
            }
            EdgeDraft edge;
            if (id != null) {
                edge = factory.newEdgeDraft(id);
            } else {
                edge = factory.newEdgeDraft();
            }
            for (int i = 0; i < columnsCount; i++) {
                String columnName = metaData.getColumnLabel(i + 1);
                EdgeProperties p = properties.getEdgeProperty(columnName);
                if (p != null) {
                    injectEdgeProperty(p, rs, i + 1, edge);
                } else {
                    //Inject edge attributes
                    ColumnDraft col = container.getEdgeColumn(columnName);
View Full Code Here

    private void findEdgeAttributesColumns(ResultSet rs) throws SQLException {
        ResultSetMetaData metaData = rs.getMetaData();
        int columnsCount = metaData.getColumnCount();
        for (int i = 0; i < columnsCount; i++) {
            String columnName = metaData.getColumnLabel(i + 1);
            EdgeProperties p = database.getPropertiesAssociations().getEdgeProperty(columnName);
            if (p == null) {
                //No property associated to this column is found, so we append it as an attribute
                Class typeClass = findTypeClass(metaData, i);
                container.addEdgeColumn(columnName, typeClass);
            }
View Full Code Here

TOP

Related Classes of org.gephi.io.importer.api.PropertiesAssociations.EdgeProperties

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.