Skip to content

Commit

Permalink
Set version 4.0.0 and fixed javadoc, updated JAXB plugin, generated x…
Browse files Browse the repository at this point in the history
…ml schema, etc.
  • Loading branch information
IgorRodchenkov committed Sep 14, 2018
1 parent c5a7251 commit 74ec67f
Show file tree
Hide file tree
Showing 30 changed files with 735 additions and 823 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ target
.springBeans
geo_data
.extract
*.versionsBackup

7 changes: 4 additions & 3 deletions biopax-validator-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.biopax.validator</groupId>
<artifactId>parent</artifactId>
<version>4.0.0-SNAPSHOT</version>
<version>4.0.0</version>
</parent>

<artifactId>biopax-validator-client</artifactId>
Expand Down Expand Up @@ -45,8 +45,9 @@
<clearOutputDir>false</clearOutputDir>
<packageName>org.biopax.validator.jaxb</packageName>
<failOnNoSchemas>true</failOnNoSchemas>
<schemaDirectory>${basedir}/src/main/resources</schemaDirectory>
<!-- <arguments>-enableIntrospection</arguments> -->
<sources>
<source>src/main/resources/validator-response-2.0.xsd</source>
</sources>
</configuration>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">

<xs:element name="validatorResponse" type="ValidatorResponse"/>

<xs:complexType name="Validation">
<xs:complexType name="ErrorCaseType">
<xs:sequence>
<xs:element name="modelData" type="xs:string" minOccurs="0"/>
<xs:element name="error" type="ErrorType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="comment" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element minOccurs="0" name="message" type="xs:string"/>
</xs:sequence>
<xs:attribute name="description" type="xs:string"/>
<xs:attribute name="notFixedProblems" type="xs:int" use="required"/>
<xs:attribute name="notFixedErrors" type="xs:int" use="required"/>
<xs:attribute name="totalProblemsFound" type="xs:int" use="required"/>
<xs:attribute name="fix" type="xs:boolean" use="required"/>
<xs:attribute name="threshold" type="Behavior"/>
<xs:attribute name="maxErrors" type="xs:int" use="required"/>
<xs:attribute name="profile" type="xs:string"/>
<xs:attribute name="summary" type="xs:string"/>
<xs:attribute name="object" type="xs:string"/>
<xs:attribute name="reportedBy" type="xs:string"/>
<xs:attribute name="fixed" type="xs:boolean" use="required"/>
</xs:complexType>

<xs:complexType name="ErrorType">
<xs:sequence>
<xs:element name="errorCase" type="ErrorCaseType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="errorCase" type="ErrorCaseType"/>
</xs:sequence>
<xs:attribute name="code" type="xs:string"/>
<xs:attribute name="message" type="xs:string"/>
Expand All @@ -31,22 +23,36 @@
<xs:attribute name="totalCases" type="xs:int" use="required"/>
</xs:complexType>

<xs:complexType name="ErrorCaseType">
<xs:complexType name="Validation">
<xs:sequence>
<xs:element name="message" type="xs:string" minOccurs="0"/>
<xs:element minOccurs="0" name="modelData" type="xs:string"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="error" type="ErrorType"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="comment" type="xs:string"/>
</xs:sequence>
<xs:attribute name="object" type="xs:string"/>
<xs:attribute name="reportedBy" type="xs:string"/>
<xs:attribute name="fixed" type="xs:boolean" use="required"/>
<xs:attribute name="description" type="xs:string"/>
<xs:attribute name="notFixedProblems" type="xs:int" use="required"/>
<xs:attribute name="notFixedErrors" type="xs:int" use="required"/>
<xs:attribute name="totalProblemsFound" type="xs:int" use="required"/>
<xs:attribute name="fix" type="xs:boolean" use="required"/>
<xs:attribute name="threshold" type="Behavior"/>
<xs:attribute name="maxErrors" type="xs:int" use="required"/>
<xs:attribute name="profile" type="xs:string"/>
<xs:attribute name="summary" type="xs:string"/>
</xs:complexType>

