TimeRepresentation getTimeRepresentation() { if (graphStore != null) { return graphStore.configuration.getTimeRepresentation(); } return GraphStoreConfiguration.DEFAULT_TIME_REPRESENTATION; } }
private Configuration deserializeConfiguration(final DataInput is) throws IOException, ClassNotFoundException { Configuration config = new Configuration(); Class nodeIdType = (Class) deserialize(is); Class edgeIdType = (Class) deserialize(is); Class edgeLabelType = (Class) deserialize(is); Class edgeWeightType = (Class) deserialize(is); TimeRepresentation timeRepresentation = (TimeRepresentation) deserialize(is); config.setNodeIdType(nodeIdType); config.setEdgeIdType(edgeIdType); config.setEdgeLabelType(edgeLabelType); config.setEdgeWeightType(edgeWeightType); config.setTimeRepresentation(timeRepresentation); if (readVersion >= 0.5) { Boolean edgeColumn = (Boolean) deserialize(is); config.setEdgeWeightColumn(edgeColumn); } return config; }
@Override public Configuration getConfiguration() { return configuration.copy(); }
private void serializeConfiguration(final DataOutput out) throws IOException { Configuration config = model.store.configuration; serialize(out, config.getNodeIdType()); serialize(out, config.getEdgeIdType()); serialize(out, config.getEdgeLabelType()); serialize(out, config.getEdgeWeightType()); serialize(out, config.getTimeRepresentation()); serialize(out, config.getEdgeWeightColumn()); }
private GraphModel newGraphModel(Workspace workspace) { Configuration config = new Configuration(); config.setTimeRepresentation(TimeRepresentation.INTERVAL); GraphModel graphModelImpl = GraphModel.Factory.newInstance(config); workspace.add(graphModelImpl); return graphModelImpl; } }
private void checkValidConfiguration(Configuration config) { Class edgeWeightType = config.getEdgeWeightType(); if (edgeWeightType.equals(Double.class)) { return;// Double is always allowed } switch (config.getTimeRepresentation()) { case INTERVAL: if (!edgeWeightType.equals(IntervalDoubleMap.class)) { throw new IllegalArgumentException( "Edge weight type should be Double or IntervalDoubleMap for INTERVAL TimeRepresentation"); } break; case TIMESTAMP: if (!edgeWeightType.equals(TimestampDoubleMap.class)) { throw new IllegalArgumentException( "Edge weight type should be Double or TimestampDoubleMap for TIMESTAMP TimeRepresentation"); } break; } } }
if (!config.getNodeIdType().equals(configuration.getNodeIdType())) { TableImpl<Node> nodeTable = store.nodeTable; nodeTable.store.removeColumn(GraphStoreConfiguration.ELEMENT_ID_COLUMN_ID); nodeTable.store.addColumn(new ColumnImpl(nodeTable, GraphStoreConfiguration.ELEMENT_ID_COLUMN_ID, config.getNodeIdType(), "Id", null, Origin.PROPERTY, false, true)); configuration.setNodeIdType(config.getNodeIdType()); if (!config.getEdgeIdType().equals(configuration.getEdgeIdType())) { TableImpl<Edge> edgeTable = store.edgeTable; edgeTable.store.removeColumn(GraphStoreConfiguration.ELEMENT_ID_COLUMN_ID); edgeTable.store.addColumn(new ColumnImpl(edgeTable, GraphStoreConfiguration.ELEMENT_ID_COLUMN_ID, config.getEdgeIdType(), "Id", null, Origin.PROPERTY, false, true)); configuration.setEdgeIdType(config.getEdgeIdType()); if (!config.getEdgeLabelType().equals(configuration.getEdgeLabelType())) { configuration.setEdgeLabelType(config.getEdgeLabelType()); if (!config.getTimeRepresentation().equals(configuration.getTimeRepresentation())) { TableImpl<Node> nodeTable = store.nodeTable; nodeTable.removeColumn(GraphStoreConfiguration.ELEMENT_TIMESET_COLUMN_ID); if (config.getTimeRepresentation().equals(TimeRepresentation.TIMESTAMP)) { nodeTable.store.addColumn(new ColumnImpl(nodeTable, GraphStoreConfiguration.ELEMENT_TIMESET_COLUMN_ID, TimestampSet.class, "Timestamp", null, configuration.setTimeRepresentation(config.getTimeRepresentation()); store.timeStore.resetConfiguration(); if (!config.getEdgeWeightColumn().equals(configuration.getEdgeWeightColumn())) {
public GraphStore(GraphModelImpl model) { configuration = model != null ? model.configuration : new Configuration(); graphModel = model; lock = new GraphLock(); .getNodeIdType(), "Id", null, Origin.PROPERTY, false, true)); edgeTable.store.addColumn(new ColumnImpl(edgeTable, GraphStoreConfiguration.ELEMENT_ID_COLUMN_ID, configuration .getEdgeIdType(), "Id", null, Origin.PROPERTY, false, true)); if (GraphStoreConfiguration.ENABLE_ELEMENT_LABEL) { nodeTable.store.addColumn(new ColumnImpl(nodeTable, GraphStoreConfiguration.ELEMENT_LABEL_COLUMN_ID, if (configuration.getTimeRepresentation().equals(TimeRepresentation.TIMESTAMP)) { nodeTable.store.addColumn(new ColumnImpl(nodeTable, GraphStoreConfiguration.ELEMENT_TIMESET_COLUMN_ID, TimestampSet.class, "Timestamp", null, Origin.PROPERTY, false, false)); if (configuration.getEdgeWeightColumn()) { edgeTable.store.addColumn(new ColumnImpl(edgeTable, GraphStoreConfiguration.EDGE_WEIGHT_COLUMN_ID, configuration.getEdgeWeightType(), "Weight", null, Origin.PROPERTY, false, false)); } else { edgeTable.store.length++;
public GraphModelImpl() { this(new Configuration()); }
@Override public void actionPerformed(ActionEvent e) { Configuration c = graphModel.getConfiguration(); c.setTimeRepresentation(((TimeRepresentationWrapper) timeRepresentationComboBox.getSelectedItem()).getTimeRepresentation()); graphModel.setConfiguration(c); } });
public void resetConfiguration() { this.nodeAssignConfiguration = getAssignConfiguration(AttributeUtils.getStandardizedType(store.configuration .getNodeIdType())); this.edgeAssignConfiguration = getAssignConfiguration(AttributeUtils.getStandardizedType(store.configuration .getEdgeIdType())); }
final void checkIdType(Object id) { if (graphStore != null && !id.getClass().equals(graphStore.configuration.getEdgeIdType())) { throw new IllegalArgumentException( "The id class does not match with the expected type (" + graphStore.configuration.getEdgeIdType() .getName() + ")"); } }
public boolean deepEquals(GraphModelImpl obj) { if (obj == null) { return false; } if (this.store != obj.store && (this.store == null || !this.store.deepEquals(obj.store))) { return false; } if (this.configuration != obj.configuration && (this.configuration == null || !this.configuration .equals(obj.configuration))) { return false; } return true; }
if (!config.getNodeIdType().equals(configuration.getNodeIdType())) { TableImpl<Node> nodeTable = store.nodeTable; nodeTable.store.removeColumn(GraphStoreConfiguration.ELEMENT_ID_COLUMN_ID); nodeTable.store.addColumn(new ColumnImpl(nodeTable, GraphStoreConfiguration.ELEMENT_ID_COLUMN_ID, config.getNodeIdType(), "Id", null, Origin.PROPERTY, false, true)); configuration.setNodeIdType(config.getNodeIdType()); if (!config.getEdgeIdType().equals(configuration.getEdgeIdType())) { TableImpl<Edge> edgeTable = store.edgeTable; edgeTable.store.removeColumn(GraphStoreConfiguration.ELEMENT_ID_COLUMN_ID); edgeTable.store.addColumn(new ColumnImpl(edgeTable, GraphStoreConfiguration.ELEMENT_ID_COLUMN_ID, config.getEdgeIdType(), "Id", null, Origin.PROPERTY, false, true)); configuration.setEdgeIdType(config.getEdgeIdType()); if (!config.getEdgeLabelType().equals(configuration.getEdgeLabelType())) { configuration.setEdgeLabelType(config.getEdgeLabelType()); if (!config.getTimeRepresentation().equals(configuration.getTimeRepresentation())) { TableImpl<Node> nodeTable = store.nodeTable; nodeTable.removeColumn(GraphStoreConfiguration.ELEMENT_TIMESET_COLUMN_ID); if (config.getTimeRepresentation().equals(TimeRepresentation.TIMESTAMP)) { nodeTable.store.addColumn(new ColumnImpl(nodeTable, GraphStoreConfiguration.ELEMENT_TIMESET_COLUMN_ID, TimestampSet.class, "Timestamp", null, configuration.setTimeRepresentation(config.getTimeRepresentation()); store.timeStore.resetConfiguration(); if (!config.getEdgeWeightColumn().equals(configuration.getEdgeWeightColumn())) {
public GraphStore(GraphModelImpl model) { configuration = model != null ? model.configuration : new Configuration(); graphModel = model; lock = new GraphLock(); .getNodeIdType(), "Id", null, Origin.PROPERTY, false, true)); edgeTable.store.addColumn(new ColumnImpl(edgeTable, GraphStoreConfiguration.ELEMENT_ID_COLUMN_ID, configuration .getEdgeIdType(), "Id", null, Origin.PROPERTY, false, true)); if (GraphStoreConfiguration.ENABLE_ELEMENT_LABEL) { nodeTable.store.addColumn(new ColumnImpl(nodeTable, GraphStoreConfiguration.ELEMENT_LABEL_COLUMN_ID, if (configuration.getTimeRepresentation().equals(TimeRepresentation.TIMESTAMP)) { nodeTable.store.addColumn(new ColumnImpl(nodeTable, GraphStoreConfiguration.ELEMENT_TIMESET_COLUMN_ID, TimestampSet.class, "Timestamp", null, Origin.PROPERTY, false, false)); if (configuration.getEdgeWeightColumn()) { edgeTable.store.addColumn(new ColumnImpl(edgeTable, GraphStoreConfiguration.EDGE_WEIGHT_COLUMN_ID, configuration.getEdgeWeightType(), "Weight", null, Origin.PROPERTY, false, false)); } else { edgeTable.store.length++;
private void serializeConfiguration(final DataOutput out) throws IOException { Configuration config = model.store.configuration; serialize(out, config.getNodeIdType()); serialize(out, config.getEdgeIdType()); serialize(out, config.getEdgeLabelType()); serialize(out, config.getEdgeWeightType()); serialize(out, config.getTimeRepresentation()); serialize(out, config.getEdgeWeightColumn()); }
private void checkValidConfiguration(Configuration config) { Class edgeWeightType = config.getEdgeWeightType(); if (edgeWeightType.equals(Double.class)) { return;// Double is always allowed } switch (config.getTimeRepresentation()) { case INTERVAL: if (!edgeWeightType.equals(IntervalDoubleMap.class)) { throw new IllegalArgumentException( "Edge weight type should be Double or IntervalDoubleMap for INTERVAL TimeRepresentation"); } break; case TIMESTAMP: if (!edgeWeightType.equals(TimestampDoubleMap.class)) { throw new IllegalArgumentException( "Edge weight type should be Double or TimestampDoubleMap for TIMESTAMP TimeRepresentation"); } break; } } }
protected static GraphModel getGraphModel(Workspace workspace) { GraphModel gm = workspace.getLookup().lookup(GraphModel.class); if (gm == null) { Configuration configuration = new Configuration(); configuration.setTimeRepresentation(TimeRepresentation.INTERVAL); gm = GraphModel.Factory.newInstance(configuration); workspace.add(gm); } return gm; } }
public EdgeTypeStore() { this(new Configuration()); }
public GraphFactoryImpl(GraphStore store) { this.store = store; this.nodeAssignConfiguration = getAssignConfiguration(AttributeUtils.getStandardizedType(store.configuration .getNodeIdType())); this.edgeAssignConfiguration = getAssignConfiguration(AttributeUtils.getStandardizedType(store.configuration .getEdgeIdType())); }