Skip to content

Commit 1a56546

Browse files
Merge pull request #30 from BioPAX/using-paxtools6
Validator v6 using paxtools v6
2 parents fa1ca8e + 59e440d commit 1a56546

File tree

57 files changed

+753
-25994
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+753
-25994
lines changed

.github/workflows/maven.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ jobs:
2020
- uses: actions/checkout@v3
2121
- uses: actions/setup-java@v3
2222
with:
23-
java-version: 17
23+
java-version: 20
2424
distribution: 'temurin'
2525
cache: maven
26-
- name: Build with Maven and JDK-17
26+
- name: Build with Maven (JDK-20)
2727
run: mvn --batch-mode --update-snapshots package

README.md

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
The BioPAX Validator is a command line tool, Java library, and online
1313
web service for BioPAX formatted pathway data validation. The validator
1414
checks for more than a hundred BioPAX Level3 rules and best practices,
15-
provides human readable reports and can automatically fix some common
15+
provides human-readable reports and can automatically fix some common
1616
mistakes in data (can also process Level1 and Level2 data, which are
1717
first auto-converted to the Level3, and then Level3 rules apply).
1818
The validator is in use by the BioPAX community and is continuously being
@@ -27,7 +27,17 @@ pathway databases and tools that support BioPAX.
2727

2828
## Usage
2929

30-
Download and expand the latest ZIP distribution from <http://www.biopax.org/downloads/validator/>.
30+
Download and expand the latest ZIP distribution from <http://www.biopax.org/downloads/validator/>
31+
32+
Or build it from the sources:
33+
34+
```
35+
mvn clean install
36+
cd dist
37+
mvn assembly:assembly
38+
```
39+
40+
then use the resulting `biopax-validator-${version}-all.zip` (move somewhere, expand)
3141

3242
### Console (batch)
3343

@@ -71,14 +81,11 @@ Use --help parameter to see all the server options (e.g., httpPort, ajpPort)
7181

7282
## Developer notes
7383

74-
It's built with Java ${java.version} (requires 8 or above), Paxtools ${paxtools.version} (BioPAX Model API, Java library),
75-
Spring Framework ${spring.version}, OXM, @AspectJ, AOP, LTW, etc. Validation _Rules_ are java
76-
objects that implement _Rule<E>_ interface, extend _AbstractRule<E>_, where _E_
77-
is usually either a BioPAX class or _Model_. Controlled vocabulary rules
78-
extend _AbstractCvRule_ and use _CvRestriction_ and OBO Ontology Manager
79-
(based on PSIDEV EBI sources) to lookup for valid ontology terms and synonyms.
80-
Rules may call other rules, but usually it is not recommended, for they are
81-
better keep simple and independent.
84+
Validation _Rules_ are java objects that implement _Rule<E>_ interface and
85+
extend _AbstractRule<E>_, where _<E>_ is usually either a BioPAX class or _Model_.
86+
Controlled vocabulary rules extend _AbstractCvRule_ and use _CvRestriction_ and
87+
OBO Ontology Manager (derived from PSIDEV EBI code) to lookup for valid ontology terms and synonyms.
88+
Validation Rules can call other Rules, but this is not recommended (better keep it simple, independent).
8289

