Skip to content

Lattice Generator

Vidhi Jain edited this page Jul 13, 2017 · 14 revisions

Source Code

Method generate()

Input

Connection: con to _BN database

Output

Integer: max number of members

Calls

  1. readFirstSets() read first sest from RFunctors
  2. init() init createdSet + truncate tables + add first sets to db
  3. generateTree() generate lattice tree

Called at

(Should be called at) BayesBaseCT_SortMerge.buildCT()

  • after transfer.sql
  • before metadata_2.sql (deprecated)
    • i.e. functorNode.sql, contingencyTables.sql, bayesNetLearning.sql

NOTE: Current version calls short_rnid_LatticeGenerator.generate() at this place

Method readFirstSets()

  • Executes SQL select rnid from RNodes;
  • Adds each rnid to an ArrayList firstSets

Method init()

  • Assigns maxNumberofMembers to size of firstSets
  • Create and insert in tables lattice_membership, lattice_rel , and lattice_set . (NOTE: Here the parent column in lattice_rel is populated with default EmptySet)

Method generateTree()

  • Executes SQL select name from lattice_set where length = " + setLength + "; on _BN database
  • Adds each name in table lattice_set to a local ArrayList sets

Calls

createNewSets()

Method createNewSets()

Input

ArrayList: sets Uses static variable firstSets

Calls

  • nodeSplit() split a lattice node into a list of relation nodes
  • checkConstraints()
  • nodeJoin() generate a new lattice node by join a list of relation nodes
  • Executes SQL Inserts into tables lattice_set , lattice_rel and lattice_membership

Method checkConstraints()

  • Executes SQL Select on table RNodes
  • Adds the pvid1, pvid2 to HashSet firstSetKeys where rnid is firstSet.
  • Adds the pvid1, pvid2 to HashSet secondSetKeys where rnid is secondSet.

Input

String Array: firstSet String Array: secondSetParts

Output

boolean

Method nodeJoin()

Input

HashSet: newSet

  • Join each item in newSet in sorted order by String concatenation separated by comma

Method nodeSplit()

Input

String: node

Output

String Array: nodes

  • Split nodes on the delimiter and starting ending apostrophe.
Clone this wiki locally