<xs:complexType name="ValidatorResponse">
<xs:sequence>
<xs:element name="validation" type="Validation" minOccurs="0" maxOccurs="unbounded"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="validation" type="Validation"/>
</xs:sequence>
</xs:complexType>

<xs:simpleType name="Behavior">
<xs:annotation>
<xs:documentation><![CDATA[Validation rule behavior:
IGNORE -- skip: do not validate, nor report any messages;
ERROR -- report as error, fail if error limit is exceeded;
WARNING -- report as warning.]]></xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="IGNORE"/>
<xs:enumeration value="WARNING"/>
Expand All @@ -55,6 +61,9 @@
</xs:simpleType>

<xs:simpleType name="Category">
<xs:annotation>
<xs:documentation><![CDATA[Validation error category.]]></xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="SYNTAX"/>
<xs:enumeration value="SPECIFICATION"/>
Expand All @@ -63,4 +72,3 @@
</xs:restriction>
</xs:simpleType>
</xs:schema>

2 changes: 1 addition & 1 deletion biopax-validator-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<artifactId>parent</artifactId>
<groupId>org.biopax.validator</groupId>
<version>4.0.0-SNAPSHOT</version>
<version>4.0.0</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion biopax-validator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<artifactId>parent</artifactId>
<groupId>org.biopax.validator</groupId>
<version>4.0.0-SNAPSHOT</version>
<version>4.0.0</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package org.biopax.validator.impl;

import java.util.*;

import javax.annotation.PostConstruct;

import org.biopax.paxtools.controller.PropertyEditor;
import org.biopax.paxtools.model.BioPAXElement;
import org.biopax.validator.api.AbstractRule;
Expand All @@ -12,124 +8,129 @@
import org.biopax.validator.api.CvValidator;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PostConstruct;
import java.util.HashSet;
import java.util.Set;

