Package org.openbel.framework.common.model

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


        sglist.add(sg);
        final BELDocument beldoc = new BELDocument(dh, null, nsset, sglist);

        // 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.",
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
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
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
View Full Code Here

     * @return {@link Document}
     */
    private Document make_document(Header h, NamespaceGroup n, Statement... statements) {
        StatementGroup g = new StatementGroup();
        g.setStatements(Arrays.asList(statements));
        return new Document(h, Arrays.asList(g), n, null);
    }
View Full Code Here

        List<StatementGroup> statementGroups = new ArrayList<StatementGroup>();
        for (BELStatementGroup bsg : bd.getBelStatementGroups()) {
            statementGroups.add(sgc.convert(bsg));
        }

        return new Document(header, statementGroups, nsgroup, adlist);
    }
View Full Code Here

        }

        XBELHeader header = source.getHeader();
        HeaderConverter hConverter = new HeaderConverter();
        // Defer to HeaderConverter
        Document dest = new Document(hConverter.convert(header), stmtGroups);

        if (source.isSetAnnotationDefinitionGroup()) {
            XBELAnnotationDefinitionGroup adGroup =
                    source.getAnnotationDefinitionGroup();
            List<XBELInternalAnnotationDefinition> internals =
                    adGroup.getInternalAnnotationDefinition();
            List<XBELExternalAnnotationDefinition> externals =
                    adGroup.getExternalAnnotationDefinition();
            int size = internals.size() + externals.size();
            List<AnnotationDefinition> l2 = sizedArrayList(size);

            // Defer to converters
            InternalAnnotationDefinitionConverter iConverter =
                    new InternalAnnotationDefinitionConverter();
            for (final XBELInternalAnnotationDefinition iad : internals) {
                l2.add(iConverter.convert(iad));
            }
            ExternalAnnotationDefinitionConverter eConverter =
                    new ExternalAnnotationDefinitionConverter();
            for (final XBELExternalAnnotationDefinition ead : externals) {
                l2.add(eConverter.convert(ead));
            }
            dest.setDefinitions(l2);
        }

        if (source.isSetNamespaceGroup()) {
            XBELNamespaceGroup namespaceGroup = source.getNamespaceGroup();
            NamespaceGroupConverter ngConverter = new NamespaceGroupConverter();
            // Defer to DocumentHeaderConverter
            dest.setNamespaceGroup(ngConverter.convert(namespaceGroup));
        }

        // Resolve any property references to instances
        dest.resolveReferences();

        return dest;
    }
View Full Code Here

                phaseOutput("Compiling " + i + " of " + files.length
                        + " BEL Document(s)");
            }

            // validate document
            Document document = stage1(file);
            if (document == null) {
                if (pedantic) {
                    bail(VALIDATION_FAILURE);
                }
                continue;
View Full Code Here

                                err.getUserFacingMessage()));
                    }
                }
            }

            final Document bel =
                    new BELDocumentConverter().convert(result.getDocument());

            final org.openbel.framework.common.xbel.converters.DocumentConverter converter =
                    new org.openbel.framework.common.xbel.converters.DocumentConverter();
View Full Code Here

            }

            int numWarnings = 0;
            int numErrors = 0;

            final Document document;
            if (isXBEL(file)) {
                List<ValidationError> validationErrors = validator
                        .validateWithErrors(file);

                // if validation errors exist then report and fail document
View Full Code Here

TOP

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

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.