<commit_before>/**
 * class OntNode
 * A Node structure for Binary Tree of the complete Data obtained from server
 */
export class OntNode {
    public id: number; // ID of the node
    public attr: any[] = []; // Array of all attributes connected to the node
    public children: OntNode[] = []; // Check for Nodes with Children
}

export class RecursionParse {

    public nodes: any[] = [];
    private links: any[] = [];


    public parse_ontology(ont: any): any {

        let linkedOntTree = this.parse_node(ont.viewStructure);
        this.links = this.parse_link(linkedOntTree);
        // console.log({'nodes': this.nodes, 'links': this.links});
        return {'nodes': this.nodes, 'links': this.links}

    }


    public parse_node(jsonVal: any): any {
        let node = new OntNode();
        node.id = this.nodes.length;
        this.nodes.push({
            name: jsonVal['concept']['translatedURL'],
            url: jsonVal['concept']['url'],
            id: this.nodes.length,
            color: 'red'
        });


        // adding dataproperties
        for (let datProp of jsonVal.dataproperties) {
            this.nodes.push({
                name: datProp['translatedURL'],
                url: datProp['url'],
                id: this.nodes.length,
                color: 'green'
            });
            node.attr.push(this.nodes.length);<commit_msg>Adapted recursion class to include two more params<commit_after>/**
 * class OntNode
 * A Node structure for Binary Tree of the complete Data obtained from server
 */
export class OntNode {
    public id: number; // ID of the node
    public attr: any[] = []; // Array of all attributes connected to the node
    public children: OntNode[] = []; // Check for Nodes with Children
}

export class RecursionParse {

    public nodes: any[] = [];
    private links: any[] = [];


    public parse_ontology(ont: any): any {

        let linkedOntTree = this.parse_node(ont.viewStructure);
        this.links = this.parse_link(linkedOntTree);
        // console.log({'nodes': this.nodes, 'links': this.links});
        return {'nodes': this.nodes, 'links': this.links}

    }


    public parse_node(jsonVal: any): any {
        let node = new OntNode();
        node.id = this.nodes.length;
        this.nodes.push({
            name: jsonVal['concept']['translatedURL'],
            url: jsonVal['concept']['url'],
            conceptSource: jsonVal['concept']['conceptSource'],
            id: this.nodes.length,
            color: 'red'
        });


        // adding dataproperties
        for (let datProp of jsonVal.dataproperties) {
            this.nodes.push({
                name: datProp['translatedURL'],
                url: datProp['url'],
                id: this.nodes.length,
                conceptSource: datProp['conceptSource'],
                propertySource: datProp['propertySource'],
                color: 'green'
            });
            node.attr.push(this.nodes.length);
{'fraction_non_alphanumeric': 0.1294867494129487, 'fraction_numerical': 0.0, 'mean_word_length': 2.1389473684210527, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1877647', 'n_tokens_mistral': 839, 'n_tokens_neox': 796, 'n_words': 228}