Skip to content

Commit 020c259

Browse files
authored
Merge pull request #153 from SynBioDex/revert-152-marpaia/sbol3
Revert "Add support for SBOL3 via SBOL-Converter"
2 parents d7f78b3 + 16949dc commit 020c259

9 files changed

Lines changed: 23 additions & 42 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ src/work/*
77
sbol-validator/*
88
*.bat
99
src/DEPLOY_SECRET
10-
.DS_Store
11-
.venv
10+
.DS_Store

‎README.md‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
# SBOL Validator
22
[![Build Status](https://travis-ci.org/SynBioDex/SBOL-Validator.svg?branch=master)](https://travis-ci.org/SynBioDex/SBOL-Validator)
3-
A web-based validator for SBOL files backed by the [SBOL-Converter](https://github.com/SynBioDex/SBOL-Converter), which bundles libSBOLj (SBOL2) and libSBOLj3 (SBOL3). This validator offers support for SBOL3, SBOL2, SBOL1.1, GenBank, FASTA, and GFF3, including conversion between them.
3+
A web-based validator for SBOL files backed by libSBOLj's validation runtimes. This validator offers support for SBOL2, SBOL1.1, and GenBank.
44
Furthermore, it is accessible through a web GUI or a RESTful API.
55

66
The validator can be found [here](https://validator.sbolstandard.org) with an API endpoint found at `https://validator.sbolstandard.org/validate`.
77

8-
### Validation engine
9-
The backend shells out to `src/sbol-converter.jar`, the `jar-with-dependencies` build of the [SBOL-Converter](https://github.com/SynBioDex/SBOL-Converter) (which bundles libSBOLj and libSBOLj3). To update it, download the latest `sbol-converter-*-jar-with-dependencies.jar` asset from the [SBOL-Converter releases](https://github.com/SynBioDex/SBOL-Converter/releases) and replace `src/sbol-converter.jar`. A Java 21+ runtime is required.
10-
118
### Installation
129
First, bit about the way the application is structured.
1310
There are two main parts:

‎docker/converter.Dockerfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM python:3.9-alpine
22

3-
RUN apk add nginx openjdk21-jre python3-dev build-base linux-headers pcre-dev bash
3+
RUN apk add nginx openjdk17-jre python3-dev build-base linux-headers pcre-dev bash
44

55
WORKDIR /opt/SBOL-Validator
66

‎docker/validator.Dockerfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM python:3.9-alpine
22

3-
RUN apk add nginx openjdk21-jre python3-dev build-base linux-headers pcre-dev bash
3+
RUN apk add nginx openjdk17-jre python3-dev build-base linux-headers pcre-dev bash
44

55
WORKDIR /opt/SBOL-Validator
66

‎src/conversion-form/html/form.html‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,16 @@ <h3 class="panel-title">
7171
</h3>
7272
</div>
7373
<div class="panel-body">
74-
<div class="form-group" id="fileOptions">
74+
<div
75+
class="form-group" id="fileOptions">
76+
<!--
7577
<div class="radio">
7678
<label>
7779
<input type="radio" name="output" value="SBOL3" id="sbol32" /> Output SBOL 3
7880
<br />
7981
</label>
80-
</div>
82+
</div>
83+
-->
8184
<div class="radio">
8285
<label>
8386
<input type="radio" name="output" value="SBOL2" id="sbol20" checked="checked" /> Output SBOL 2

‎src/libSBOLj.jar‎

8.91 MB
Binary file not shown.

‎src/sbol-converter.jar‎

-23.8 MB
Binary file not shown.

‎src/validation-form/html/form.html‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,13 @@ <h3 class="panel-title">
9191
</div>
9292
<div class="panel-body">
9393
<div class="form-group" id="fileOptions">
94-
<div class="radio">
94+
<!-- <div class="radio">
9595
<label>
9696
<input type="radio" name="output" value="SBOL3" id="sbol32" /> Output SBOL 3
9797
<br />
9898
</label>
9999
</div>
100+
-->
100101
<div class="radio">
101102
<label>
102103
<input type="radio" name="output" value="SBOL2" id="sbol20" checked="checked" /> Output SBOL 2

‎src/validator/validator.py‎

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,14 @@
1717
logger = logging.getLogger(__name__)
1818

1919
class ValidationResult:
20-
# Status lines the SBOL-Converter prints that are not validation errors and should
21-
# not surface to the user (e.g. among a comparison's differences).
22-
STATUS_LINES = frozenset([
23-
"Validation successful, no errors.",
24-
"Either Validate or Convert to/from SBOL2",
25-
])
26-
2720
def __init__(self, output_file, equality):
2821
self.check_equality = equality
2922
self.output_file = output_file
3023
self.valid = False
3124
self.errors = []
3225

3326
def digest_errors(self, output):
34-
self.errors = [
35-
line for line in output.strip().split('\n')
36-
if line.strip() and line.strip() not in self.STATUS_LINES
37-
]
27+
self.errors = output.strip().split('\n')
3828

3929
def decipher(self, output, options):
4030
if self.check_equality:
@@ -43,24 +33,16 @@ def decipher(self, output, options):
4333
else:
4434
self.equal = True
4535

46-
succeeded = "Validation successful, no errors." in output
47-
48-
# The SBOL-Converter is silent on a successful conversion (e.g. SBOL2<->SBOL3)
49-
# and exits non-zero on any error, so reaching this point with a written
50-
# output file signals success even without the validation message.
51-
if not succeeded and options.return_file:
52-
succeeded = os.path.exists(options.output_file) and os.path.getsize(options.output_file) > 0
53-
54-
if succeeded:
36+
if "Validation successful, no errors." not in output:
37+
self.valid = False
5538
self.digest_errors(output)
39+
else:
40+
self.digest_errors(output.strip(u"Validation successful, no errors."))
5641
self.valid = True
5742

58-
if options.return_file and os.path.exists(options.output_file):
43+
if options.return_file:
5944
with open(options.output_file, 'r') as file:
6045
self.result = file.read()
61-
else:
62-
self.valid = False
63-
self.digest_errors(output)
6446

6547
def broken_validation_request(self, command):
6648
self.valid = False
@@ -80,15 +62,14 @@ def execute(self):
8062

8163
# Attempt to run command
8264
try:
83-
command = self.options.command("sbol-converter.jar", self.validation_file, self.diff_file)
65+
command = self.options.command("libSBOLj.jar", self.validation_file, self.diff_file)
8466
logger.info("Running command: %s", " ".join(command))
85-
try:
86-
output = subprocess.check_output(command, universal_newlines=True, stderr=subprocess.STDOUT)
87-
except subprocess.CalledProcessError as exception:
88-
# The SBOL-Converter exits non-zero both for an invalid document and when a
89-
# comparison finds differences; decipher classifies each from the output.
90-
output = exception.output
67+
output = subprocess.check_output(command, universal_newlines=True, stderr=subprocess.STDOUT)
9168
result.decipher(output, self.options)
69+
except subprocess.CalledProcessError as exception:
70+
#If the command fails, the file is not valid.
71+
result.valid = False
72+
result.errors += [exception.output, ]
9273
except ValueError as ve:
9374
print(traceback.print_tb(ve.__traceback__))
9475
result.broken_validation_request(command)

0 commit comments

Comments
 (0)