@Test public void testProperListUsage() { err.println("testProperListUsage"); final Namespace pfh = new Namespace( "PFH", "http: + "belframework/1.0/namespace/selventa-named-human-protein-families.belns"); final Namespace hgnc = new Namespace( "HGNC", "http: + "belframework/1.0/namespace/hgnc-approved-symbols.belns"); final Namespace nch = new Namespace( "NCH", "http: + "belframework/1.0/namespace/selventa-named-human-complexes.belns"); Term subject1 = new Term(FunctionEnum.PROTEIN_ABUNDANCE, asBelObjs(new Parameter(pfh, "RAF Family"))); Statement.Object object1 = new Statement.Object(new Term(FunctionEnum.LIST, asBelObjs( new Term(FunctionEnum.PROTEIN_ABUNDANCE, asBelObjs(new Parameter(hgnc, "ARAF"))), new Term(FunctionEnum.PROTEIN_ABUNDANCE, asBelObjs(new Parameter(hgnc, "BRAF"))), new Term(FunctionEnum.PROTEIN_ABUNDANCE, asBelObjs(new Parameter(hgnc, "RAF1"))) ))); Statement s1 = new Statement(subject1, null, null, object1, RelationshipType.HAS_MEMBERS); Term subject2 = new Term(FunctionEnum.COMPLEX_ABUNDANCE, asBelObjs(new Parameter(nch, "NADPH Oxidase Complex"))); Statement.Object object2 = new Statement.Object(new Term(FunctionEnum.LIST, asBelObjs( new Term(FunctionEnum.PROTEIN_ABUNDANCE, asBelObjs(new Parameter(hgnc, "NCF1"))), new Term(FunctionEnum.PROTEIN_ABUNDANCE, asBelObjs(new Parameter(hgnc, "CYBB")))))); Statement s2 = new Statement(subject2, null, null, object2, RelationshipType.HAS_COMPONENTS); try { subject.checkListUsage(s1, null); subject.checkListUsage(s2, null); } catch (SemanticWarning se) { fail("unexpected semantic failure: " + se.getUserFacingMessage()); } }
@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);  }