@Test(expected = SemanticWarning.class) public void testImproperListUsage() throws SemanticWarning { err.println("testImproperListUsage"); final Namespace meshd = new Namespace("MESHD", "http: "belframework/1.0/namespace/mesh-diseases.belns"); final Namespace go = new Namespace( "GO", "http: + "belframework/1.0/namespace/go-biological-processes-names.belns"); Term stmtSubject = new Term(FunctionEnum.PATHOLOGY, asBelObjs(new Parameter(meshd, "Atherosclerosis"))); Statement.Object stmtObject = new Statement.Object(new Term(FunctionEnum.LIST, asBelObjs( new Term(FunctionEnum.BIOLOGICAL_PROCESS, asBelObjs(new Parameter(go, "lipid oxidation"))), new Term(FunctionEnum.BIOLOGICAL_PROCESS, asBelObjs(new Parameter(go, "protein oxidation")))))); Statement s = new Statement(stmtSubject, null, null, stmtObject, RelationshipType.POSITIVE_CORRELATION); subject.checkListUsage(s, null); fail("expected semantic failure"); }
@Override public void checkListUsage(final Statement statement, final Document document) throws SemanticWarning { Object object = statement.getObject(); if (object != null && !statement.hasNestedStatement() && object.getTerm().getFunctionEnum() == FunctionEnum.LIST && !statement.getRelationshipType().isListable()) { if (document != null) { pruneStatement(statement, document); } final String err = SEMANTIC_LIST_IMPROPER_CONTEXT; final String name = statement.toBELShortForm(); throw new SemanticWarning(name, err, null); } }
SemanticServiceImpl implements SemanticService { @Override public void checkListUsage(final Statement statement, final Document document) throws SemanticWarning { Object object = statement.getObject(); if (object != null && !statement.hasNestedStatement() && object.getTerm().getFunctionEnum() == FunctionEnum.LIST && !statement.getRelationshipType().isListable()) { if (document != null) { pruneStatement(statement, document); } final String err = SEMANTIC_LIST_IMPROPER_CONTEXT; final String name = statement.toBELShortForm(); throw new SemanticWarning(name, err, null); } } }
SemanticServiceImpl implements SemanticService { @Override public void checkListUsage(final Statement statement, final Document document) throws SemanticWarning { Object object = statement.getObject(); if (object != null && !statement.hasNestedStatement() && object.getTerm().getFunctionEnum() == FunctionEnum.LIST && !statement.getRelationshipType().isListable()) { if (document != null) { pruneStatement(statement, document); } final String err = SEMANTIC_LIST_IMPROPER_CONTEXT; final String name = statement.toBELShortForm(); throw new SemanticWarning(name, err, null); } } SemanticServiceImpl(final NamespaceService nsService); }
SemanticServiceImpl implements SemanticService { @Override public void checkListUsage(final Statement statement, final Document document) throws SemanticWarning { Object object = statement.getObject(); if (object != null && !statement.hasNestedStatement() && object.getTerm().getFunctionEnum() == FunctionEnum.LIST && !statement.getRelationshipType().isListable()) { if (document != null) { pruneStatement(statement, document); } final String err = SEMANTIC_LIST_IMPROPER_CONTEXT; final String name = statement.toBELShortForm(); throw new SemanticWarning(name, err, null); } } SemanticServiceImpl(final NamespaceService nsService); @Override void checkParameterizedTerm(final Term term); @Override void checkTerm(final Term term); @Override void checkRelationship(final Statement statement); @Override void checkListUsage(final Statement statement,
            final Document document); @Override void checkNested(final Statement statement); @Override void checkMultiNested(final Statement stmt, final Document doc); @Override List<SemanticWarning> checkAbundanceSubsets(final Term term); }
SemanticServiceImpl implements SemanticService { @Override public void checkListUsage(final Statement statement, final Document document) throws SemanticWarning { Object object = statement.getObject(); if (object != null && !statement.hasNestedStatement() && object.getTerm().getFunctionEnum() == FunctionEnum.LIST && !statement.getRelationshipType().isListable()) { if (document != null) { pruneStatement(statement, document); } final String err = SEMANTIC_LIST_IMPROPER_CONTEXT; final String name = statement.toBELShortForm(); throw new SemanticWarning(name, err, null); } } SemanticServiceImpl(final NamespaceService nsService); @Override void checkParameterizedTerm(final Term term); @Override void checkTerm(final Term term); @Override void checkRelationship(final Statement statement); @Override void checkListUsage(final Statement statement,
            final Document document); @Override void checkNested(final Statement statement); @Override void checkMultiNested(final Statement stmt, final Document doc); @Override List<SemanticWarning> checkAbundanceSubsets(final Term term);  }