|
| VisJsVisualizer (SDocument doc) throws IOException |
| Creates a new VisJsVisualizer instance for specified salt document. More...
|
|
| VisJsVisualizer (SDocument doc, ExportFilter exportFilter, StyleImporter styleImporter) throws IOException |
| Creates a new VisJsVisualizer instance with specified export filter for specified salt document. More...
|
|
| VisJsVisualizer (URI inputFileUri) throws IOException |
| Creates a new VisJsVisualizer instance for a salt file specified by the uri. More...
|
|
| VisJsVisualizer (URI inputFileUri, ExportFilter exportFilter, StyleImporter styleImporter) throws IOException |
| Creates a new VisJsVisualizer instance with specified export filter for a salt file specified by the uri. More...
|
|
void | visualize (URI outputFolderUri) throws SaltParameterException, SaltResourceException, SaltException, SaltResourceException, IOException, XMLStreamException |
|
void | setNodeWriter (OutputStream os) |
| Creates a new buffered writer with specified output stream. More...
|
|
void | setEdgeWriter (OutputStream os) |
| Creates a new buffered writer with specified output stream. More...
|
|
void | buildJSON () throws SaltException, SaltParameterException |
| By invoking of this method the graph of the salt document specified by the constructor will be traversed. More...
|
|
void | nodeReached (GRAPH_TRAVERSE_TYPE traversalType, String traversalId, SNode currNode, SRelation relation, SNode fromNode, long order) |
| Implements the nodeReached method of the org.corpus_tools.salt.core.GraphTraverseHandler interface.
|
|
void | nodeLeft (GRAPH_TRAVERSE_TYPE traversalType, String traversalId, SNode currNode, SRelation relation, SNode fromNode, long order) |
| Implements the nodeLeft method of the org.corpus_tools.salt.core.GraphTraverseHandler interface.
|
|
boolean | checkConstraint (GRAPH_TRAVERSE_TYPE traversalType, String traversalId, SRelation relation, SNode currNode, long order) |
| Implements the checkConstraint method of the org.corpus_tools.salt.core.GraphTraverseHandler interface.
|
|
Public Member Functions inherited from org.corpus_tools.salt.core.GraphTraverseHandler |
void | nodeReached (GRAPH_TRAVERSE_TYPE traversalType, String traversalId, SNode currNode, SRelation< SNode, SNode > relation, SNode fromNode, long order) |
| This method will be invoked, when a node is reached, after the method checkConstraint(GRAPH_TRAVERSE_TYPE, String, SRelation, SNode, long) has returned true and before the method nodeLeft(GRAPH_TRAVERSE_TYPE, String, SNode, SRelation, SNode, long) is invoked. More...
|
|
void | nodeLeft (GRAPH_TRAVERSE_TYPE traversalType, String traversalId, SNode currNode, SRelation< SNode, SNode > relation, SNode fromNode, long order) |
| This method will be invoked, when a node is left, after the method checkConstraint(GRAPH_TRAVERSE_TYPE, String, SRelation, SNode, long) has returned true and the method nodeReached(GRAPH_TRAVERSE_TYPE, String, SNode, SRelation, SNode, long) has been invoked. More...
|
|
boolean | checkConstraint (GRAPH_TRAVERSE_TYPE traversalType, String traversalId, SRelation< SNode, SNode > relation, SNode currNode, long order) |
| This method is called during a traversal to check if the current node and eventually its sub-graph shall be traversed or not. More...
|
|
This class provides a possibility to create a html file, which visualizes a salt graph, created from an SDocument or from an org.eclipse.emf.common.util.URI of a salt file, using the vis.js library from visjs.org.
Also it can be used to get both nodes and relations of a salt document in JSON format. Note, if no export filter used, all nodes and all relations but textual relations will be visualized.
A simple way to use this class for writing the html file is shown in the following example code.
String inputSaltFile = "path_to_your_salt_file";
String outputFolder = "path_to_your_output_folder";
URI uri = URI.createFileURI(inputSaltFile);
try {
URI outputFileUri = URI.createFileURI(outputFolder);
visJsVisualizer.visualize(outputFileUri);
} catch (IOException | XMLStreamException e) {
e.printStackTrace();
}
The next listing shows how to get the nodes and the relations of an input salt file in JSON format by use of this class. For simplicity, the created JSON objects will be written to the standard output.
URI uri = URI.createFileURI("path_to_the_input_salt_file");
OutputStream nodeStream = Sytem.out;
OutputStream edgeStream = System.out;
try {
nodeStream.write('\n'); nodeStream.flush();
edgeStream.flush();
} catch (IOException e) {
e.printStackTrace();
}
- Author
- irina