WikiVis Web Application
 All Classes Namespaces Files Functions Variables Pages
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
wikivis.data.WikiVisDataService Class Reference

Service class for all page revision data related actions. More...

Public Member Functions

void initialize (ServletContext servContext)
 initializes the data service.
boolean isKnownPage (String pageTitle)
 determines if a page with the given title is known (and data exists) or not
WikiVisData getData (ServletContext servContext, String pageTitle, int width, int height, int fromMonth, int fromYear, int toMonth, int toYear) throws RevisionExtractionException
 calculate and returns the data for the given page title and conditions.
WikiVisData getData (ServletContext servContext, String pageTitle, int width, int height, int fromMonth, int fromYear, int toMonth, int toYear, boolean ignoreChacedData) throws RevisionExtractionException
 calculate and returns the data for the given page title and conditions.
Map getKnownPages ()
 returns the map of known pages
String getVersion ()
 returns the version of the service

Private Member Functions

void computeVariance (WikiVisData data, int fromMonth, int fromYear, int toMonth, int toYear)
 computes and sets the variance values for each author
void calculateOverallStatistics (WikiVisData data)
 calculates and sets the statistics for the given data
WikiVisData extractRevisionData (ServletContext servContext, String pageTitle) throws RevisionExtractionException
 loads the revision data from the page data file
void calculatePositions (WikiVisData data, int width, int height)
 calculates the positions of the nodes of the revision network of the given data.
void cacheData (WikiVisData data)
 updates the cache with the given data
void manageCache ()
 tries to optimize the cache with a simple cache strategy
WikiVisData getCachedData (String pageTitle)
 restores the cahce page data with the given title
String getDataFileName (String pageTitle)
 returns the file name for the given page title.

Static Private Member Functions

static long getMonthIndex (int year, int month)
 calculate the month index for the given month and year.
static List< RevisionfilterRevisionList (List< Revision > revisions, int fromMonth, int fromYear, int toMonth, int toYear)
 filters a given revision list according to the filter conditions.
static void createNodesAndEdges (WikiVisData data, int fromMonth, int fromYear, int toMonth, int toYear)
 creates and sets the revision network from the given data (the data must contain revisions and authors).

Private Attributes

Properties pageConfig
 the page configuration as Properties instance
Map< String, WikiVisCachedDatacachedData = new HashMap<String, WikiVisCachedData>()
 the cached data map

Static Private Attributes

static final String DATA_DIR = "/data/"
 the data directory that holds all page data
static final String CONFIG_PAGEDATA_FILENAME = "/pagedata-config.xml"
 the configuration file name
static final int MAX_CACHE_DATA = 10
 the maximum number of cached items
static final int THRESHOLD_VAR = 50
 the revision number threshold used in variance calculation
static final int MAX_ALLOWED_NODES = 7000
 the maximum number of authors where eigenvalue calculation is possible (limited to prevent OutOfMemoryError)

Detailed Description

Service class for all page revision data related actions.

Data is loaded from WebContent/data/,the page title to xml file mapping is specified in the configuration file. The configuration file "pagedata-config.xml" is an properties-xml file that contains all page entries with their titles as keys and the xml file name as value.

See Also
java.uitl.Properties
Author
Manuel Wyss e0106.nosp@m.157@.nosp@m.stude.nosp@m.nt.t.nosp@m.uwien.nosp@m..ac..nosp@m.at
Florian Zoubek zoube.nosp@m.k@bi.nosp@m.tanda.nosp@m.rt.a.nosp@m.t

Member Function Documentation

void wikivis.data.WikiVisDataService.cacheData ( WikiVisData  data)
private

updates the cache with the given data

Parameters
datathe data to cache
void wikivis.data.WikiVisDataService.calculateOverallStatistics ( WikiVisData  data)
private

calculates and sets the statistics for the given data

Parameters
datathe data to operate upon
void wikivis.data.WikiVisDataService.calculatePositions ( WikiVisData  data,
int  width,
int  height 
)
private

calculates the positions of the nodes of the revision network of the given data.

If the number of nodes exceeds MAX_ALLOWED_NODES , the positions will not be calculated and the according flag will be set in the data. This limit exists to prevent OutOfMemoryErrors due to eigenvalue calculation of huge adjacency matrices.

Parameters
datathe data to operate upon
widththe width of the visualization area
heightthe height of the visualization area
void wikivis.data.WikiVisDataService.computeVariance ( WikiVisData  data,
int  fromMonth,
int  fromYear,
int  toMonth,
int  toYear 
)
private

computes and sets the variance values for each author

Parameters
datathe data to operate upon
fromMonththe from month value of the time range filter (0-11)
fromYearthe from year value of the time range filter
toMonththe to month value of the time range filter (0-11)
toYearthe to year value of the time range filter
static void wikivis.data.WikiVisDataService.createNodesAndEdges ( WikiVisData  data,
int  fromMonth,
int  fromYear,
int  toMonth,
int  toYear 
)
staticprivate

creates and sets the revision network from the given data (the data must contain revisions and authors).

Filtering of the data will not be performed if any of the given conditions is negative.

Parameters
datathe data operate upon
fromMonththe month value of the first month to include
fromYearthe year value of the first month to include
toMonththe month value of the last month to include
toYearthe year value of the last month to include
WikiVisData wikivis.data.WikiVisDataService.extractRevisionData ( ServletContext  servContext,
String  pageTitle 
) throws RevisionExtractionException
private

