Search in sources :

Example 1 with NestedDocument

use of org.sbolstandard.core.datatree.Datatree.NestedDocument in project libSBOLj by SynBioDex.

the class SBOLWriter method formatComponents.

private static void formatComponents(Set<Component> components, List<NamedProperty<QName>> properties) {
    for (Component s : components) {
        List<NamedProperty<QName>> list = new ArrayList<>();
        formatCommonIdentifiedData(list, s);
        for (URI roles : s.getRoles()) {
            list.add(NamedProperty(Sbol2Terms.Component.roles, roles));
        }
        if (s.isSetRoleIntegration()) {
            list.add(NamedProperty(Sbol2Terms.Component.roleIntegration, RoleIntegrationType.convertToURI(s.getRoleIntegration())));
        }
        list.add(NamedProperty(Sbol2Terms.ComponentInstance.access, AccessType.convertToURI(s.getAccess())));
        list.add(NamedProperty(Sbol2Terms.ComponentInstance.hasComponentDefinition, s.getDefinitionURI()));
        List<NestedDocument<QName>> referenceList = getMapsTo(s.getMapsTos());
        for (NestedDocument<QName> n : referenceList) {
            list.add(NamedProperty(Sbol2Terms.ComponentInstance.hasMapsTo, n));
        }
        properties.add(NamedProperty(Sbol2Terms.ComponentDefinition.hasComponent, NestedDocument(Sbol2Terms.Component.Component, s.getIdentity(), NamedProperties(list))));
    }
}
Also used : StringifyQName(org.sbolstandard.core.io.json.StringifyQName) QName(javax.xml.namespace.QName) NamedProperty(org.sbolstandard.core.datatree.NamedProperty) NamedProperty(org.sbolstandard.core.datatree.Datatree.NamedProperty) ArrayList(java.util.ArrayList) URI(java.net.URI) NestedDocument(org.sbolstandard.core.datatree.NestedDocument) NestedDocument(org.sbolstandard.core.datatree.Datatree.NestedDocument)

Example 2 with NestedDocument

use of org.sbolstandard.core.datatree.Datatree.NestedDocument in project libSBOLj by SynBioDex.

the class SBOLWriter method formatParticipations.

private static List<NestedDocument<QName>> formatParticipations(Set<Participation> participations) {
    List<NestedDocument<QName>> nestedDoc = new ArrayList<>();
    for (Participation p : participations) {
        List<NamedProperty<QName>> list = new ArrayList<>();
        formatCommonIdentifiedData(list, p);
        for (URI r : p.getRoles()) list.add(NamedProperty(Sbol2Terms.Participation.role, r));
        list.add(NamedProperty(Sbol2Terms.Participation.hasParticipant, p.getParticipantURI()));
        nestedDoc.add(NestedDocument(Sbol2Terms.Participation.Participation, p.getIdentity(), NamedProperties(list)));
    }
    return nestedDoc;
}
Also used : NamedProperty(org.sbolstandard.core.datatree.NamedProperty) NamedProperty(org.sbolstandard.core.datatree.Datatree.NamedProperty) ArrayList(java.util.ArrayList) NestedDocument(org.sbolstandard.core.datatree.NestedDocument) NestedDocument(org.sbolstandard.core.datatree.Datatree.NestedDocument) URI(java.net.URI)

Example 3 with NestedDocument

use of org.sbolstandard.core.datatree.Datatree.NestedDocument in project libSBOLj by SynBioDex.

the class SBOLWriter method formatInteractions.

/**
 * formatInteractions for Module
 * @param interactions
 * @param properties
 */
private static void formatInteractions(Set<Interaction> interactions, List<NamedProperty<QName>> properties) {
    for (Interaction i : interactions) {
        List<NamedProperty<QName>> list = new ArrayList<>();
        formatCommonIdentifiedData(list, i);
        for (URI type : i.getTypes()) {
            list.add(NamedProperty(Sbol2Terms.Interaction.type, type));
        }
        List<NestedDocument<QName>> participantList = formatParticipations(i.getParticipations());
        for (NestedDocument<QName> n : participantList) {
            list.add(NamedProperty(Sbol2Terms.Interaction.hasParticipations, n));
        }
        properties.add(NamedProperty(Sbol2Terms.ModuleDefinition.hasInteractions, NestedDocument(Sbol2Terms.Interaction.Interaction, i.getIdentity(), NamedProperties(list))));
    }
}
Also used : StringifyQName(org.sbolstandard.core.io.json.StringifyQName) QName(javax.xml.namespace.QName) NamedProperty(org.sbolstandard.core.datatree.NamedProperty) NamedProperty(org.sbolstandard.core.datatree.Datatree.NamedProperty) ArrayList(java.util.ArrayList) URI(java.net.URI) NestedDocument(org.sbolstandard.core.datatree.NestedDocument) NestedDocument(org.sbolstandard.core.datatree.Datatree.NestedDocument)

Aggregations

URI (java.net.URI)3 ArrayList (java.util.ArrayList)3 NamedProperty (org.sbolstandard.core.datatree.Datatree.NamedProperty)3 NestedDocument (org.sbolstandard.core.datatree.Datatree.NestedDocument)3 NamedProperty (org.sbolstandard.core.datatree.NamedProperty)3 NestedDocument (org.sbolstandard.core.datatree.NestedDocument)3 QName (javax.xml.namespace.QName)2 StringifyQName (org.sbolstandard.core.io.json.StringifyQName)2