Skip to content

Commit

Permalink
Upgraded Jena dependency; improved the enum typeOf methods (allows an…
Browse files Browse the repository at this point in the history
…y capitalization and both '-' and '_' in the values).
  • Loading branch information
IgorRodchenkov committed Oct 9, 2023
1 parent 6a9867f commit c56f1e2
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 54 deletions.
48 changes: 1 addition & 47 deletions json-converter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,58 +15,12 @@
<tag>HEAD</tag>
</scm>

<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>apache-jena-libs</artifactId>
<version>4.9.0</version>
<type>pom</type>
<version>3.2.0</version>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.hp.hpl.jena</groupId>
<artifactId>jena</artifactId>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.biopax.paxtools</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public final void test() throws IOException {
JsonldConverter intf = new JsonldBiopaxConverter();

// convert owl test file in resource directory to jsonld format
InputStream in = getClass().getResourceAsStream(
"/PC2v5test-Signaling-By-BMP-Pathway-REACT_12034.2.owl");
InputStream in = getClass().getResourceAsStream("/PC2v5test-Signaling-By-BMP-Pathway-REACT_12034.2.owl");
intf.convertToJsonld(in, new FileOutputStream(jsonldTestFileName));

// convert jsonld test file back to rdf format
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.biopax.paxtools.pattern.miner;

import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;
import java.util.List;

Expand Down Expand Up @@ -107,10 +109,12 @@ public List<Class<? extends SIFMiner>> getMiners()

public static SIFEnum typeOf(String tag)
{
tag = tag.toUpperCase().replaceAll("-", "_");
if(StringUtils.isBlank(tag))
return null;

SIFEnum type = null;
try
{
try {
tag = tag.toUpperCase().replaceAll("-", "_");
type = valueOf(tag);
}
catch (IllegalArgumentException e){}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.biopax.paxtools.query.algorithm;

import org.apache.commons.lang3.StringUtils;

/**
* Direction is used for specifying upstream, downstream or both. Neighborhood and CommonStream
* queries use this enum as parameter.
Expand Down Expand Up @@ -28,7 +30,7 @@ public enum Direction
* Constructor with description.
* @param description Description
*/
private Direction(String description)
Direction(String description)
{
this.description = description;
}
Expand All @@ -41,4 +43,18 @@ public String getDescription()
{
return description;
}

public static Direction typeOf(String tag)
{
if(StringUtils.isBlank(tag))
return null;

Direction type = null;
try {
type = valueOf(tag.toUpperCase());
}
catch (IllegalArgumentException e){}

return type;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.biopax.paxtools.query.algorithm;

import org.apache.commons.lang3.StringUtils;

/**
* Specifies whether the length limit is a normal limit or shortest_plus_k limit. PathsFromToQuery
* use this as a parameter.
Expand All @@ -9,5 +11,20 @@
public enum LimitType
{
NORMAL,
SHORTEST_PLUS_K
SHORTEST_PLUS_K;

public static LimitType typeOf(String tag)
{
if(StringUtils.isBlank(tag))
return null;

LimitType type = null;
try {
tag = tag.toUpperCase().replaceAll("-", "_");
type = valueOf(tag);
}
catch (IllegalArgumentException e){}

return type;
}
}

0 comments on commit c56f1e2

Please sign in to comment.