JPL-IMCE / gov.nasa.jpl.imce.oml

Ontology Modeling Language (OML) Workbench
14 stars 1 forks source link

Stack overflow with circular imports #227

Closed NicolasRouquette closed 6 years ago

NicolasRouquette commented 6 years ago

In gov.nasa.jpl.imce.oml.model.extensions.OMLExtensions:


    static final def Iterable<TerminologyBox> collectAllImportedTerminologies(
        ArrayList<TerminologyBox> queue,
        ArrayList<TerminologyBox> acc
    ) {
        if (queue.isEmpty)
            return acc

        val tbox = queue.head
        queue.remove(tbox)

        val inc = tbox.moduleEdges.map[targetModule].filterNull.filter(TerminologyBox)
        queue.addAll(inc)
        acc.addAll(inc)

        collectAllImportedTerminologies(queue, acc)
    }