Package org.gephi.io.importer.api

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


        //Factory
        ContainerLoader.DraftFactory factory = container.factory();

        //Properties
        PropertiesAssociations properties = database.getPropertiesAssociations();

        Statement s = connection.createStatement();
        try {
            s.executeQuery(database.getNodeQuery());
        } catch (SQLException ex) {
            report.logIssue(new Issue("Failed to execute Node query", Issue.Level.SEVERE, ex));
            return;
        }

        ResultSet rs = s.getResultSet();
        findNodeAttributesColumns(rs);
        AttributeTable nodeClass = container.getAttributeModel().getNodeTable();
        ResultSetMetaData metaData = rs.getMetaData();
        int columnsCount = metaData.getColumnCount();
        int count = 0;
        while (rs.next()) {
            NodeDraft node = factory.newNodeDraft();
            for (int i = 0; i < columnsCount; i++) {
                String columnName = metaData.getColumnLabel(i + 1);
                NodeProperties p = properties.getNodeProperty(columnName);
                if (p != null) {
                    injectNodeProperty(p, rs, i + 1, node);
                } else {
                    //Inject node attributes
                    AttributeColumn col = nodeClass.getColumn(columnName);
View Full Code Here


        //Factory
        ContainerLoader.DraftFactory factory = container.factory();

        //Properties
        PropertiesAssociations properties = database.getPropertiesAssociations();

        Statement s = connection.createStatement();
        try {
            s.executeQuery(database.getEdgeQuery());
        } catch (SQLException ex) {
            report.logIssue(new Issue("Failed to execute Edge query", Issue.Level.SEVERE, ex));
            return;
        }
        ResultSet rs = s.getResultSet();
        findEdgeAttributesColumns(rs);
        AttributeTable edgeClass = container.getAttributeModel().getEdgeTable();
        ResultSetMetaData metaData = rs.getMetaData();
        int columnsCount = metaData.getColumnCount();
        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

        //Factory
        ElementDraftFactory factory = container.factory();

        //Properties
        PropertiesAssociations properties = database.getPropertiesAssociations();

        Statement s = connection.createStatement();
        ResultSet rs = null;
        try {
            rs = s.executeQuery(database.getNodeQuery());
        } catch (SQLException ex) {
            report.logIssue(new Issue("Failed to execute Node query", Issue.Level.SEVERE, ex));
            return;
        }

        findNodeAttributesColumns(rs);
        ResultSetMetaData metaData = rs.getMetaData();
        int columnsCount = metaData.getColumnCount();
        int count = 0;
        while (rs.next()) {
            String id = null;
            for (int i = 0; i < columnsCount; i++) {
                String columnName = metaData.getColumnLabel(i + 1);
                NodeProperties p = properties.getNodeProperty(columnName);
                if (p.equals(NodeProperties.ID)) {
                    String ide = rs.getString(i + 1);
                    if (ide != null) {
                        id = ide;
                    }
                }
            }
            NodeDraft node;
            if (id != null) {
                node = factory.newNodeDraft(id);
            } else {
                node = factory.newNodeDraft();
            }

            for (int i = 0; i < columnsCount; i++) {
                String columnName = metaData.getColumnLabel(i + 1);
                NodeProperties p = properties.getNodeProperty(columnName);
                if (p != null) {
                    injectNodeProperty(p, rs, i + 1, node);
                } else {
                    //Inject node attributes
                    ColumnDraft col = container.getNodeColumn(columnName);
View Full Code Here

        //Factory
        ElementDraftFactory factory = container.factory();

        //Properties
        PropertiesAssociations properties = database.getPropertiesAssociations();

        Statement s = connection.createStatement();
        ResultSet rs = null;
        try {
            rs = s.executeQuery(database.getEdgeQuery());
        } catch (SQLException ex) {
            report.logIssue(new Issue("Failed to execute Edge query", Issue.Level.SEVERE, ex));
            return;
        }
        findEdgeAttributesColumns(rs);
        ResultSetMetaData metaData = rs.getMetaData();
        int columnsCount = metaData.getColumnCount();
        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

TOP

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

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.