Skip to content

Commit 74ec67f

Browse files
Set version 4.0.0 and fixed javadoc, updated JAXB plugin, generated xml schema, etc.
1 parent c5a7251 commit 74ec67f

30 files changed

Lines changed: 735 additions & 823 deletions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ target
88
.springBeans
99
geo_data
1010
.extract
11+
*.versionsBackup
12+

biopax-validator-client/pom.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.biopax.validator</groupId>
66
<artifactId>parent</artifactId>
7-
<version>4.0.0-SNAPSHOT</version>
7+
<version>4.0.0</version>
88
</parent>
99

1010
<artifactId>biopax-validator-client</artifactId>
@@ -45,8 +45,9 @@
4545
<clearOutputDir>false</clearOutputDir>
4646
<packageName>org.biopax.validator.jaxb</packageName>
4747
<failOnNoSchemas>true</failOnNoSchemas>
48-
<schemaDirectory>${basedir}/src/main/resources</schemaDirectory>
49-
<!-- <arguments>-enableIntrospection</arguments> -->
48+
<sources>
49+
<source>src/main/resources/validator-response-2.0.xsd</source>
50+
</sources>
5051
</configuration>
5152
</plugin>
5253
<plugin>

biopax-validator-client/src/main/resources/validator-response-2.0.xsd

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,19 @@
1-
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
1+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
22

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

5-
<xs:complexType name="Validation">
5+
<xs:complexType name="ErrorCaseType">
66
<xs:sequence>
7-
<xs:element name="modelData" type="xs:string" minOccurs="0"/>
8-
<xs:element name="error" type="ErrorType" minOccurs="0" maxOccurs="unbounded"/>
9-
<xs:element name="comment" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
7+
<xs:element minOccurs="0" name="message" type="xs:string"/>
108
</xs:sequence>
11-
<xs:attribute name="description" type="xs:string"/>
12-
<xs:attribute name="notFixedProblems" type="xs:int" use="required"/>
13-
<xs:attribute name="notFixedErrors" type="xs:int" use="required"/>
14-
<xs:attribute name="totalProblemsFound" type="xs:int" use="required"/>
15-
<xs:attribute name="fix" type="xs:boolean" use="required"/>
16-
<xs:attribute name="threshold" type="Behavior"/>
17-
<xs:attribute name="maxErrors" type="xs:int" use="required"/>
18-
<xs:attribute name="profile" type="xs:string"/>
19-
<xs:attribute name="summary" type="xs:string"/>
9+
<xs:attribute name="object" type="xs:string"/>
10+
<xs:attribute name="reportedBy" type="xs:string"/>
11+
<xs:attribute name="fixed" type="xs:boolean" use="required"/>
2012
</xs:complexType>
2113

2214
<xs:complexType name="ErrorType">
2315
<xs:sequence>
24-
<xs:element name="errorCase" type="ErrorCaseType" minOccurs="0" maxOccurs="unbounded"/>
16+
<xs:element maxOccurs="unbounded" minOccurs="0" name="errorCase" type="ErrorCaseType"/>
2517
</xs:sequence>
2618
<xs:attribute name="code" type="xs:string"/>
2719
<xs:attribute name="message" type="xs:string"/>
@@ -31,22 +23,36 @@
3123
<xs:attribute name="totalCases" type="xs:int" use="required"/>
3224
</xs:complexType>
3325

34-
<xs:complexType name="ErrorCaseType">
26+
<xs:complexType name="Validation">
3527
<xs:sequence>
36-
<xs:element name="message" type="xs:string" minOccurs="0"/>
28+
<xs:element minOccurs="0" name="modelData" type="xs:string"/>
29+
<xs:element maxOccurs="unbounded" minOccurs="0" name="error" type="ErrorType"/>
30+
<xs:element maxOccurs="unbounded" minOccurs="0" name="comment" type="xs:string"/>
3731
</xs:sequence>
38-
<xs:attribute name="object" type="xs:string"/>
39-
<xs:attribute name="reportedBy" type="xs:string"/>
40-
<xs:attribute name="fixed" type="xs:boolean" use="required"/>
32+
<xs:attribute name="description" type="xs:string"/>
33+
<xs:attribute name="notFixedProblems" type="xs:int" use="required"/>
34+
<xs:attribute name="notFixedErrors" type="xs:int" use="required"/>
35+
<xs:attribute name="totalProblemsFound" type="xs:int" use="required"/>
36+
<xs:attribute name="fix" type="xs:boolean" use="required"/>
37+
<xs:attribute name="threshold" type="Behavior"/>
38+
<xs:attribute name="maxErrors" type="xs:int" use="required"/>
39+
<xs:attribute name="profile" type="xs:string"/>
40+
<xs:attribute name="summary" type="xs:string"/>
4141
</xs:complexType>
4242

