Defines a class for network file loading and parsing. More...
#include <parser.h>
Signals | |
void | signalAddNewRelation (const QString &relName, const bool &changeRelation=false) |
void | signalSetRelation (int, const bool &updateUI=true) |
void | signalCreateNode (const int &num, const int &size, const QString &color, const QString &numColor, const int &numSize, const QString &label, const QString &lColor, const int &lSize, const QPointF &p, const QString &shape, const QString &iconPath=QString(), const bool &signalMW=false) |
void | signalCreateNodeAtPosRandom (const bool &signalMW=false) |
void | signalCreateNodeAtPosRandomWithLabel (const int &num, const QString &label, const bool &signalMW=false) |
void | signalCreateEdge (const int &source, const int &target, const qreal &weight, const QString &color, const int &edgeDirType, const bool &arrows, const bool &bezier, const QString &edgeLabel=QString(), const bool &signalMW=false) |
void | signalFileLoaded (const int &fileType, const QString &fileName, const QString &netName, const int &totalNodes, const int &totalLinks, const int &edgeDirType, const qint64 &elapsedTime, const QString &message=QString()) |
void | removeDummyNode (int) |
void | finished (QString) |
Public Member Functions | |
Parser () | |
~Parser () | |
void | load (const QString &fileName, const QString &codecName, const int &defNodeSize, const QString &defNodeColor, const QString &defNodeShape, const QString &defNodeNumberColor, const int &defNodeNumberSize, const QString &defNodeLabelColor, const int &defNodeLabelSize, const QString &defEdgeColor, const int &canvasWidth, const int &canvasHeight, const int &format, const int &sm_mode, const QString &delim=QString()) |
Loads the data of the given network file, and calls the relevant method to parse it. More... | |
bool | parseAsPajek (const QByteArray &rawData) |
Parses the data as Pajek-formatted. More... | |
bool | parseAsAdjacency (const QByteArray &rawData) |
Parses the data as adjacency sociomatrix-formatted. More... | |
bool | parseAsDot (const QByteArray &rawData) |
Parses the data as dot (Graphviz) formatted network. More... | |
bool | parseAsGraphML (const QByteArray &rawData) |
Parses the data as GraphML (not GML) formatted network. More... | |
bool | parseAsGML (const QByteArray &rawData) |
Parses the data as GML formatted network. More... | |
bool | parseAsDL (const QByteArray &rawData) |
Parses the data as DL-formatted (UCINET) More... | |
bool | parseAsEdgeListSimple (const QByteArray &rawData, const QString &delimiter) |
Parses the data as simple edgelist formatted. More... | |
bool | parseAsEdgeListWeighted (const QByteArray &rawData, const QString &delimiter) |
Parses the data as weighted edgelist formatted network. More... | |
bool | parseAsTwoModeSociomatrix (const QByteArray &rawData) |
Parses the data as two-mode sociomatrix formatted network. More... | |
bool | readDLKeywords (QStringList &strList, int &N, int &NM, int &NR, int &NC, bool &fullmatrixFormat, bool &edgelist1Format) |
void | readDotProperties (QString str, qreal &, QString &label, QString &shape, QString &color, QString &fontName, QString &fontColor) |
Reads the properties of a dot element. More... | |
bool | readGraphML (QXmlStreamReader &) |
Checks the xml token name and calls the appropriate function. More... | |
void | readGraphMLElementGraph (QXmlStreamReader &) |
Reads a graph definition. More... | |
void | readGraphMLElementNode (QXmlStreamReader &) |
Reads basic node attributes and sets the nodeNumber. More... | |
void | endGraphMLElementNode (QXmlStreamReader &) |
Signals to create a new node. More... | |
void | readGraphMLElementEdge (QXmlStreamAttributes &) |
Reads basic edge creation properties. More... | |
void | endGraphMLElementEdge (QXmlStreamReader &) |
Signals for a new edge to be created/added. More... | |
void | readGraphMLElementData (QXmlStreamReader &) |
Reads data for edges and nodes. More... | |
void | readGraphMLElementUnknown (QXmlStreamReader &) |
Trivial call for unknown elements. More... | |
void | readGraphMLElementKey (QXmlStreamAttributes &) |
Reads a key definition. More... | |
void | readGraphMLElementDefaultValue (QXmlStreamReader &) |
Reads default key values. More... | |
void | readGraphMLElementNodeGraphics (QXmlStreamReader &) |
Reads node graphics data and properties: label, color, shape, size, coordinates, etc. More... | |
void | readGraphMLElementEdgeGraphics (QXmlStreamReader &) |
Reads edge graphics data and properties: path, linestyle,width, arrows, etc. More... | |
void | createMissingNodeEdges () |
Creates any missing node edges. More... | |
bool | isComment (QString str) |
Helper. Checks if the string parameter is a comment (starts with a known char, i.e #). More... | |
void | createRandomNodes (const int &fixedNum=1, const QString &label=QString(), const int &newNodes=1) |
Signals to create either a single new node (numbered fixedNum) or multiple new nodes (numbered from 1 to to newNodes) More... | |
Detailed Description
Defines a class for network file loading and parsing.
Supports GraphML, Pajek, Adjacency, Graphviz, UCINET, EdgeLists etc
Constructor & Destructor Documentation
◆ Parser()
Parser::Parser | ( | ) |
◆ ~Parser()
Parser::~Parser | ( | ) |
Member Function Documentation
◆ createMissingNodeEdges()
void Parser::createMissingNodeEdges | ( | ) |
Creates any missing node edges.
◆ createRandomNodes()
void Parser::createRandomNodes | ( | const int & | fixedNum = 1 , |
const QString & | label = QString() , |
||
const int & | newNodes = 1 |
||
) |
Signals to create either a single new node (numbered fixedNum) or multiple new nodes (numbered from 1 to to newNodes)
- Parameters
-
fixedNum label newNodes
◆ endGraphMLElementEdge()
void Parser::endGraphMLElementEdge | ( | QXmlStreamReader & | xml | ) |
Signals for a new edge to be created/added.
Called at the end of edge element
- Parameters
-
xml
◆ endGraphMLElementNode()
void Parser::endGraphMLElementNode | ( | QXmlStreamReader & | xml | ) |
Signals to create a new node.
called at the end of a node element
- Parameters
-
xml
◆ finished
|
signal |
◆ isComment()
bool Parser::isComment | ( | QString | str | ) |
Helper. Checks if the string parameter is a comment (starts with a known char, i.e #).
- Parameters
-
str
- Returns
- bool
◆ load()
void Parser::load | ( | const QString & | fileName, |
const QString & | codecName, | ||
const int & | defNodeSize, | ||
const QString & | defNodeColor, | ||
const QString & | defNodeShape, | ||
const QString & | defNodeNumberColor, | ||
const int & | defNodeNumberSize, | ||
const QString & | defNodeLabelColor, | ||
const int & | defNodeLabelSize, | ||
const QString & | defEdgeColor, | ||
const int & | canvasWidth, | ||
const int & | canvasHeight, | ||
const int & | format, | ||
const int & | sm_mode, | ||
const QString & | delim = QString() |
||
) |
Loads the data of the given network file, and calls the relevant method to parse it.
- Parameters
-
fileName codecName defNodeSize defNodeColor defNodeShape defNodeNumberColor defNodeNumberSize defNodeLabelColor defNodeLabelSize defEdgeColor width height format sm_mode delim
◆ parseAsAdjacency()
bool Parser::parseAsAdjacency | ( | const QByteArray & | rawData | ) |
Parses the data as adjacency sociomatrix-formatted.
- Returns
- bool
◆ parseAsDL()
bool Parser::parseAsDL | ( | const QByteArray & | rawData | ) |
Parses the data as DL-formatted (UCINET)
- Parameters
-
rawData
- Returns
- bool
◆ parseAsDot()
bool Parser::parseAsDot | ( | const QByteArray & | rawData | ) |
Parses the data as dot (Graphviz) formatted network.
- Parameters
-
rawData
- Returns
◆ parseAsEdgeListSimple()
bool Parser::parseAsEdgeListSimple | ( | const QByteArray & | rawData, |
const QString & | delimiter | ||
) |
Parses the data as simple edgelist formatted.
- Parameters
-
rawData delimiter
- Returns
- bool
◆ parseAsEdgeListWeighted()
bool Parser::parseAsEdgeListWeighted | ( | const QByteArray & | rawData, |
const QString & | delimiter | ||
) |
Parses the data as weighted edgelist formatted network.
This method can read and parse edgelist formated files where edge source and target are either named with numbers or with labels That is the following formats can be parsed:
edgelist with node numbers
1 2 1 1 3 2 1 6 2 1 8 2 ...
edgelist with node labels
actor1 actor2 1 actor2 actor4 2 actor1 actor3 1 actorX actorY 3 name othername 1 othername somename 2 ...
- Parameters
-
rawData delimiter
- Returns
◆ parseAsGML()
bool Parser::parseAsGML | ( | const QByteArray & | rawData | ) |
Parses the data as GML formatted network.
- Parameters
-
rawData
- Returns
- bool
◆ parseAsGraphML()
bool Parser::parseAsGraphML | ( | const QByteArray & | rawData | ) |
Parses the data as GraphML (not GML) formatted network.
- Parameters
-
rawData
- Returns
- bool
◆ parseAsPajek()
bool Parser::parseAsPajek | ( | const QByteArray & | rawData | ) |
Parses the data as Pajek-formatted.
- Parameters
-
rawData
- Returns
SPLIT EACH LINE (ON EMPTY SPACE CHARACTERS) IN SEVERAL ELEMENTS
READING NODES
NODELABEL
NODESHAPE: There are five possible .
NODECOLORS
READ NODE COORDINATES
EDGES
ARCS
ARCSlist
matrix
◆ parseAsTwoModeSociomatrix()
bool Parser::parseAsTwoModeSociomatrix | ( | const QByteArray & | rawData | ) |
Parses the data as two-mode sociomatrix formatted network.
- Parameters
-
rawData
- Returns
◆ readDLKeywords()
bool Parser::readDLKeywords | ( | QStringList & | strList, |
int & | N, | ||
int & | NM, | ||
int & | NR, | ||
int & | NC, | ||
bool & | fullmatrixFormat, | ||
bool & | edgelist1Format | ||
) |
◆ readDotProperties()
void Parser::readDotProperties | ( | QString | str, |
qreal & | nValue, | ||
QString & | label, | ||
QString & | shape, | ||
QString & | color, | ||
QString & | fontName, | ||
QString & | fontColor | ||
) |
Reads the properties of a dot element.
- Parameters
-
str nValue label shape color fontName fontColor
◆ readGraphML()
bool Parser::readGraphML | ( | QXmlStreamReader & | xml | ) |
Checks the xml token name and calls the appropriate function.
- Parameters
-
xml
- Returns
- bool
◆ readGraphMLElementData()
void Parser::readGraphMLElementData | ( | QXmlStreamReader & | xml | ) |
Reads data for edges and nodes.
called at a data element (usually nested inside a node or an edge element)
- Parameters
-
xml
◆ readGraphMLElementDefaultValue()
void Parser::readGraphMLElementDefaultValue | ( | QXmlStreamReader & | xml | ) |
Reads default key values.
Called at a default element (usually nested inside key element)
- Parameters
-
xml
◆ readGraphMLElementEdge()
void Parser::readGraphMLElementEdge | ( | QXmlStreamAttributes & | xmlStreamAttr | ) |
Reads basic edge creation properties.
called at the start of an edge element
- Parameters
-
xmlStreamAttr
◆ readGraphMLElementEdgeGraphics()
void Parser::readGraphMLElementEdgeGraphics | ( | QXmlStreamReader & | xml | ) |
Reads edge graphics data and properties: path, linestyle,width, arrows, etc.
- Parameters
-
xml
◆ readGraphMLElementGraph()
void Parser::readGraphMLElementGraph | ( | QXmlStreamReader & | xml | ) |
◆ readGraphMLElementKey()
void Parser::readGraphMLElementKey | ( | QXmlStreamAttributes & | xmlStreamAttr | ) |
Reads a key definition.
called at key element
- Parameters
-
xmlStreamAttr
◆ readGraphMLElementNode()
void Parser::readGraphMLElementNode | ( | QXmlStreamReader & | xml | ) |
Reads basic node attributes and sets the nodeNumber.
called at the start of a node element
- Parameters
-
xml
◆ readGraphMLElementNodeGraphics()
void Parser::readGraphMLElementNodeGraphics | ( | QXmlStreamReader & | xml | ) |
Reads node graphics data and properties: label, color, shape, size, coordinates, etc.
- Parameters
-
xml
◆ readGraphMLElementUnknown()
void Parser::readGraphMLElementUnknown | ( | QXmlStreamReader & | xml | ) |
Trivial call for unknown elements.
- Parameters
-
xml
◆ removeDummyNode
|
signal |
◆ signalAddNewRelation
|
signal |
◆ signalCreateEdge
|
signal |
◆ signalCreateNode
|
signal |
◆ signalCreateNodeAtPosRandom
|
signal |
◆ signalCreateNodeAtPosRandomWithLabel
|
signal |
◆ signalFileLoaded
|
signal |
◆ signalSetRelation
|
signal |
Member Data Documentation
◆ arrows
|
private |
◆ arrowSize
|
private |
◆ bez_p1_x
|
private |
◆ bez_p1_y
|
private |
◆ bez_p2_x
|
private |
◆ bez_p2_y
|
private |
◆ bezier
|
private |
◆ bool_edge
|
private |
◆ bool_key
|
private |
◆ bool_node
|
private |
◆ conv_OK
|
private |
◆ delimiter
|
private |
◆ edge_directed
|
private |
◆ edge_id
|
private |
◆ edge_source
|
private |
◆ edge_target
|
private |
◆ edge_weight
|
private |
◆ edgeColor
|
private |
◆ edgeDirType
|
private |
◆ edgeLabel
|
private |
◆ edgeMissingNodesList
|
private |
◆ edgeMissingNodesListData
|
private |
◆ edgesMissingNodesHash
|
private |
◆ edgeType
|
private |
◆ edgeWeight
|
private |
◆ errorMessage
|
private |
◆ fileContainsLinkColors
|
private |
◆ fileContainsLinkLabels
|
private |
◆ fileContainsNodeColors
|
private |
◆ fileContainsNodeCoords
|
private |
◆ fileDirPath
|
private |
◆ fileFormat
|
private |
◆ fileLoaded
|
private |
◆ firstModeMultiMap
|
private |
◆ gwHeight
|
private |
◆ gwWidth
|
private |
◆ initEdgeColor
|
private |
◆ initEdgeLabel
|
private |
◆ initEdgeWeight
|
private |
◆ initNodeColor
|
private |
◆ initNodeCustomIcon
|
private |
◆ initNodeLabelColor
|
private |
◆ initNodeLabelSize
|
private |
◆ initNodeNumberColor
|
private |
◆ initNodeNumberSize
|
private |
◆ initNodeShape
|
private |
◆ initNodeSize
|
private |
◆ key_id
|
private |
◆ key_name
|
private |
◆ key_type
|
private |
◆ key_value
|
private |
◆ key_what
|
private |
◆ keyDefaultValue
|
private |
◆ keyFor
|
private |
◆ keyName
|
private |
◆ keyType
|
private |
◆ m_textCodecName
|
private |
◆ missingNode
|
private |
◆ networkName
|
private |
◆ node_id
|
private |
◆ nodeColor
|
private |
◆ nodeHash
|
private |
◆ nodeIconPath
|
private |
◆ nodeLabel
|
private |
◆ nodeLabelColor
|
private |
◆ nodeLabelSize
|
private |
◆ nodeNumberColor
|
private |
◆ nodeNumberSize
|
private |
◆ nodeShape
|
private |
◆ nodeSize
|
private |
◆ randX
|
private |
◆ randY
|
private |
◆ relationsList
|
private |
◆ secondModeMultiMap
|
private |
◆ source
|
private |
◆ target
|
private |
◆ totalLinks
|
private |
◆ totalNodes
|
private |
◆ two_sm_mode
|
private |
◆ xml
|
private |
The documentation for this class was generated from the following files:
- app/src/parser.h
- app/src/parser.cpp