Search in sources :

Example 21 with ModuleDefinition

use of org.sbolstandard.core2.ModuleDefinition in project libSBOLj by SynBioDex.

the class ModuleDefModuleTree method createModuleMDGraph.

public void createModuleMDGraph(SBOLDocument doc, int depth, ArrayList<String> mdNames, ArrayList<Integer> address, ModuleDefinition parentMd) throws SBOLValidationException {
    // System.out.println("depth = " + depth);
    if (depth > 0) {
        for (int i = 1; i <= numOfModules; i++) {
            address.add(i);
            System.out.println("address = " + intArrayListToString(address));
            System.out.println("addrSelfRef = " + intArrayListToString(addrCirfRef));
            String mdId = "md_" + intArrayListToString(address);
            String mId = "m_" + intArrayListToString(address);
            System.out.println("mdId = " + mdId);
            // System.out.println("mId = " + mId);
            if (intArrayListToString(address).equals(intArrayListToString(addrCirfRef))) {
                int circularRefIndex = randInt(0, mdNames.size() - 1);
                // int circleRefIndex = mdNames.size()-1; // Force 10704 to occur.
                System.out.println("circleRefIndex = " + circularRefIndex);
                System.out.println("address = " + intArrayListToString(address));
                System.out.println("addrCirRef = " + intArrayListToString(addrCirfRef));
                System.out.println("mdNames = " + mdNames);
                if (circularRefIndex == mdNames.size() - 1) {
                    System.out.println("Expect 11704");
                    expectedError = "11704";
                } else {
                    System.out.println("Expect 11705");
                    expectedError = "11705";
                }
                System.out.println("Last module displayId (mId) = " + mId);
                System.out.println("parentMd displayId = " + parentMd.getDisplayId());
                System.out.println("mdName = " + mdNames.get(circularRefIndex));
                // create the circular reference from module with mId to module definition selected by mdNames.get(circularRefIndex).
                parentMd.createModule(mId, mdNames.get(circularRefIndex));
            } else {
                ModuleDefinition childMd = doc.createModuleDefinition(mdId);
                parentMd.createModule(mId, mdId);
                mdNames.add(mdId);
                // System.out.println(mdId);
                // System.out.println("Interm. Module displayId = " + m.getDisplayId());
                System.out.println("mdNames = " + mdNames);
                createModuleMDGraph(doc, depth - 1, mdNames, address, childMd);
                mdNames.remove(mdId);
            }
            address.remove(address.size() - 1);
        }
    }
}
Also used : ModuleDefinition(org.sbolstandard.core2.ModuleDefinition)

Aggregations

URI (java.net.URI)15 URIcompliance.createCompliantURI (org.sbolstandard.core2.URIcompliance.createCompliantURI)10 ModuleDefinition (org.sbolstandard.core2.ModuleDefinition)8 SBOLDocument (org.sbolstandard.core2.SBOLDocument)7 ArrayList (java.util.ArrayList)4 QName (javax.xml.namespace.QName)4 ComponentDefinition (org.sbolstandard.core2.ComponentDefinition)4 FunctionalComponent (org.sbolstandard.core2.FunctionalComponent)4 Interaction (org.sbolstandard.core2.Interaction)4 HashSet (java.util.HashSet)3 IdentifiableDocument (org.sbolstandard.core.datatree.IdentifiableDocument)3 Literal (org.sbolstandard.core.datatree.Literal)3 StringifyQName (org.sbolstandard.core.io.json.StringifyQName)3 Module (org.sbolstandard.core2.Module)3 Before (org.junit.Before)2 NestedDocument (org.sbolstandard.core.datatree.NestedDocument)2 SequenceOntology (org.sbolstandard.core2.SequenceOntology)2 Test (org.junit.Test)1 CombinatorialDerivation (org.sbolstandard.core2.CombinatorialDerivation)1 GenericTopLevel (org.sbolstandard.core2.GenericTopLevel)1