/**
* An abstract class for CV terms checks.
*
* @author rodche
*
* @param <D> property domain
* @author rodche
*/
public abstract class AbstractCvRule<D extends BioPAXElement> extends AbstractRule<D> implements CvRule<D> {

@Autowired
protected CvValidator ontologyManager;

protected final Class<D> domain;
protected final String property; // helps validate generic ControlledVocabulary instances
protected final Set<CvRestriction> restrictions;
private Set<String> validTerms;
protected PropertyEditor<? super D, ?> editor;

/**
* Constructor.
*
* @param domain a BioPAX class for which the CV terms restrictions apply
* @param property the name of the BioPAX property to get controlled vocabularies or null
* @param restrictions a list of beans, each defining names (a subtree of an ontology) that
* is either to include or exclude (when 'not' flag is set) from the valid names set.
*/
public AbstractCvRule(Class<D> domain, String property, CvRestriction... restrictions)
{
this.domain = domain;
this.property = property;
this.restrictions = new HashSet<CvRestriction>(restrictions.length);
for(CvRestriction c: restrictions) {
this.restrictions.add(c);
}

@Autowired
protected CvValidator ontologyManager;

protected final Class<D> domain;
protected final String property; // helps validate generic ControlledVocabulary instances
protected final Set<CvRestriction> restrictions;
private Set<String> validTerms;
protected PropertyEditor<? super D, ?> editor;

/**
* Constructor.
*
* @param domain a BioPAX class for which the CV terms restrictions apply
* @param property the name of the BioPAX property to get controlled vocabularies or null
* @param restrictions a list of beans, each defining names (a subtree of an ontology) that
* is either to include or exclude (when 'not' flag is set) from the valid names set.
*/
public AbstractCvRule(Class<D> domain, String property, CvRestriction... restrictions) {
this.domain = domain;
this.property = property;
this.restrictions = new HashSet<CvRestriction>(restrictions.length);
for (CvRestriction c : restrictions) {
this.restrictions.add(c);
}
}

@PostConstruct
public void init() {
if (ontologyManager != null) {
setValidTerms(ontologyManager.getValidTermNames(this));
} else {
throw new IllegalStateException("ontologyManager is NULL!");
}

@PostConstruct
public void init() {
if(ontologyManager != null) {
setValidTerms(ontologyManager.getValidTermNames(this));
} else {
throw new IllegalStateException("ontologyManager is NULL!");
}
};


public boolean canCheck(Object thing) {
return domain.isInstance(thing);
}

/* (non-Javadoc)
* @see org.biopax.validator.impl.CvRule#getValidTerms()
*/
public Set<String> getValidTerms() {
return validTerms;
}

/* (non-Javadoc)
* @see org.biopax.validator.impl.CvRule#setValidTerms(java.util.Set)
*/
public void setValidTerms(Set<String> validTerms) {
this.validTerms = validTerms;
}

// for unit testing

/* (non-Javadoc)
* @see org.biopax.validator.impl.CvRule#getRestrictions()
*/
public Set<CvRestriction> getRestrictions() {
return restrictions;
}

/* (non-Javadoc)
* @see org.biopax.validator.impl.CvRule#getDomain()
*/
public Class<D> getDomain() {
return domain;
}

/* (non-Javadoc)
* @see org.biopax.validator.impl.CvRule#getProperty()
*/
public String getProperty() {
return property;
}

/**
* Gets the internal BiopaxOntologyManager instance
* @return
*/
public CvValidator getBiopaxOntologyManager() {
return ontologyManager;
}

/**
* Gets the corresponding CV property editor.
* Returns null if either the 'domain' itself is of CV type
* or the 'property' is null.
*
* @return
*/
public PropertyEditor<? super D, ?> getEditor() {
return editor;
}

/**
* OntologyAccess IDs used to check this CV rule.
* These can be extracted from the CV rescrictions
* used to define the rule.
* (other ontologies are not used).
*
* @return
*/
protected Set<String> getOntologyIDs() {
Set<String> ids = new HashSet<String>();
for(CvRestriction restriction : restrictions)
ids.add(restriction.getOntologyId());
return ids;
}
}

;


public boolean canCheck(Object thing) {
return domain.isInstance(thing);
}

/* (non-Javadoc)
* @see org.biopax.validator.impl.CvRule#getValidTerms()
*/
public Set<String> getValidTerms() {
return validTerms;
}

/* (non-Javadoc)
* @see org.biopax.validator.impl.CvRule#setValidTerms(java.util.Set)
*/
public void setValidTerms(Set<String> validTerms) {
this.validTerms = validTerms;
}

// for unit testing

/* (non-Javadoc)
* @see org.biopax.validator.impl.CvRule#getRestrictions()
*/
public Set<CvRestriction> getRestrictions() {
return restrictions;
}

/* (non-Javadoc)
* @see org.biopax.validator.impl.CvRule#getDomain()
*/
public Class<D> getDomain() {
return domain;
}

/* (non-Javadoc)
* @see org.biopax.validator.impl.CvRule#getProperty()
*/
public String getProperty() {
return property;
}

/**
* Gets the internal BiopaxOntologyManager instance
*
* @return ontology manager
*/
public CvValidator getBiopaxOntologyManager() {
return ontologyManager;
}

/**
* Gets the corresponding CV property editor.
* Returns null if either the 'domain' itself is of CV type
* or the 'property' is null.
*
* @return biopax property editor
*/
public PropertyEditor<? super D, ?> getEditor() {
return editor;
}

/**
* OntologyAccess IDs used to check this CV rule.
* These can be extracted from the CV restrictions
* used to define the rule.
* (other ontologies are not used).
*
* @return ontology IDs, such as e.g. 'MI', 'GO'
*/
protected Set<String> getOntologyIDs() {
Set<String> ids = new HashSet<String>();
for (CvRestriction restriction : restrictions)
ids.add(restriction.getOntologyId());
return ids;
}
}
Loading

0 comments on commit 74ec67f

Please sign in to comment.