4343
<xs:complexType name="ValidatorResponse">
4444
<xs:sequence>
45-
<xs:element name="validation" type="Validation" minOccurs="0" maxOccurs="unbounded"/>
45+
<xs:element maxOccurs="unbounded" minOccurs="0" name="validation" type="Validation"/>
4646
</xs:sequence>
4747
</xs:complexType>
4848

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

5763
<xs:simpleType name="Category">
64+
<xs:annotation>
65+
<xs:documentation><![CDATA[Validation error category.]]></xs:documentation>
66+
</xs:annotation>
5867
<xs:restriction base="xs:string">
5968
<xs:enumeration value="SYNTAX"/>
6069
<xs:enumeration value="SPECIFICATION"/>
@@ -63,4 +72,3 @@
6372
</xs:restriction>
6473
</xs:simpleType>
6574
</xs:schema>
66-

biopax-validator-web/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<parent>
33
<artifactId>parent</artifactId>
44
<groupId>org.biopax.validator</groupId>
5-
<version>4.0.0-SNAPSHOT</version>
5+
<version>4.0.0</version>
66
</parent>
77

88
<modelVersion>4.0.0</modelVersion>

biopax-validator/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<parent>
33
<artifactId>parent</artifactId>
44
<groupId>org.biopax.validator</groupId>
5-
<version>4.0.0-SNAPSHOT</version>
5+
<version>4.0.0</version>
66
</parent>
77

88
<modelVersion>4.0.0</modelVersion>
Lines changed: 118 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
package org.biopax.validator.impl;
22

3-
import java.util.*;
4-
5-
import javax.annotation.PostConstruct;
6-
73
import org.biopax.paxtools.controller.PropertyEditor;
84
import org.biopax.paxtools.model.BioPAXElement;
95
import org.biopax.validator.api.AbstractRule;
@@ -12,124 +8,129 @@
128
import org.biopax.validator.api.CvValidator;
139
import org.springframework.beans.factory.annotation.Autowired;
1410

