Author: clopes
Date: 2012-08-01 14:44:42 -0700 (Wed, 01 Aug 2012)
New Revision: 30067
Added:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/SUIDUpdater.java
core3/impl/trunk/io-impl/impl/src/test/java/org/cytoscape/io/internal/read/SUIDUpdaterTest.java
core3/impl/trunk/io-impl/impl/src/test/resources/testData/xgmml/listAtt.xgmml
core3/impl/trunk/io-impl/impl/src/test/resources/testData/xgmml/suid_metadata.xgmml
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/CyActivator.java
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/session/Cy2SessionReaderImpl.java
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/session/Cy3SessionReaderFactoryImpl.java
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/session/Cy3SessionReaderImpl.java
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/ObjectTypeMap.java
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/AttributeValueUtil.java
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/HandleGraphDone.java
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/HandleListAttribute.java
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/HandleListAttributeDone.java
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/ReadDataManager.java
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/ReadCache.java
core3/impl/trunk/io-impl/impl/src/test/java/org/cytoscape/io/internal/read/xgmml/GenericXGMMLReaderTest.java
core3/impl/trunk/model-impl/impl/src/main/java/org/cytoscape/model/internal/CyTableImpl.java
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/Cy3SimpleSessionLodingTest.java
Log:
Fixes #1318 (Create a general solution for all new/old SUID internal
consistency issues):
Just add the prefix ".SUID" to any Long-type column, so its values are updated
with the new SUIDs when the session is loaded again (or the XGMML file is
imported).
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/CyActivator.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/CyActivator.java
2012-08-01 19:26:25 UTC (rev 30066)
+++
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/CyActivator.java
2012-08-01 21:44:42 UTC (rev 30067)
@@ -13,6 +13,7 @@
import org.cytoscape.io.internal.read.CyPropertyReaderManagerImpl;
import org.cytoscape.io.internal.read.CySessionReaderManagerImpl;
import org.cytoscape.io.internal.read.CyTableReaderManagerImpl;
+import org.cytoscape.io.internal.read.SUIDUpdater;
import org.cytoscape.io.internal.read.VizmapReaderManagerImpl;
import org.cytoscape.io.internal.read.bookmarks.BookmarkFileFilter;
import org.cytoscape.io.internal.read.bookmarks.BookmarkReaderFactory;
@@ -187,8 +188,10 @@
NNFNetworkReaderFactory nnfNetworkViewReaderFactory = new
NNFNetworkReaderFactory(nnfFilter,cyLayoutsServiceRef,cyNetworkViewFactoryServiceRef,cyNetworkFactoryServiceRef,cyEventHelperRef,
cyNetworkManagerServiceRef);
UnrecognizedVisualPropertyManager
unrecognizedVisualPropertyManager = new
UnrecognizedVisualPropertyManager(cyTableFactoryServiceRef,cyTableManagerServiceRef);
GMLNetworkReaderFactory gmlNetworkViewReaderFactory = new
GMLNetworkReaderFactory(gmlFilter,cyNetworkViewFactoryServiceRef,cyNetworkFactoryServiceRef,renderingEngineManagerServiceRef,unrecognizedVisualPropertyManager);
+
ReadCache readCache = new ReadCache();
- ReadDataManager readDataManager = new
ReadDataManager(readCache,equationCompilerServiceRef,cyNetworkFactoryServiceRef,cyRootNetworkManagerServiceRef);
+ SUIDUpdater suidUpdater = new SUIDUpdater();
+ ReadDataManager readDataManager = new
ReadDataManager(readCache,suidUpdater,equationCompilerServiceRef,cyNetworkFactoryServiceRef,cyRootNetworkManagerServiceRef);
HandlerFactory handlerFactory = new
HandlerFactory(readDataManager);
XGMMLParser xgmmlParser = new
XGMMLParser(handlerFactory,readDataManager);
@@ -196,7 +199,7 @@
SessionXGMMLNetworkReaderFactory sessXgmmlNetReaderFactory =
new
SessionXGMMLNetworkReaderFactory(sessXgmmlNetFileFilter,cyNetworkViewFactoryServiceRef,cyNetworkFactoryServiceRef,cyRootNetworkManagerServiceRef,renderingEngineManagerServiceRef,readDataManager,xgmmlParser,unrecognizedVisualPropertyManager);
SessionXGMMLNetworkViewReaderFactory sessXgmmlViewReaderFactory
= new
SessionXGMMLNetworkViewReaderFactory(sessXgmmlViewFileFilter,cyNetworkViewFactoryServiceRef,cyNetworkFactoryServiceRef,renderingEngineManagerServiceRef,readDataManager,xgmmlParser,unrecognizedVisualPropertyManager);
CSVCyReaderFactory sessionTableReaderFactory = new
CSVCyReaderFactory(sessionTableFilter,true,true,cyTableFactoryServiceRef,compilerServiceRef);
- Cy3SessionReaderFactoryImpl cy3SessionReaderFactory = new
Cy3SessionReaderFactoryImpl(cys3Filter,readCache,cyNetworkReaderManager,cyPropertyReaderManager,vizmapReaderManager,sessionTableReaderFactory,cyNetworkTableManagerServiceRef,cyRootNetworkManagerServiceRef);
+ Cy3SessionReaderFactoryImpl cy3SessionReaderFactory = new
Cy3SessionReaderFactoryImpl(cys3Filter,readCache,suidUpdater,cyNetworkReaderManager,cyPropertyReaderManager,vizmapReaderManager,sessionTableReaderFactory,cyNetworkTableManagerServiceRef,cyRootNetworkManagerServiceRef);
Cy2SessionReaderFactoryImpl cy2SessionReaderFactory = new
Cy2SessionReaderFactoryImpl(cys2Filter,readCache,cyNetworkReaderManager,cyPropertyReaderManager,vizmapReaderManager,cyRootNetworkManagerServiceRef);
CysessionReaderFactory cysessionReaderFactory = new
CysessionReaderFactory(cysessionFilter);
BookmarkReaderFactory bookmarkReaderFactory = new
BookmarkReaderFactory(bookmarksFilter);
Added:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/SUIDUpdater.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/SUIDUpdater.java
(rev 0)
+++
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/SUIDUpdater.java
2012-08-01 21:44:42 UTC (rev 30067)
@@ -0,0 +1,111 @@
+package org.cytoscape.io.internal.read;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.WeakHashMap;
+
+import org.cytoscape.model.CyColumn;
+import org.cytoscape.model.CyRow;
+import org.cytoscape.model.CyTable;
+
+
+/**
+ * This class stores an old-to-new SUID map and is responsible for updating
the values in SUID-typed CyColumns.
+ */
+public class SUIDUpdater {
+
+ private static final String SUID_COLUMN_SUFFIX = ".SUID";
+
+ private Map<Long/*old SUID*/, Long/*new SUID*/> suidMap;
+ private Map<CyTable, Set<String>/*column names*/> suidColumnMap;
+
+ public SUIDUpdater() {
+ init();
+ }
+
+ public void init() {
+ suidMap = new HashMap<Long, Long>();
+ suidColumnMap = new WeakHashMap<CyTable, Set<String>>();
+ }
+
+ public void addSUIDMapping(final Long oldSUID, final Long newSUID) {
+ if (oldSUID != null && newSUID != null)
+ suidMap.put(oldSUID, newSUID);
+ }
+
+ public Long getNewSUID(final Long oldSUID) {
+ return suidMap.get(oldSUID);
+ }
+
+ public void addSUIDColumn(final CyTable table, final String name) {
+ Set<String> columnNames = suidColumnMap.get(table);
+
+ if (columnNames == null) {
+ columnNames = new HashSet<String>();
+ suidColumnMap.put(table, columnNames);
+ }
+
+ columnNames.add(name);
+ }
+
+ public void updateSUIDColumns() {
+ for (final Map.Entry<CyTable, Set<String>> entry :
suidColumnMap.entrySet()) {
+ final CyTable tbl = entry.getKey();
+ final Set<String> columnNames = entry.getValue();
+
+ for (final String name : columnNames)
+ updateRows(tbl, name);
+ }
+ }
+
+ public void dispose() {
+ init();
+ }
+
+ public static boolean isUpdatableSUIDColumn(final String columnName) {
+ return columnName != null && columnName.endsWith(SUID_COLUMN_SUFFIX);
+ }
+
+ @Override
+ public String toString() {
+ return "SUIDUpdater{ suidMap=" + suidMap + ", suidColumnMap=" +
suidColumnMap + " }";
+ }
+
+ private void updateRows(final CyTable tbl, final String columnName) {
+ final CyColumn column = tbl.getColumn(columnName);
+ final Class<?> type = column.getType();
+ final Class<?> listType = column.getListElementType();
+
+ if (type != Long.class && listType != Long.class)
+ return;
+
+ for (final CyRow row : tbl.getAllRows()) {
+ if (type == Long.class) {
+ final Long oldSUID = row.get(columnName,
Long.class);
+ final Long newSUID = getNewSUID(oldSUID);
+
+ if (newSUID != null)
+ row.set(columnName, newSUID);
+ } else if (type == List.class) {
+ final List<Long> oldList =
row.getList(columnName, Long.class);
+
+ if (oldList != null && !oldList.isEmpty()) {
+ final List<Long> newList = new
ArrayList<Long>(oldList.size());
+
+ for (final Long oldSUID : oldList) {
+ final Long newSUID =
getNewSUID(oldSUID);
+
+ if (newSUID != null)
+ newList.add(newSUID);
+ }
+
+ row.set(columnName, newList);
+ }
+ }
+ }
+ }
+}
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/session/Cy2SessionReaderImpl.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/session/Cy2SessionReaderImpl.java
2012-08-01 19:26:25 UTC (rev 30066)
+++
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/session/Cy2SessionReaderImpl.java
2012-08-01 21:44:42 UTC (rev 30067)
@@ -107,7 +107,7 @@
// In 3, CG Manager is treated as a regular app. This is a unique name
for it.
private static final String DING_CG_MANAGER_NAME =
"org.cytoscape.ding.customgraphicsmgr";
- public static final String CY2_PARENT_NETWORK_COLUMN = "Cytoscape2
Parent Network";
+ public static final String CY2_PARENT_NETWORK_COLUMN = "Cy2 Parent
Network.SUID";
public static final String CY_PROPS_FILE = "session_cytoscape.props";
public static final Pattern NETWORK_PATTERN =
Pattern.compile(".*/(([^/]+)[.]xgmml)");
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/session/Cy3SessionReaderFactoryImpl.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/session/Cy3SessionReaderFactoryImpl.java
2012-08-01 19:26:25 UTC (rev 30066)
+++
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/session/Cy3SessionReaderFactoryImpl.java
2012-08-01 21:44:42 UTC (rev 30067)
@@ -30,6 +30,7 @@
import java.io.InputStream;
import org.cytoscape.io.CyFileFilter;
+import org.cytoscape.io.internal.read.SUIDUpdater;
import org.cytoscape.io.internal.read.datatable.CSVCyReaderFactory;
import org.cytoscape.io.internal.util.ReadCache;
import org.cytoscape.io.read.CyNetworkReaderManager;
@@ -43,6 +44,7 @@
public class Cy3SessionReaderFactoryImpl extends
AbstractInputStreamTaskFactory {
private final ReadCache cache;
+ private final SUIDUpdater suidUpdater;
private final CyNetworkReaderManager networkReaderMgr;
private final CyPropertyReaderManager propertyReaderMgr;
private final VizmapReaderManager vizmapReaderMgr;
@@ -52,6 +54,7 @@
public Cy3SessionReaderFactoryImpl(final CyFileFilter filter,
final ReadCache cache,
+
final SUIDUpdater suidUpdater,
final CyNetworkReaderManager networkReaderMgr,
final CyPropertyReaderManager propertyReaderMgr,
final VizmapReaderManager vizmapReaderMgr,
@@ -60,6 +63,7 @@
final CyRootNetworkManager rootNetworkMgr) {
super(filter);
this.cache = cache;
+ this.suidUpdater = suidUpdater;
this.networkReaderMgr = networkReaderMgr;
this.propertyReaderMgr = propertyReaderMgr;
this.vizmapReaderMgr = vizmapReaderMgr;
@@ -70,7 +74,7 @@
@Override
public TaskIterator createTaskIterator(InputStream inputStream, String
inputName) {
- return new TaskIterator(new Cy3SessionReaderImpl(inputStream,
cache, networkReaderMgr, propertyReaderMgr,
- vizmapReaderMgr, csvCyReaderFactory,
networkTableMgr, rootNetworkMgr));
+ return new TaskIterator(new Cy3SessionReaderImpl(inputStream,
cache, suidUpdater, networkReaderMgr,
+ propertyReaderMgr, vizmapReaderMgr,
csvCyReaderFactory, networkTableMgr, rootNetworkMgr));
}
}
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/session/Cy3SessionReaderImpl.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/session/Cy3SessionReaderImpl.java
2012-08-01 19:26:25 UTC (rev 30066)
+++
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/session/Cy3SessionReaderImpl.java
2012-08-01 21:44:42 UTC (rev 30067)
@@ -57,6 +57,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.cytoscape.io.internal.read.SUIDUpdater;
import org.cytoscape.io.internal.read.datatable.CSVCyReaderFactory;
import org.cytoscape.io.internal.read.datatable.CyTablesXMLReader;
import
org.cytoscape.io.internal.read.session.CyTableMetadataImpl.CyTableMetadataBuilder;
@@ -109,6 +110,7 @@
private final Map<Long/*network_suid*/, CyNetwork> networkLookup = new
LinkedHashMap<Long, CyNetwork>();
private final Map<Long/*old_network_id*/, Set<CyTableMetadataBuilder>>
networkTableMap = new HashMap<Long, Set<CyTableMetadataBuilder>>();
+ private final SUIDUpdater suidUpdater;
private final CyNetworkReaderManager networkReaderMgr;
private final CyPropertyReaderManager propertyReaderMgr;
private final VizmapReaderManager vizmapReaderMgr;
@@ -125,6 +127,7 @@
public Cy3SessionReaderImpl(final InputStream sourceInputStream,
final ReadCache
cache,
+ final SUIDUpdater
suidUpdater,
final
CyNetworkReaderManager networkReaderMgr,
final
CyPropertyReaderManager propertyReaderMgr,
final
VizmapReaderManager vizmapReaderMgr,
@@ -133,6 +136,9 @@
final
CyRootNetworkManager rootNetworkMgr) {
super(sourceInputStream, cache);
+ if (suidUpdater == null) throw new NullPointerException("SUID
updater is null.");
+ this.suidUpdater = suidUpdater;
+
if (networkReaderMgr == null) throw new
NullPointerException("network reader manager is null.");
this.networkReaderMgr = networkReaderMgr;
@@ -156,6 +162,12 @@
}
@Override
+ protected void init(TaskMonitor tm) throws Exception {
+ super.init(tm);
+ suidUpdater.init();
+ }
+
+ @Override
protected void handleEntry(InputStream is, String entryName) throws
Exception {
if (!networksExtracted) {
// First pass..
@@ -211,6 +223,11 @@
networksExtracted = true;
readSessionFile(tm);
+ tm.setProgress(0.8);
+ tm.setTitle("Update SUID columns");
+ tm.setStatusMessage("Updating SUID columns...");
+ updateSUIDColumns();
+
super.complete(tm);
}
@@ -281,6 +298,9 @@
String filename = matcher.group(1);
filenameTableMap.put(filename, table);
builderFilenameMap.put(builder, filename);
+
+ // Look for SUID-type columns--only global tables now
+ findSUIDColumns(table);
}
}
@@ -479,9 +499,13 @@
// Just use the source table
networkTableMgr.setTable(network, type, namespace, src);
builder.setCyTable(src);
+
+ findSUIDColumns(src);
} else {
mergeTables(src, tgt, type);
builder.setCyTable(tgt);
+
+ findSUIDColumns(tgt);
}
}
@@ -537,6 +561,17 @@
}
}
+ private void findSUIDColumns(final CyTable table) {
+ for (final CyColumn column : table.getColumns()) {
+ if (SUIDUpdater.isUpdatableSUIDColumn(column.getName()))
+ suidUpdater.addSUIDColumn(table,
column.getName());
+ }
+ }
+
+ private void updateSUIDColumns() {
+ suidUpdater.updateSUIDColumns();
+ }
+
/**
* @param networkToken
* @return
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/ObjectTypeMap.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/ObjectTypeMap.java
2012-08-01 19:26:25 UTC (rev 30066)
+++
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/ObjectTypeMap.java
2012-08-01 21:44:42 UTC (rev 30067)
@@ -4,6 +4,8 @@
import java.util.HashMap;
import java.util.Map;
+import org.cytoscape.io.internal.read.SUIDUpdater;
+
public class ObjectTypeMap {
private Map<String, ObjectType> typeMap;
@@ -29,33 +31,41 @@
*
* @param type the ObjectType of the value
* @param value the value to type
+ * @param name the attribute name
* @return the typed value
*/
- public Object getTypedValue(ObjectType type, String value) {
-
+ public Object getTypedValue(final ObjectType type, final String value,
final String name) {
+ Object typedValue = null;
+
switch (type) {
case BOOLEAN:
- if (value != null) return fromXGMMLBoolean(""+value);
+ if (value != null)
+ typedValue = fromXGMMLBoolean(""+value);
break;
case REAL:
- if (value != null) return new Double(value);
+ if (value != null) {
+ if (SUIDUpdater.isUpdatableSUIDColumn(name))
+ typedValue = new Long(value);
+ else
+ typedValue = new Double(value);
+ }
break;
case INTEGER:
- if (value != null) return new Integer(value);
+ if (value != null)
+ typedValue = new Integer(value);
break;
case STRING:
if (value != null) {
// Make sure we convert our newlines and tabs back
String sAttr = value.replace("\\t", "\t");
- sAttr = sAttr.replace("\\n", "\n");
- return sAttr;
+ typedValue = sAttr.replace("\\n", "\n");
}
break;
case LIST:
- return new ArrayList<Object>();
+ typedValue = new ArrayList<Object>();
}
-
- return null;
+
+ return typedValue;
}
public static boolean fromXGMMLBoolean(String s) {
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/AttributeValueUtil.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/AttributeValueUtil.java
2012-08-01 19:26:25 UTC (rev 30066)
+++
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/AttributeValueUtil.java
2012-08-01 21:44:42 UTC (rev 30067)
@@ -32,6 +32,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.cytoscape.io.internal.read.SUIDUpdater;
import org.cytoscape.io.internal.read.xgmml.MetadataEntries;
import org.cytoscape.io.internal.read.xgmml.MetadataParser;
import org.cytoscape.io.internal.read.xgmml.ObjectType;
@@ -67,7 +68,7 @@
protected static final Logger logger =
LoggerFactory.getLogger(AttributeValueUtil.class);
- public AttributeValueUtil(ReadDataManager manager) {
+ public AttributeValueUtil(final ReadDataManager manager) {
this.manager = manager;
this.typeMap = new ObjectTypeMap();
}
@@ -115,22 +116,20 @@
}
/**
- * Return the typed attribute value for the passed attribute. In this case,
- * the caller has already determined that this is the correct attribute and
- * we just lookup the value. This routine is responsible for type
conversion
- * consistent with the passed argument.
- *
- * @param type
- * the ObjectType of the value
- * @param atts
- * the attributes
- * @return the value of the attribute in the appropriate type
- */
- protected Object getTypedAttributeValue(ObjectType type, Attributes atts)
throws SAXParseException {
+ * Return the typed attribute value for the passed attribute. In this
case, the caller has already determined that
+ * this is the correct attribute and we just lookup the value. This
routine is responsible for type conversion
+ * consistent with the passed argument.
+ *
+ * @param type the ObjectType of the value
+ * @param atts the attributes
+ * @param name the attribute name
+ * @return the value of the attribute in the appropriate type
+ */
+ protected Object getTypedAttributeValue(ObjectType type, Attributes atts,
String name) throws SAXParseException {
String value = atts.getValue("value");
try {
- return typeMap.getTypedValue(type, value);
+ return typeMap.getTypedValue(type, value, name);
} catch (Exception e) {
throw new SAXParseException("Unable to convert '" + value + "' to
type " + type.toString(), locator);
}
@@ -243,15 +242,20 @@
}
} else {
// Regular attribute value...
- value = getTypedAttributeValue(objType, atts);
+ value = getTypedAttributeValue(objType, atts, name);
}
- switch (objType) {
+ switch (objType) {
case BOOLEAN:
if (name != null) setAttribute(row, name,
Boolean.class, (Boolean) value);
break;
case REAL:
- if (name != null) setAttribute(row, name,
Double.class, (Double) value);
+ if (name != null) {
+ if
(SUIDUpdater.isUpdatableSUIDColumn(name))
+ setAttribute(row, name,
Long.class, (Long) value);
+ else
+ setAttribute(row, name,
Double.class, (Double) value);
+ }
break;
case INTEGER:
if (name != null) setAttribute(row, name,
Integer.class, (Integer) value);
@@ -268,8 +272,13 @@
case LIST:
manager.currentAttributeID = name;
manager.setCurrentRow(row);
+
if (column != null &&
List.class.isAssignableFrom(column.getType()))
row.set(name, null);
+
+ if (SUIDUpdater.isUpdatableSUIDColumn(name))
+ manager.getSUIDUpdater().addSUIDColumn(row.getTable(),
name);
+
return ParseState.LIST_ATT;
}
@@ -290,6 +299,9 @@
if (value != null) {
row.set(name, value);
+
+ if (SUIDUpdater.isUpdatableSUIDColumn(name))
+ manager.getSUIDUpdater().addSUIDColumn(row.getTable(),
name);
}
}
}
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/HandleGraphDone.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/HandleGraphDone.java
2012-08-01 19:26:25 UTC (rev 30066)
+++
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/HandleGraphDone.java
2012-08-01 21:44:42 UTC (rev 30067)
@@ -106,6 +106,7 @@
resolveEquations();
resolveNetworkPointers();
+ updateSUIDAttributes();
return ParseState.NONE;
}
@@ -140,4 +141,10 @@
manager.getCache().createNetworkPointers();
}
}
+
+ private void updateSUIDAttributes() {
+ if (!manager.isSessionFormat()) {
+ manager.getSUIDUpdater().updateSUIDColumns();
+ }
+ }
}
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/HandleListAttribute.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/HandleListAttribute.java
2012-08-01 19:26:25 UTC (rev 30066)
+++
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/HandleListAttribute.java
2012-08-01 21:44:42 UTC (rev 30067)
@@ -30,6 +30,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.cytoscape.io.internal.read.SUIDUpdater;
import org.cytoscape.io.internal.read.xgmml.ObjectType;
import org.cytoscape.io.internal.read.xgmml.ParseState;
import org.cytoscape.model.CyColumn;
@@ -41,9 +42,10 @@
@Override
public ParseState handle(String tag, Attributes atts, ParseState current)
throws SAXException {
- String type = atts.getValue("type");
- ObjectType objType = typeMap.getType(type);
- Object obj = attributeValueUtil.getTypedAttributeValue(objType, atts);
+ final String type = atts.getValue("type");
+ final String name = manager.currentAttributeID;
+ final ObjectType objType = typeMap.getType(type);
+ final Object value =
attributeValueUtil.getTypedAttributeValue(objType, atts, name);
Class<?> clazz = null;
switch (objType) {
@@ -51,7 +53,7 @@
clazz = Boolean.class;
break;
case REAL:
- clazz = Double.class;
+ clazz = SUIDUpdater.isUpdatableSUIDColumn(name) ? Long.class :
Double.class;
break;
case INTEGER:
clazz = Integer.class;
@@ -62,12 +64,11 @@
break;
}
- String name = manager.currentAttributeID;
- CyRow row = manager.getCurrentRow();
+ final CyRow row = manager.getCurrentRow();
CyColumn column = row.getTable().getColumn(name);
if (column == null) {
- row.getTable().createListColumn(name, clazz, false);
+ row.getTable().createListColumn(name, clazz, false, new
ArrayList());
column = row.getTable().getColumn(name);
}
@@ -77,8 +78,8 @@
row.set(name, manager.listAttrHolder);
}
- if (manager.listAttrHolder != null)
- manager.listAttrHolder.add(obj);
+ if (manager.listAttrHolder != null && value != null)
+ manager.listAttrHolder.add(value);
}
return current;
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/HandleListAttributeDone.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/HandleListAttributeDone.java
2012-08-01 19:26:25 UTC (rev 30066)
+++
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/HandleListAttributeDone.java
2012-08-01 21:44:42 UTC (rev 30067)
@@ -42,7 +42,7 @@
}
} catch (Exception e) {
String err = "XGMML attribute handling error for attribute '" +
manager.currentAttributeID +
- "' and object '" + manager.getCurrentNetwork() + "':
" + e.getMessage();
+ "' and network '" + manager.getCurrentNetwork() + "':
" + e.getMessage();
throw new SAXException(err);
}
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/ReadDataManager.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/ReadDataManager.java
2012-08-01 19:26:25 UTC (rev 30066)
+++
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/ReadDataManager.java
2012-08-01 21:44:42 UTC (rev 30067)
@@ -41,6 +41,7 @@
import org.cytoscape.equations.Equation;
import org.cytoscape.equations.EquationCompiler;
+import org.cytoscape.io.internal.read.SUIDUpdater;
import org.cytoscape.io.internal.read.xgmml.ParseState;
import org.cytoscape.io.internal.util.ReadCache;
import org.cytoscape.io.internal.util.session.SessionUtil;
@@ -123,6 +124,7 @@
private Map<Object/*old model id*/, Map<String/*att name*/, String/*att
value*/>> viewLockedGraphics;
private final ReadCache cache;
+ private final SUIDUpdater suidUpdater;
private final EquationCompiler equationCompiler;
private final CyNetworkFactory networkFactory;
private final CyRootNetworkManager rootNetworkManager;
@@ -130,19 +132,23 @@
private static final Logger logger =
LoggerFactory.getLogger(ReadDataManager.class);
public ReadDataManager(final ReadCache cache,
+ final SUIDUpdater
suidUpdater,
final EquationCompiler
equationCompiler,
final CyNetworkFactory
networkFactory,
final CyRootNetworkManager
rootNetworkManager) {
+ this.cache = cache;
+ this.suidUpdater = suidUpdater;
this.equationCompiler = equationCompiler;
- this.cache = cache;
this.networkFactory = networkFactory;
this.rootNetworkManager = rootNetworkManager;
init();
}
public void init() {
- if (!SessionUtil.isReadingSessionFile())
+ if (!SessionUtil.isReadingSessionFile()) {
cache.init();
+ suidUpdater.init();
+ }
viewFormat = false;
graphCount = 0;
@@ -207,8 +213,10 @@
// Important: graphics related maps and lists cannot be
disposed here,
// because they may be necessary when creating the network
views.
- if (!SessionUtil.isReadingSessionFile())
+ if (!SessionUtil.isReadingSessionFile()) {
cache.dispose();
+ suidUpdater.dispose();
+ }
}
public double getDocumentVersion() {
@@ -239,6 +247,10 @@
return cache;
}
+ public SUIDUpdater getSUIDUpdater() {
+ return suidUpdater;
+ }
+
/**
* @param element A CyNode or CyEdge
* @param attName The name of the attribute
@@ -431,6 +443,8 @@
cache.cache(oldId, node);
cache.cacheNodeByName(label, node);
+ mapSUIDs(oldId, node.getSUID());
+
return node;
}
@@ -504,6 +518,8 @@
if (extEdgeIds != null)
extEdgeIds.add(id.toString());
+
+ mapSUIDs(id, edge.getSUID());
}
// Add to internal cache:
@@ -518,6 +534,7 @@
publicNetworks.add(net);
cache.cache(oldId, net);
+ mapSUIDs(oldId, net.getSUID());
}
}
@@ -621,6 +638,14 @@
setCurrentEdge((CyEdge) entry);
}
+ /**
+ * Adds old->new SUID references to the SUID Updater
+ */
+ private void mapSUIDs(final Object oldId, final Long newSUID) {
+ if (oldId instanceof Long) // if String (probably Cy2), it has to be
handled differently
+ suidUpdater.addSUIDMapping((Long)oldId, newSUID);
+ }
+
/**
* It controls which graphics attributes should be parsed.
* @param element The network, node or edge
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/ReadCache.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/ReadCache.java
2012-08-01 19:26:25 UTC (rev 30066)
+++
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/ReadCache.java
2012-08-01 21:44:42 UTC (rev 30067)
@@ -56,21 +56,17 @@
private Map<CyNetwork, Set<Long>> nodeLinkMap;
private Map<CyNetwork, Set<Long>> edgeLinkMap;
-
private Map<CyNode, Object/*network's id*/> networkPointerMap;
private static final Logger logger =
LoggerFactory.getLogger(ReadCache.class);
public void init() {
oldIdMap = new HashMap<Long, Object>();
-
nodeByIdMap = new HashMap<Object, CyNode>();
edgeByIdMap = new HashMap<Object, CyEdge>();
networkByIdMap = new HashMap<Object, CyNetwork>();
networkViewByIdMap = new HashMap<Object, CyNetworkView>();
-
nodeByNameMap = new HashMap<Object, CyNode>();
-
nodeLinkMap = new WeakHashMap<CyNetwork, Set<Long>>();
edgeLinkMap = new WeakHashMap<CyNetwork, Set<Long>>();
networkPointerMap = new WeakHashMap<CyNode, Object>();
@@ -81,9 +77,7 @@
edgeByIdMap = null;
networkByIdMap = null;
networkViewByIdMap = null;
-
nodeByNameMap = null;
-
nodeLinkMap = null;
edgeLinkMap = null;
networkPointerMap = null;
Added:
core3/impl/trunk/io-impl/impl/src/test/java/org/cytoscape/io/internal/read/SUIDUpdaterTest.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/test/java/org/cytoscape/io/internal/read/SUIDUpdaterTest.java
(rev 0)
+++
core3/impl/trunk/io-impl/impl/src/test/java/org/cytoscape/io/internal/read/SUIDUpdaterTest.java
2012-08-01 21:44:42 UTC (rev 30067)
@@ -0,0 +1,19 @@
+package org.cytoscape.io.internal.read;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+
+public class SUIDUpdaterTest {
+
+ @Test
+ public void testIsUpdatableSUIDColumn() {
+ assertTrue(SUIDUpdater.isUpdatableSUIDColumn("name.SUID"));
+ assertFalse(SUIDUpdater.isUpdatableSUIDColumn("name.suid")); //
Case sensitive!
+ assertFalse(SUIDUpdater.isUpdatableSUIDColumn("name.Suid"));
+ assertFalse(SUIDUpdater.isUpdatableSUIDColumn("name.id"));
+ assertFalse(SUIDUpdater.isUpdatableSUIDColumn("SUID"));
+ assertFalse(SUIDUpdater.isUpdatableSUIDColumn("suid"));
+ assertFalse(SUIDUpdater.isUpdatableSUIDColumn(""));
+ assertFalse(SUIDUpdater.isUpdatableSUIDColumn(null));
+ }
+}
Modified:
core3/impl/trunk/io-impl/impl/src/test/java/org/cytoscape/io/internal/read/xgmml/GenericXGMMLReaderTest.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/test/java/org/cytoscape/io/internal/read/xgmml/GenericXGMMLReaderTest.java
2012-08-01 19:26:25 UTC (rev 30066)
+++
core3/impl/trunk/io-impl/impl/src/test/java/org/cytoscape/io/internal/read/xgmml/GenericXGMMLReaderTest.java
2012-08-01 21:44:42 UTC (rev 30067)
@@ -1,5 +1,6 @@
package org.cytoscape.io.internal.read.xgmml;
+import static org.cytoscape.model.CyNetwork.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
@@ -12,6 +13,7 @@
import org.cytoscape.ding.NetworkViewTestSupport;
import org.cytoscape.equations.EquationCompiler;
import org.cytoscape.io.internal.read.AbstractNetworkReaderTest;
+import org.cytoscape.io.internal.read.SUIDUpdater;
import org.cytoscape.io.internal.read.xgmml.handler.ReadDataManager;
import org.cytoscape.io.internal.util.ReadCache;
import org.cytoscape.io.internal.util.UnrecognizedVisualPropertyManager;
@@ -46,6 +48,7 @@
RenderingEngineManager renderingEngineMgr;
ReadDataManager readDataMgr;
ReadCache readCache;
+ SUIDUpdater suidUpdater;
UnrecognizedVisualPropertyManager unrecognizedVisualPropertyMgr;
XGMMLParser parser;
GenericXGMMLReader reader;
@@ -69,7 +72,9 @@
networkViewFactory =
networkViewTestSupport.getNetworkViewFactory();
readCache = new ReadCache();
- readDataMgr = new ReadDataManager(readCache,
mock(EquationCompiler.class), networkFactory, rootNetworkMgr);
+ suidUpdater = new SUIDUpdater();
+ readDataMgr = new ReadDataManager(readCache, suidUpdater,
mock(EquationCompiler.class), networkFactory, rootNetworkMgr);
+
HandlerFactory handlerFactory = new HandlerFactory(readDataMgr);
handlerFactory.init();
parser = new XGMMLParser(handlerFactory, readDataMgr);
@@ -89,6 +94,30 @@
}
@Test
+ public void testIgnoreEmptyListAtt() throws Exception {
+ List<CyNetworkView> views = getViews("listAtt.xgmml");
+ CyNetwork net = checkSingleNetwork(views, 0, 0);
+ // The column should not be created, because the List type is
not known
+
assertNull(net.getDefaultNetworkTable().getColumn("empty_list"));
+ }
+
+ @Test
+ public void testCreateEmptyListAtt() throws Exception {
+ List<CyNetworkView> views = getViews("listAtt.xgmml");
+ CyNetwork net = checkSingleNetwork(views, 0, 0);
+ // The column should not be created, because the List type is
not known
+ assertTrue(net.getRow(net).getList("null_value_list",
String.class).isEmpty());
+ }
+
+ @Test
+ public void testListAtt() throws Exception {
+ List<CyNetworkView> views = getViews("listAtt.xgmml");
+ CyNetwork net = checkSingleNetwork(views, 0, 0);
+ assertEquals(2, net.getRow(net).getList("int_list",
Integer.class).size());
+ assertEquals(3, net.getRow(net).getList("str_list",
String.class).size());
+ }
+
+ @Test
public void testParseHiddenAtt() throws Exception {
List<CyNetworkView> views = getViews("hiddenAtt.xgmml");
CyNetwork net = checkSingleNetwork(views, 2, 1);
@@ -96,25 +125,60 @@
// Test CyTables
CyTable defNetTbl = net.getDefaultNetworkTable();
assertNotNull(defNetTbl.getColumn("test"));
- CyTable hiddenNetTbl = net.getRow(net,
CyNetwork.HIDDEN_ATTRS).getTable();
+ CyTable hiddenNetTbl = net.getRow(net, HIDDEN_ATTRS).getTable();
assertNotNull(hiddenNetTbl.getColumn("_private_int"));
CyTable defNodeTbl = net.getDefaultNodeTable();
assertNotNull(defNodeTbl.getColumn("name"));
assertNotNull(defNodeTbl.getColumn("list_1"));
- CyTable hiddenNodeTbl = net.getRow(net.getNodeList().get(0),
CyNetwork.HIDDEN_ATTRS).getTable();
+ CyTable hiddenNodeTbl = net.getRow(net.getNodeList().get(0),
HIDDEN_ATTRS).getTable();
assertNotNull(hiddenNodeTbl.getColumn("_private_str"));
assertNotNull(hiddenNodeTbl.getColumn("_private_list"));
CyTable defEdgeTbl = net.getDefaultEdgeTable();
assertNotNull(defEdgeTbl.getColumn("name"));
- CyTable hiddenEdgeTbl = net.getRow(net.getEdgeList().get(0),
CyNetwork.HIDDEN_ATTRS).getTable();
+ CyTable hiddenEdgeTbl = net.getRow(net.getEdgeList().get(0),
HIDDEN_ATTRS).getTable();
assertNotNull(hiddenEdgeTbl.getColumn("_private_real"));
assertCustomColumnsAreMutable(net);
}
@Test
+ public void testUpdatedSUIDAttributes() throws Exception {
+ List<CyNetworkView> views = getViews("suid_metadata.xgmml");
+ CyNetwork net = checkSingleNetwork(views, 2, 2);
+ List<CyNode> nodes = net.getNodeList();
+ List<CyEdge> edges = net.getEdgeList();
+
+ // Check network attributes
+ assertEquals(net.getSUID(), net.getRow(net).get("net_id.SUID",
Long.class));
+ // Hidden List att
+ List<Long> netAttList = net.getRow(net,
HIDDEN_ATTRS).getList("nodes.SUID", Long.class);
+ assertEquals(2, netAttList.size());
+ assertTrue(netAttList.contains(nodes.get(0).getSUID()));
+ assertTrue(netAttList.contains(nodes.get(1).getSUID()));
+
+ // Check node attributes
+ CyTable hnt = net.getTable(CyNode.class, HIDDEN_ATTRS);
+ // Don't force to Long just because ends the name ends with
".SUID"!
+ // The type must be real to be an SUID-type column, to avoid
conflicts
+ assertEquals(String.class,
hnt.getColumn("wrong_type_1.SUID").getType());
+ assertEquals(String.class,
hnt.getColumn("wrong_type_2.SUID").getType());
+ // These are ok, because the att type is "real"
+ assertEquals(nodes.get(1).getSUID(), net.getRow(nodes.get(0),
HIDDEN_ATTRS).get("other_node.SUID", Long.class));
+ assertEquals(nodes.get(0).getSUID(), net.getRow(nodes.get(1),
HIDDEN_ATTRS).get("other_node.SUID", Long.class));
+ // User List att
+ List<Long> nodeAttList =
net.getRow(nodes.get(1)).getList("edges.SUID", Long.class);
+ assertEquals(2, nodeAttList.size());
+ assertTrue(nodeAttList.contains(edges.get(0).getSUID()));
+ assertTrue(nodeAttList.contains(edges.get(1).getSUID()));
+
+ // Check edge attributes
+ assertEquals(edges.get(0).getSource().getSUID(),
net.getRow(edges.get(0)).get("source_node.SUID", Long.class));
+ assertEquals(edges.get(1).getSource().getSUID(),
net.getRow(edges.get(1)).get("source_node.SUID", Long.class));
+ }
+
+ @Test
public void testParseExpandedGroupFrom2x() throws Exception {
List<CyNetworkView> views = getViews("group_2x_expanded.xgmml");
// The group network should not be registered, so the network
list must contain only the base network
@@ -133,8 +197,8 @@
// Check group network data
CyNetwork grNet = grNode.getNetworkPointer();
for (CyNode n : grNet.getNodeList()) {
- assertNotNull(grNet.getRow(n,
CyNetwork.HIDDEN_ATTRS).get("__metanodeHintX", Double.class));
- assertNotNull(grNet.getRow(n,
CyNetwork.HIDDEN_ATTRS).get("__metanodeHintY", Double.class));
+ assertNotNull(grNet.getRow(n,
HIDDEN_ATTRS).get("__metanodeHintX", Double.class));
+ assertNotNull(grNet.getRow(n,
HIDDEN_ATTRS).get("__metanodeHintY", Double.class));
}
assertCustomColumnsAreMutable(net);
assertCustomColumnsAreMutable(grNet);
@@ -215,17 +279,17 @@
private void assertCustomColumnsAreMutable(CyNetwork net) {
// User or non-default columns should be immutable
CyTable[] tables = new CyTable[] {
- net.getTable(CyNetwork.class, CyNetwork.DEFAULT_ATTRS),
- net.getTable(CyNetwork.class, CyNetwork.HIDDEN_ATTRS),
- net.getTable(CyNode.class, CyNetwork.DEFAULT_ATTRS),
- net.getTable(CyNode.class, CyNetwork.HIDDEN_ATTRS),
- net.getTable(CyEdge.class, CyNetwork.DEFAULT_ATTRS),
- net.getTable(CyEdge.class, CyNetwork.HIDDEN_ATTRS)
+ net.getTable(CyNetwork.class, DEFAULT_ATTRS),
+ net.getTable(CyNetwork.class, HIDDEN_ATTRS),
+ net.getTable(CyNode.class, DEFAULT_ATTRS),
+ net.getTable(CyNode.class, HIDDEN_ATTRS),
+ net.getTable(CyEdge.class, DEFAULT_ATTRS),
+ net.getTable(CyEdge.class, HIDDEN_ATTRS)
};
for (CyTable t : tables) {
for (CyColumn c : t.getColumns()) {
String name = c.getName();
- if (!name.equals(CyNetwork.SUID) &&
!name.equals(CyNetwork.NAME) &&
+ if (!name.equals(CyNetwork.SUID) &&
!name.equals(NAME) &&
!name.equals(CyNetwork.SELECTED) &&
!name.equals(CyEdge.INTERACTION) &&
!name.equals(CyRootNetwork.SHARED_NAME)
&& !name.equals(CyRootNetwork.SHARED_INTERACTION)) {
assertFalse("Column " + c.getName() + "
should NOT be immutable", c.isImmutable());
@@ -260,7 +324,7 @@
// Check external edges metadata (must be added by the reader!)
CyRootNetwork rootNet = rootNetworkMgr.getRootNetwork(np);
- CyRow rnRow = rootNet.getRow(gn, CyNetwork.HIDDEN_ATTRS);
+ CyRow rnRow = rootNet.getRow(gn, HIDDEN_ATTRS);
List<String> extEdgeIds = rnRow.getList("__externalEdges",
String.class);
assertNotNull(extEdgeIds);
Added:
core3/impl/trunk/io-impl/impl/src/test/resources/testData/xgmml/listAtt.xgmml
===================================================================
---
core3/impl/trunk/io-impl/impl/src/test/resources/testData/xgmml/listAtt.xgmml
(rev 0)
+++
core3/impl/trunk/io-impl/impl/src/test/resources/testData/xgmml/listAtt.xgmml
2012-08-01 21:44:42 UTC (rev 30067)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<graph id="20" label="Network A" xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:cy="http://www.cytoscape.org" xmlns="http://www.cs.rpi.edu/XGMML"
+ directed="1">
+
+ <att type="list" name="empty_list"/>
+ <att type="list" name="null_value_list">
+ <att type="string" />
+ </att>
+ <att type="list" name="int_list">
+ <att type="integer" value="1" />
+ <att type="integer" value="2" />
+ </att>
+ <att type="list" name="str_list">
+ <att type="string" value="a" />
+ <att type="string" value="b" />
+ <att type="string" value="c" />
+ </att>
+
+</graph>
\ No newline at end of file
Added:
core3/impl/trunk/io-impl/impl/src/test/resources/testData/xgmml/suid_metadata.xgmml
===================================================================
---
core3/impl/trunk/io-impl/impl/src/test/resources/testData/xgmml/suid_metadata.xgmml
(rev 0)
+++
core3/impl/trunk/io-impl/impl/src/test/resources/testData/xgmml/suid_metadata.xgmml
2012-08-01 21:44:42 UTC (rev 30067)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<graph id="20" label="Network A" xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:cy="http://www.cytoscape.org" xmlns="http://www.cs.rpi.edu/XGMML"
+ directed="1">
+
+ <att type="boolean" name="test" value="1" />
+ <att type="real" name="net_id.SUID" value="20" />
+ <att type="list" name="nodes.SUID" cy:hidden="true">
+ <att type="real" value="21" />
+ <att type="real" value="22" />
+ </att>
+
+ <node label="node1" id="21">
+ <att type="string" name="name" value="node 1" />
+ <att type="string" name="wrong_type_1.SUID" value="abcd"
cy:hidden="true" />
+ <att type="string" name="wrong_type_2.SUID" value="23"
cy:hidden="true" />
+ <att type="real" name="other_node.SUID" value="22"
cy:hidden="true" />
+ <att type="list" name="edges.SUID">
+ <att type="real" value="23" />
+ <att type="real" value="24" />
+ </att>
+ </node>
+ <node label="node2" id="22">
+ <att type="string" name="name" value="node 2" />
+ <att type="real" name="other_node.SUID" value="21"
cy:hidden="true" />
+ <att type="list" name="edges.SUID">
+ <att type="real" value="23" />
+ <att type="real" value="24" />
+ </att>
+ </node>
+ <edge id="23" label="node1 (DirectedEdge) node2" source="21"
target="22">
+ <att type="string" name="name" value="node1 (DirectedEdge)
node2" />
+ <att type="real" name="source_node.SUID" value="21" />
+ </edge>
+ <edge id="24" label="node2 (DirectedEdge) node1" source="22"
target="21">
+ <att type="string" name="name" value="node2 (DirectedEdge)
node1" />
+ <att type="real" name="source_node.SUID" value="22" />
+ </edge>
+</graph>
Modified:
core3/impl/trunk/model-impl/impl/src/main/java/org/cytoscape/model/internal/CyTableImpl.java
===================================================================
---
core3/impl/trunk/model-impl/impl/src/main/java/org/cytoscape/model/internal/CyTableImpl.java
2012-08-01 19:26:25 UTC (rev 30066)
+++
core3/impl/trunk/model-impl/impl/src/main/java/org/cytoscape/model/internal/CyTableImpl.java
2012-08-01 21:44:42 UTC (rev 30067)
@@ -626,7 +626,7 @@
if
(!columnType.isAssignableFrom(value.getClass())
&&
!EqnSupport.scalarEquationIsCompatible(value, columnType))
- throw new
IllegalArgumentException("value is not of type: " + columnType);
+ throw new
IllegalArgumentException("value of \"" + columnName + "\" is not of type " +
columnType);
if (value instanceof Equation) {
newRawValue = value;
Modified:
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/Cy3SimpleSessionLodingTest.java
===================================================================
---
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/Cy3SimpleSessionLodingTest.java
2012-08-01 19:26:25 UTC (rev 30066)
+++
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/Cy3SimpleSessionLodingTest.java
2012-08-01 21:44:42 UTC (rev 30067)
@@ -14,6 +14,7 @@
import org.cytoscape.io.internal.util.session.model.SelectedNodes;
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyRow;
+import org.cytoscape.model.CyTable;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.view.presentation.property.BasicVisualLexicon;
import org.cytoscape.view.vizmap.VisualMappingFunction;
@@ -48,7 +49,6 @@
}
private void confirm() {
-
// test overall status of current session.
checkGlobalStatus();
@@ -65,6 +65,8 @@
checkNetwork(net2);
checkChildNetwork(net1);
}
+
+ checkTables();
}
private void checkGlobalStatus() {
@@ -119,8 +121,6 @@
Double nodeWidth =
view.getNodeView(network.getNodeList().iterator().next()).getVisualProperty(BasicVisualLexicon.NODE_WIDTH);
assertEquals(Double.valueOf(70.0d), nodeWidth);
-
-
}
private void checkVisualStyle(final VisualStyle style) {
@@ -140,4 +140,10 @@
assertEquals(43, network.getNodeCount());
assertEquals(34, network.getEdgeCount());
}
+
+ private void checkTables() {
+ // Check SUID-type columns
+ final Set<CyTable> globalTables =
tableManager.getGlobalTables();
+ // TODO
+ }
}
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.