8390
_Post-model_ validation mode is to check
8491
all the rules/objects after the BioPAX model is built (created in memory or
@@ -92,8 +99,8 @@ BioPAX error types, levels, categories, messages, cases are reported.
9299
Spring AOP, MessageSource, resource bundles, and OXM help collect the errors,
93100
translate to human-readable messages and write the validation report (xml or html).
94101
Settings such as _behavior_ (level), error code, category and message templates
95-
are configured via the resource bundles: rules.properties, codes.properties and
96-
profiles.properties (e.g., /rules_fr_CA.properties can be added to see messages
102+
are configured via the resource bundles: `rules.properties`, `codes.properties` and
103+
`profiles.properties` (e.g., `/rules_fr_CA.properties` can be added to see messages
97104
in French).
98105

99106
To disable LTW AOP, set ```<context:load-time-weaver aspectj-weaving="off"/>```
@@ -116,3 +123,36 @@ or revert to the default configuration)
116123

117124
The validator-core module is not specific to BioPAX;
118125
it could be used for another domain with alternative validation rules module.
126+
127+
You can also start the web app with maven (plugin)
128+
129+
```
130+
mvn clean install
131+
cd biopax-validator-web
132+
mvn spring-boot:run
133+
```
134+
135+
and also access it at localhost:8080 (live reload is enabled - can edit js/css/html/jsp and immediately see the effect
136+
without restarting the app)
137+
138+
This is convenient for development but the problem is that LTW does not properly/fully wok for some reason, -
139+
the validator will not catch syntax errors or unknown property errors, unlike when it's run via `sh server.sh` or
140+
when docker container (i.e. when the app was run using e.g. `java -javaagent:agent.jar ... -jar app.war` command)
141+
142+
## Docker
143+
144+
### build the project and image(s) from sources
145+
```
146+
mvn clean install
147+
cd biopax-validator-web
148+
mvn dockerfile:build
149+
#mvn dockerfile:tag
150+
#mvn dockerfile:push
151+
```
152+
153+
### run
154+
Run with docker (can also do with compose or terraform)
155+
```
156+
docker run --name validator -it pathwaycommons/biopax-validator -p 8080:8080
157+
```
158+

biopax-validator-client/pom.xml

Lines changed: 12 additions & 14 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>5.1.1-SNAPSHOT</version>
7+
<version>6.0.0-SNAPSHOT</version>
88
</parent>
99

1010
<artifactId>biopax-validator-client</artifactId>
@@ -26,6 +26,17 @@
2626
<artifactId>httpmime</artifactId>
2727
<version>4.5.14</version>
2828
</dependency>
29+
<dependency>
30+
<groupId>jakarta.xml.bind</groupId>
31+
<artifactId>jakarta.xml.bind-api</artifactId>
32+
<version>4.0.0</version>
33+
</dependency>
34+
<dependency>
35+
<groupId>com.sun.xml.bind</groupId>
36+
<artifactId>jaxb-impl</artifactId>
37+
<version>4.0.3</version>
38+
<scope>runtime</scope>
39+
</dependency>
2940
</dependencies>
3041

3142
<build>
@@ -49,19 +60,6 @@
4960
</configuration>
5061
</execution>
5162
</executions>
52-
<dependencies>
53-
<dependency>
54-
<groupId>org.glassfish.jaxb</groupId>
55-
<artifactId>jaxb-runtime</artifactId>
56-
<version>2.4.0-b180830.0438</version>
57-
<scope>runtime</scope>
58-
</dependency>
59-
<dependency>
60-
<groupId>com.sun.activation</groupId>
61-
<artifactId>javax.activation</artifactId>
62-
<version>1.2.0</version>
63-
</dependency>
64-
</dependencies>
6563
</plugin>
6664
<plugin>
6765
<groupId>org.apache.maven.plugins</groupId>

biopax-validator-client/src/main/java/org/biopax/validator/BiopaxValidatorClient.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
package org.biopax.validator;
22

3-
/*
4-
*
5-
*/
6-
73
import java.io.*;
84
import java.nio.charset.Charset;
95
import java.util.*;
106

11-
import javax.xml.bind.*;
7+
import jakarta.xml.bind.*;
128
import javax.xml.transform.Source;
139
import javax.xml.transform.stream.StreamSource;
1410

@@ -40,7 +36,7 @@ public class BiopaxValidatorClient {
4036
* Default BioPAX Validator's URL
4137
*/
4238
public static final String
43-
DEFAULT_VALIDATOR_URL = "http://www.biopax.org/validator/check.html";
39+
DEFAULT_VALIDATOR_URL = "https://www.biopax.org/validator/check.html";
4440

4541
/**
4642
* The Java Option to set a BioPAX Validator URL

biopax-validator-client/src/test/java/BiopaxValidatorClientTest.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@
33
*/
44
import java.io.*;
55

6-
import javax.xml.bind.JAXBException;
6+
import jakarta.xml.bind.JAXBException;
77

88
import org.biopax.validator.BiopaxValidatorClient;
99
import org.biopax.validator.BiopaxValidatorClient.RetFormat;
1010
import org.biopax.validator.jaxb.ValidatorResponse;
11-
import org.junit.*;
11+
import org.junit.jupiter.api.Assertions;
12+
import org.junit.jupiter.api.Disabled;
13+
import org.junit.jupiter.api.Test;
1214

1315
// remove @Ignore when biopax.org/biopax-validator/ is available
14-
@Ignore
16+
@Disabled
1517
public class BiopaxValidatorClientTest {
1618

1719
@Test
@@ -43,12 +45,12 @@ public void testClientXml() throws IOException, JAXBException {
4345

4446
//System.out.println(baos.toString());
4547

46-
Assert.assertTrue(baos.size()>0);
48+
Assertions.assertTrue(baos.size()>0);
4749

4850
ValidatorResponse resp = client.unmarshal(baos.toString());
4951

50-
Assert.assertNotNull(resp);
51-
Assert.assertFalse(resp.getValidation().isEmpty());
52+
Assertions.assertNotNull(resp);
53+
Assertions.assertFalse(resp.getValidation().isEmpty());
5254

5355
System.out.println(resp.getValidation().get(0).getSummary()
5456
+ "; cases: " + resp.getValidation().get(0).getTotalProblemsFound());

biopax-validator-web/Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
FROM openjdk:8-jdk-alpine
1+
FROM eclipse-temurin:latest
22
VOLUME /tmp
3-
ARG JAR_FILE
4-
COPY ${JAR_FILE} app.jar
5-
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom", "-Xmx1g", "-jar","/app.jar"]
3+
ARG APP_JAR
4+
ARG AGENT_JAR
5+
COPY ${APP_JAR} app.war
6+
COPY ${AGENT_JAR} agent.jar
7+
ENV JDK_JAVA_OPTIONS="--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED"
8+
ENTRYPOINT ["java", "-server", "-javaagent:agent.jar", \
9+
"-Djava.security.egd=file:/dev/./urandom", "-Xmx4g", "-Dfile.encoding=UTF-8", "-jar", "app.war", "--server.port=8080"]
610
EXPOSE 8080

0 commit comments

Comments
 (0)