11+
import javax.annotation.PostConstruct;
12+
import java.util.HashSet;
13+
import java.util.Set;
14+
1515
/**
1616
* An abstract class for CV terms checks.
17-
*
18-
* @author rodche
1917
*
2018
* @param <D> property domain
19+
* @author rodche
2120
*/
2221
public abstract class AbstractCvRule<D extends BioPAXElement> extends AbstractRule<D> implements CvRule<D> {
23-
24-
@Autowired
25-
protected CvValidator ontologyManager;
26-
27-
protected final Class<D> domain;
28-
protected final String property; // helps validate generic ControlledVocabulary instances
29-
protected final Set<CvRestriction> restrictions;
30-
private Set<String> validTerms;
31-
protected PropertyEditor<? super D, ?> editor;
32-
33-
/**
34-
* Constructor.
35-
*
36-
* @param domain a BioPAX class for which the CV terms restrictions apply
37-
* @param property the name of the BioPAX property to get controlled vocabularies or null
38-
* @param restrictions a list of beans, each defining names (a subtree of an ontology) that
39-
* is either to include or exclude (when 'not' flag is set) from the valid names set.
40-
*/
41-
public AbstractCvRule(Class<D> domain, String property, CvRestriction... restrictions)
42-
{
43-
this.domain = domain;
44-
this.property = property;
45-
this.restrictions = new HashSet<CvRestriction>(restrictions.length);
46-
for(CvRestriction c: restrictions) {
47-
this.restrictions.add(c);
48-
}
22+
23+
@Autowired
24+
protected CvValidator ontologyManager;
25+
26+
protected final Class<D> domain;
27+
protected final String property; // helps validate generic ControlledVocabulary instances
28+
protected final Set<CvRestriction> restrictions;
29+
private Set<String> validTerms;
30+
protected PropertyEditor<? super D, ?> editor;
31+
32+
/**
33+
* Constructor.
34+
*
35+
* @param domain a BioPAX class for which the CV terms restrictions apply
36+
* @param property the name of the BioPAX property to get controlled vocabularies or null
37+
* @param restrictions a list of beans, each defining names (a subtree of an ontology) that
38+
* is either to include or exclude (when 'not' flag is set) from the valid names set.
39+
*/
40+
public AbstractCvRule(Class<D> domain, String property, CvRestriction... restrictions) {
41+
this.domain = domain;
42+
this.property = property;
43+
this.restrictions = new HashSet<CvRestriction>(restrictions.length);
44+
for (CvRestriction c : restrictions) {
45+
this.restrictions.add(c);
46+
}
47+
}
48+
49+
@PostConstruct
50+
public void init() {
51+
if (ontologyManager != null) {
52+
setValidTerms(ontologyManager.getValidTermNames(this));
53+
} else {
54+
throw new IllegalStateException("ontologyManager is NULL!");
4955
}
50-
51-
@PostConstruct
52-
public void init() {
53-
if(ontologyManager != null) {
54-
setValidTerms(ontologyManager.getValidTermNames(this));
55-
} else {
56-
throw new IllegalStateException("ontologyManager is NULL!");
57-
}
58-
};
59-
60-
61-
public boolean canCheck(Object thing) {
62-
return domain.isInstance(thing);
63-
}
64-
65-
/* (non-Javadoc)
66-
* @see org.biopax.validator.impl.CvRule#getValidTerms()
67-
*/
68-
public Set<String> getValidTerms() {
69-
return validTerms;
70-
}
71-
72-
/* (non-Javadoc)
73-
* @see org.biopax.validator.impl.CvRule#setValidTerms(java.util.Set)
74-
*/
75-
public void setValidTerms(Set<String> validTerms) {
76-
this.validTerms = validTerms;
77-
}
78-
79-
// for unit testing
80-
81-
/* (non-Javadoc)
82-
* @see org.biopax.validator.impl.CvRule#getRestrictions()
83-
*/
84-
public Set<CvRestriction> getRestrictions() {
85-
return restrictions;
86-
}
87-
88-
/* (non-Javadoc)
89-
* @see org.biopax.validator.impl.CvRule#getDomain()
90-
*/
91-
public Class<D> getDomain() {
92-
return domain;
93-
}
94-
95-
/* (non-Javadoc)
96-
* @see org.biopax.validator.impl.CvRule#getProperty()
97-
*/
98-
public String getProperty() {
99-
return property;
100-
}
101-
102-
/**
103-
* Gets the internal BiopaxOntologyManager instance
104-
* @return
105-
*/
106-
public CvValidator getBiopaxOntologyManager() {
107-
return ontologyManager;
108-
}
109-
110-
/**
111-
* Gets the corresponding CV property editor.
112-
* Returns null if either the 'domain' itself is of CV type
113-
* or the 'property' is null.
114-
*
115-
* @return
116-
*/
117-
public PropertyEditor<? super D, ?> getEditor() {
118-
return editor;
119-
}
120-
121-
/**
122-
* OntologyAccess IDs used to check this CV rule.
123-
* These can be extracted from the CV rescrictions
124-
* used to define the rule.
125-
* (other ontologies are not used).
126-
*
127-
* @return
128-
*/
129-
protected Set<String> getOntologyIDs() {
130-
Set<String> ids = new HashSet<String>();
131-
for(CvRestriction restriction : restrictions)
132-
ids.add(restriction.getOntologyId());
133-
return ids;
134-
}
56+
}
57+
58+
;
59+
60+
61+
public boolean canCheck(Object thing) {
62+
return domain.isInstance(thing);
63+
}
64+
65+
/* (non-Javadoc)
66+
* @see org.biopax.validator.impl.CvRule#getValidTerms()
67+
*/
68+
public Set<String> getValidTerms() {
69+
return validTerms;
70+
}
71+
72+
/* (non-Javadoc)
73+
* @see org.biopax.validator.impl.CvRule#setValidTerms(java.util.Set)
74+
*/
75+
public void setValidTerms(Set<String> validTerms) {
76+
this.validTerms = validTerms;
77+
}
78+
79+
// for unit testing
80+
81+
/* (non-Javadoc)
82+
* @see org.biopax.validator.impl.CvRule#getRestrictions()
83+
*/
84+
public Set<CvRestriction> getRestrictions() {
85+
return restrictions;
86+
}
87+
88+
/* (non-Javadoc)
89+
* @see org.biopax.validator.impl.CvRule#getDomain()
90+
*/
91+
public Class<D> getDomain() {
92+
return domain;
93+
}
94+
95+
/* (non-Javadoc)
96+
* @see org.biopax.validator.impl.CvRule#getProperty()
97+
*/
98+
public String getProperty() {
99+
return property;
100+
}
101+
102+
/**
103+
* Gets the internal BiopaxOntologyManager instance
104+
*
105+
* @return ontology manager
106+
*/
107+
public CvValidator getBiopaxOntologyManager() {
108+
return ontologyManager;
109+
}
110+
111+
/**
112+
* Gets the corresponding CV property editor.
113+
* Returns null if either the 'domain' itself is of CV type
114+
* or the 'property' is null.
115+
*
116+
* @return biopax property editor
117+
*/
118+
public PropertyEditor<? super D, ?> getEditor() {
119+
return editor;
120+
}
121+
122+
/**
123+
* OntologyAccess IDs used to check this CV rule.
124+
* These can be extracted from the CV restrictions
125+
* used to define the rule.
126+
* (other ontologies are not used).
127+
*
128+
* @return ontology IDs, such as e.g. 'MI', 'GO'
129+
*/
130+
protected Set<String> getOntologyIDs() {
131+
Set<String> ids = new HashSet<String>();
132+
for (CvRestriction restriction : restrictions)
133+
ids.add(restriction.getOntologyId());
134+
return ids;
135+
}
135136
}

0 commit comments

Comments
 (0)