Package org.openbel.framework.common.model

Examples of org.openbel.framework.common.model.NamespaceGroup


        // convert to common model
        final BELDocumentConverter converter = new BELDocumentConverter();
        final Document doc = converter.convert(beldoc);

        // validate namespace group
        final NamespaceGroup nsgroup = doc.getNamespaceGroup();
        assertThat("More than one custom namespace exists.", nsgroup
                .getNamespaces().size(), is(1));
        assertThat("The custom namespace does not match.", nsgroup
                .getNamespaces().get(0).getResourceLocation(), is(NS));
        assertThat("The default namespace does not match.",
                nsgroup.getDefaultResourceLocation(), is(DEFAULT_NS));
    }
View Full Code Here


     * Tests that statement triples in two {@link Document documents} will
     * produce the same merged result regardless of document sequence.
     */
    public void commutative_simple() {
        Document a = make_document(new Header("Doc 1", "Doc 1", "1.0"),
                new NamespaceGroup(URL, null),
                parse("g(AKT2) -> r(AKT3)"),
                parse("p(AKT1) => complex(p(DUSP1), p(WRN))"));
        Document b = make_document(new Header("Doc 2", "Doc 2", "1.0"),
                new NamespaceGroup(URL, null),
                parse("m(AKT1) =| p(AKT2)"),
                parse("cat(g(AKT2)) -| p(PARP1)"));

        // merge in different orders
        ProtoNetwork ab = merge(a, b);
View Full Code Here

     * Tests that subject-only statements in two {@link Document documents}
     * will produce the same merged result regardless of document sequence.
     */
    public void commutative_subject_only() {
        Document a = make_document(new Header("Doc 1", "Doc 1", "1.0"),
                new NamespaceGroup(URL, null),
                parse("r(AKT3)"),
                parse("p(AKT1)"));
        Document b = make_document(new Header("Doc 2", "Doc 2", "1.0"),
                new NamespaceGroup(URL, null),
                parse("m(AKT1)"),
                parse("g(AKT2)"));

        // merge in different orders
        ProtoNetwork ab = merge(a, b);
View Full Code Here

     * Tests that nested statements in two {@link Document documents} will
     * produce the same merged result regardless of document sequence.
     */
    public void commutative_nested() {
        Document a = make_document(new Header("Doc 1", "Doc 1", "1.0"),
                new NamespaceGroup(URL, null),
                parse("r(AKT3) => (g(PARP1) -| cat(p(AKT2)))"),
                parse("p(AKT1) -> (kin(p(PARP1)) -| p(AKT3))"));
        Document b = make_document(new Header("Doc 2", "Doc 2", "1.0"),
                new NamespaceGroup(URL, null),
                parse("m(AKT1) => (g(PARP1) -| p(AKT2))"),
                parse("g(AKT2) -> (r(AKT1) => p(PARP1))"));

        // merge in different orders
        ProtoNetwork ab = merge(a, b);
View Full Code Here

            }
        }

        // handle namespace definitions
        Set<BELNamespaceDefinition> bndlist = bd.getNamespaceDefinitions();
        NamespaceGroup nsgroup = null;
        if (bndlist != null) {
            nsgroup = new NamespaceGroup();
            if (hasItems(bndlist)) {
                List<Namespace> nslist = new ArrayList<Namespace>();
                for (BELNamespaceDefinition bnd : bndlist) {
                    // handle namespace default on the namespace group
                    if (bnd.isNsDefault()) {
                        nsgroup.setDefaultResourceLocation(bnd
                                .getResourceLocation());
                    } else {
                        nslist.add(bndc.convert(bnd));
                    }
                }
                nsgroup.setNamespaces(nslist);
            }
        }

        // handle statements
        final BELStatementGroupConverter sgc = new BELStatementGroupConverter(
View Full Code Here

        Header header = source.getHeader();
        HeaderConverter hConverter = new HeaderConverter();
        // Defer to HeaderConverter
        xd.setHeader(hConverter.convert(header));

        NamespaceGroup nsGroup = source.getNamespaceGroup();
        if (nsGroup != null) {
            NamespaceGroupConverter ngConverter = new NamespaceGroupConverter();
            // Defer to NamespaceGroupConverter
            xd.setNamespaceGroup(ngConverter.convert(nsGroup));
        }
View Full Code Here

        if (source == null) return null;

        String defaultResourceLocation = source.getDefaultResourceLocation();
        List<XBELNamespace> xbelnamespaces = source.getNamespace();

        NamespaceGroup dest = new NamespaceGroup();
        int size = xbelnamespaces.size();
        final List<Namespace> namespaces = new ArrayList<Namespace>(size);

        NamespaceConverter nsConverter = new NamespaceConverter();
        for (final XBELNamespace xns : xbelnamespaces) {
            // Defer to NamespaceConverter
            namespaces.add(nsConverter.convert(xns));
        }

        dest.setDefaultResourceLocation(defaultResourceLocation);
        dest.setNamespaces(namespaces);
        return dest;
    }
View Full Code Here

TOP

Related Classes of org.openbel.framework.common.model.NamespaceGroup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.