loads the revision data from the page data file

Parameters
servContextthe current servlet context
pageTitlethe page title of the page to load
Returns
the extracted data
Exceptions
RevisionExtractionExceptionif the revision data could not be loaded
static List<Revision> wikivis.data.WikiVisDataService.filterRevisionList ( List< Revision revisions,
int  fromMonth,
int  fromYear,
int  toMonth,
int  toYear 
)
staticprivate

filters a given revision list according to the filter conditions.

If any condition is negative no filtering will be performed and the given instance will be returned.

Parameters
revisionsa list of revisions to filter
fromMonththe month value of the first month to include
fromYearthe year value of the first month to include
toMonththe month value of the last month to include
toYearthe year value of the last month to include
Returns
a filtered list of revisions
WikiVisData wikivis.data.WikiVisDataService.getCachedData ( String  pageTitle)
private

restores the cahce page data with the given title

Parameters
pageTitlethe page title
Returns
the restored data (does not contain variances and revision network)
WikiVisData wikivis.data.WikiVisDataService.getData ( ServletContext  servContext,
String  pageTitle,
int  width,
int  height,
int  fromMonth,
int  fromYear,
int  toMonth,
int  toYear 
) throws RevisionExtractionException

calculate and returns the data for the given page title and conditions.

If any of fromMonth, fromYear, toMonth or toYear, is given a negative value, no filtering will be performed. No caching will be performed.

Parameters
servContextthe current servlet context
pageTitlethe page title
widththe width of the visualization area
heightthe height of the visualization area
fromMonththe from month value of the time range filter (0-11)
fromYearthe from year value of the time range filter
toMonththe to month value of the time range filter (0-11)
toYearthe to year value of the time range filter
Returns
the requested data
Exceptions
RevisionExtractionExceptionif the revision data could not be loaded
WikiVisData wikivis.data.WikiVisDataService.getData ( ServletContext  servContext,
String  pageTitle,
int  width,
int  height,
int  fromMonth,
int  fromYear,
int  toMonth,
int  toYear,
boolean  ignoreChacedData 
) throws RevisionExtractionException

calculate and returns the data for the given page title and conditions.

If any of fromMonth, fromYear, toMonth or toYear, is given a negative value, no filtering will be performed. Caching will be performed if specified.

Parameters
servContextthe current servlet context
pageTitlethe page title
widththe width of the visualization area
heightthe height of the visualization area
fromMonththe from month value of the time range filter (0-11)
fromYearthe from year value of the time range filter
toMonththe to month value of the time range filter (0-11)
toYearthe to year value of the time range filter
ignoreChacedDatatrue if no caching should be performed, false otherwise
Returns
the requested data
Exceptions
RevisionExtractionExceptionif the revision data could not be loaded
String wikivis.data.WikiVisDataService.getDataFileName ( String  pageTitle)
private

returns the file name for the given page title.

The page must be known to the service.

Parameters
pageTitlethe title of the page
Returns
the file containing the revision data
Map wikivis.data.WikiVisDataService.getKnownPages ( )

returns the map of known pages

Returns
the map of known pages
static long wikivis.data.WikiVisDataService.getMonthIndex ( int  year,
int  month 
)
staticprivate

calculate the month index for the given month and year.

The characteristics of this index are:

  • if month1/year1 is before month2/year2 then monthIndex1 < monthIndex2
  • if month1/year1 is equal month2/year2 then monthIndex1 = monthIndex2
  • if month1/year1 is after month2/year2 then monthIndex1 > monthIndex2
Parameters
yearthe year
monththe month (0-11)
Returns
String wikivis.data.WikiVisDataService.getVersion ( )

returns the version of the service

Returns
the version of the service
void wikivis.data.WikiVisDataService.initialize ( ServletContext  servContext)

initializes the data service.

This method must be called and succeed before any other method of this class should be called

Parameters
servContextthe Servlet context used in this service
boolean wikivis.data.WikiVisDataService.isKnownPage ( String  pageTitle)

determines if a page with the given title is known (and data exists) or not

Parameters
pageTitlethe page title of the page
Returns
true if the page is known, false otherwise
void wikivis.data.WikiVisDataService.manageCache ( )
private

tries to optimize the cache with a simple cache strategy

Member Data Documentation

Map<String, WikiVisCachedData> wikivis.data.WikiVisDataService.cachedData = new HashMap<String, WikiVisCachedData>()
private

the cached data map

final String wikivis.data.WikiVisDataService.CONFIG_PAGEDATA_FILENAME = "/pagedata-config.xml"
staticprivate

the configuration file name

final String wikivis.data.WikiVisDataService.DATA_DIR = "/data/"
staticprivate

the data directory that holds all page data

final int wikivis.data.WikiVisDataService.MAX_ALLOWED_NODES = 7000
staticprivate

the maximum number of authors where eigenvalue calculation is possible (limited to prevent OutOfMemoryError)

final int wikivis.data.WikiVisDataService.MAX_CACHE_DATA = 10
staticprivate

the maximum number of cached items

Properties wikivis.data.WikiVisDataService.pageConfig
private

the page configuration as Properties instance

final int wikivis.data.WikiVisDataService.THRESHOLD_VAR = 50
staticprivate

the revision number threshold used in variance calculation


The documentation for this class was generated from the following file: