Skip to content

Commit

Permalink
Merge pull request #30 from BioPAX/using-paxtools6
Browse files Browse the repository at this point in the history
Validator v6 using paxtools v6
  • Loading branch information
IgorRodchenkov authored Sep 3, 2023
2 parents fa1ca8e + 59e440d commit 1a56546
Show file tree
Hide file tree
Showing 57 changed files with 753 additions and 25,994 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 17
java-version: 20
distribution: 'temurin'
cache: maven
- name: Build with Maven and JDK-17
- name: Build with Maven (JDK-20)
run: mvn --batch-mode --update-snapshots package
64 changes: 52 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
The BioPAX Validator is a command line tool, Java library, and online
web service for BioPAX formatted pathway data validation. The validator
checks for more than a hundred BioPAX Level3 rules and best practices,
provides human readable reports and can automatically fix some common
provides human-readable reports and can automatically fix some common
mistakes in data (can also process Level1 and Level2 data, which are
first auto-converted to the Level3, and then Level3 rules apply).
The validator is in use by the BioPAX community and is continuously being
Expand All @@ -27,7 +27,17 @@ pathway databases and tools that support BioPAX.

## Usage

Download and expand the latest ZIP distribution from <http://www.biopax.org/downloads/validator/>.
Download and expand the latest ZIP distribution from <http://www.biopax.org/downloads/validator/>

Or build it from the sources:

```
mvn clean install
cd dist
mvn assembly:assembly
```

then use the resulting `biopax-validator-${version}-all.zip` (move somewhere, expand)

### Console (batch)

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

## Developer notes

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

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

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

The validator-core module is not specific to BioPAX;
it could be used for another domain with alternative validation rules module.

You can also start the web app with maven (plugin)

```
mvn clean install
cd biopax-validator-web
mvn spring-boot:run
```

and also access it at localhost:8080 (live reload is enabled - can edit js/css/html/jsp and immediately see the effect
without restarting the app)

This is convenient for development but the problem is that LTW does not properly/fully wok for some reason, -
the validator will not catch syntax errors or unknown property errors, unlike when it's run via `sh server.sh` or
when docker container (i.e. when the app was run using e.g. `java -javaagent:agent.jar ... -jar app.war` command)

## Docker

### build the project and image(s) from sources
```
mvn clean install
cd biopax-validator-web
mvn dockerfile:build
#mvn dockerfile:tag
#mvn dockerfile:push
```

### run
Run with docker (can also do with compose or terraform)
```
docker run --name validator -it pathwaycommons/biopax-validator -p 8080:8080
```

26 changes: 12 additions & 14 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>5.1.1-SNAPSHOT</version>
<version>6.0.0-SNAPSHOT</version>
</parent>

<artifactId>biopax-validator-client</artifactId>
Expand All @@ -26,6 +26,17 @@
<artifactId>httpmime</artifactId>
<version>4.5.14</version>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>4.0.3</version>
<scope>runtime</scope>
</dependency>
</dependencies>

<build>
Expand All @@ -49,19 +60,6 @@
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.4.0-b180830.0438</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
<version>1.2.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
package org.biopax.validator;

/*
*
*/

import java.io.*;
import java.nio.charset.Charset;
import java.util.*;

import javax.xml.bind.*;
import jakarta.xml.bind.*;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;

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

/**
* The Java Option to set a BioPAX Validator URL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
*/
import java.io.*;

import javax.xml.bind.JAXBException;
import jakarta.xml.bind.JAXBException;

import org.biopax.validator.BiopaxValidatorClient;
import org.biopax.validator.BiopaxValidatorClient.RetFormat;
import org.biopax.validator.jaxb.ValidatorResponse;
import org.junit.*;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

// remove @Ignore when biopax.org/biopax-validator/ is available
@Ignore
@Disabled
public class BiopaxValidatorClientTest {

@Test
Expand Down Expand Up @@ -43,12 +45,12 @@ public void testClientXml() throws IOException, JAXBException {

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

Assert.assertTrue(baos.size()>0);
Assertions.assertTrue(baos.size()>0);

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

Assert.assertNotNull(resp);
Assert.assertFalse(resp.getValidation().isEmpty());
Assertions.assertNotNull(resp);
Assertions.assertFalse(resp.getValidation().isEmpty());

System.out.println(resp.getValidation().get(0).getSummary()
+ "; cases: " + resp.getValidation().get(0).getTotalProblemsFound());
Expand Down
12 changes: 8 additions & 4 deletions biopax-validator-web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
FROM openjdk:8-jdk-alpine
FROM eclipse-temurin:latest
VOLUME /tmp
ARG JAR_FILE
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom", "-Xmx1g", "-jar","/app.jar"]
ARG APP_JAR
ARG AGENT_JAR
COPY ${APP_JAR} app.war
COPY ${AGENT_JAR} agent.jar
ENV JDK_JAVA_OPTIONS="--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED"
ENTRYPOINT ["java", "-server", "-javaagent:agent.jar", \
"-Djava.security.egd=file:/dev/./urandom", "-Xmx4g", "-Dfile.encoding=UTF-8", "-jar", "app.war", "--server.port=8080"]
EXPOSE 8080
Loading

0 comments on commit 1a56546

Please sign in to comment.