org.mymedialite.io
Class AttributeData

java.lang.Object
  extended by org.mymedialite.io.AttributeData

public class AttributeData
extends java.lang.Object

Class that offers static methods to read (binary) attribute data into SparseBooleanMatrix objects. The expected (sparse) line format is: ENTITY_ID SEPARATOR ATTRIBUTE_ID for attributes that are set. SEPARATOR can be space, tab, or comma.


Method Summary
static SparseBooleanMatrix read(java.io.BufferedReader reader, IEntityMapping itemMapping, IEntityMapping attributeMapping)
          Read binary attribute data from a BufferedReader.
static SparseBooleanMatrix read(java.lang.String filename, IEntityMapping itemMapping, IEntityMapping attributeMapping)
          Read binary attribute data from a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

read

public static SparseBooleanMatrix read(java.lang.String filename,
                                       IEntityMapping itemMapping,
                                       IEntityMapping attributeMapping)
                                throws java.io.IOException
Read binary attribute data from a file. Each line must consist of an item identifier followed by one or more attribute identifiers. There can be one or more lines per item. Empty lines are ignored. See Constants.SPLIT_CHARS for details of the permissible field separators.

Parameters:
filename - the name of the file to be read from
itemMapping - the mapping object for the given entity type
attributeMapping - the mapping object for the attributes
Returns:
the attribute data
Throws:
java.io.IOException

read

public static SparseBooleanMatrix read(java.io.BufferedReader reader,
                                       IEntityMapping itemMapping,
                                       IEntityMapping attributeMapping)
                                throws java.io.IOException
Read binary attribute data from a BufferedReader. Each line must consist of an item identifier followed by one or more attribute identifiers. There can be one or more lines per item. Empty lines are ignored. See Constants.SPLIT_CHARS for details of the permissible field separators.

Parameters:
reader - a BufferedReader to be read from
itemMapping - the mapping object for the given entity type
attributeMapping - the mapping object for the attributes
Returns:
the attribute data
Throws:
java.io.IOException