Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
julesjacobsen committed Jul 5, 2021
2 parents 69ea3c0 + 2c0fa0d commit dc2ad0f
Show file tree
Hide file tree
Showing 123 changed files with 4,167,386 additions and 7,885 deletions.
117 changes: 117 additions & 0 deletions .mvn/wrapper/MavenWrapperDownloader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
* Copyright 2007-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;

public class MavenWrapperDownloader {

private static final String WRAPPER_VERSION = "0.5.6";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";

/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";

/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";

/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";

public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());

// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if(mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if(mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: " + url);

File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if(!outputFile.getParentFile().exists()) {
if(!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}

private static void downloadFileFromURL(String urlString, File destination) throws Exception {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}

}
2 changes: 2 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: java
jdk:
- openjdk8
- openjdk11
## See: http://stackoverflow.com/questions/14825039/suppressing-gpg-signing-for-maven-based-continous-integration-builds-travis-ci
install: mvn install -DskipTests -Dgpg.skip
27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,28 +244,47 @@ obviating the need for this. We can also make it such that the JSON is available

## Including obographs in your code:

The library is split into two modules - `obographs-core` which contains the model and code for reading and writing JSON
and YAML graphs. The `obographs-owlapi` requires `obographs-core` and includes the owlapi and code for converting OWL to
obographs.

### Maven
```xml
<dependency>
<groupId>org.geneontology</groupId>
<artifactId>obographs</artifactId>
<groupId>org.geneontology.obographs</groupId>
<artifactId>obographs-core</artifactId>
<version>${project.version}</version>
</dependency>
```

### Gradle
```groovy
compile 'org.geneontology:obographs:${project.version}'
compile 'org.geneontology.obographs:obographs-core:${project.version}'
```

### Installing a development snapshot

When developing against an unreleased snapshot version of the API, you can use Maven to install it in your local m2 repository:

```
mvn -Dgpg.skip install
mvn clean install
```

### Developing obographs

If you find that your IDE cannot load any of the concrete classes e.g. `Graph` or `GraphDocument` you should check that
your IDE has *Annotation Processing* enabled. Obographs uses the [*immutables*](http://immutables.org) library which
requires annotation processing in the IDE. See https://immutables.github.io/apt.html for how to enable this in your IDE.
You might need to restart your IDE or re-import the maven projects for this to work fully. It is not required for projects
using *obographs* as a pre-built library.

### Releasing to Central

```
mvn clean deploy -P release
```


## Javascript

See [bbop-graph](https://github.com/berkeleybop/bbop-graph)
3 changes: 1 addition & 2 deletions examples/abox.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"graphs" : [ {
"id" : "http://purl.obolibrary.org/obo/T",
"nodes" : [ {
"id" : "http://purl.obolibrary.org/obo/T/f1",
"type" : "INDIVIDUAL"
Expand Down Expand Up @@ -113,8 +114,6 @@
"pred" : "inverseOf",
"obj" : "http://purl.obolibrary.org/obo/T/parent-of"
} ],
"id" : "http://purl.obolibrary.org/obo/T",
"meta" : { },
"domainRangeAxioms" : [ {
"predicateId" : "http://purl.obolibrary.org/obo/T/brother-of",
"domainClassIds" : [ "http://purl.obolibrary.org/obo/T/Male" ]
Expand Down
5 changes: 2 additions & 3 deletions examples/abox.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
graphs:
- nodes:
- id: "http://purl.obolibrary.org/obo/T"
nodes:
- id: "http://purl.obolibrary.org/obo/T/f1"
type: "INDIVIDUAL"
- id: "http://purl.obolibrary.org/obo/T/Male"
Expand Down Expand Up @@ -84,8 +85,6 @@ graphs:
- sub: "http://purl.obolibrary.org/obo/T/child-of"
pred: "inverseOf"
obj: "http://purl.obolibrary.org/obo/T/parent-of"
id: "http://purl.obolibrary.org/obo/T"
meta: {}
domainRangeAxioms:
- predicateId: "http://purl.obolibrary.org/obo/T/brother-of"
domainClassIds:
Expand Down
54 changes: 27 additions & 27 deletions examples/basic.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{
"graphs" : [ {
"id" : "http://purl.obolibrary.org/obo/test.owl",
"meta" : {
"basicPropertyValues" : [ {
"pred" : "http://www.w3.org/2000/01/rdf-schema#comment",
"val" : "test manus ontology"
} ]
},
"nodes" : [ {
"id" : "http://purl.obolibrary.org/obo/BFO_0000050",
"type" : "PROPERTY",
"meta" : {
"xrefs" : [ {
"val" : "BFO:0000050"
Expand All @@ -9,42 +18,40 @@
"pred" : "http://www.geneontology.org/formats/oboInOwl#shorthand",
"val" : "part_of"
} ]
},
"id" : "http://purl.obolibrary.org/obo/BFO_0000050",
"type" : "PROPERTY"
}
}, {
"id" : "http://purl.obolibrary.org/obo/IAO_0000115",
"type" : "PROPERTY",
"lbl" : "definition"
"lbl" : "definition",
"type" : "PROPERTY"
}, {
"id" : "http://purl.obolibrary.org/obo/UBERON_0002101",
"type" : "CLASS",
"lbl" : "limb"
"lbl" : "limb",
"type" : "CLASS"
}, {
"id" : "http://purl.obolibrary.org/obo/UBERON_0002102",
"type" : "CLASS",
"lbl" : "forelimb"
"lbl" : "forelimb",
"type" : "CLASS"
}, {
"id" : "http://purl.obolibrary.org/obo/UBERON_0002398",
"lbl" : "manus",
"type" : "CLASS",
"meta" : {
"definition" : {
"val" : "."
}
},
"id" : "http://purl.obolibrary.org/obo/UBERON_0002398",
"type" : "CLASS",
"lbl" : "manus"
}
}, {
"id" : "http://purl.obolibrary.org/obo/UBERON_0002470",
"type" : "CLASS",
"lbl" : "autopod region"
"lbl" : "autopod region",
"type" : "CLASS"
}, {
"id" : "http://www.geneontology.org/formats/oboInOwl#hasDbXref",
"type" : "PROPERTY",
"lbl" : "database_cross_reference"
"lbl" : "database_cross_reference",
"type" : "PROPERTY"
}, {
"id" : "http://www.geneontology.org/formats/oboInOwl#shorthand",
"type" : "PROPERTY",
"lbl" : "shorthand"
"lbl" : "shorthand",
"type" : "PROPERTY"
} ],
"edges" : [ {
"sub" : "http://purl.obolibrary.org/obo/UBERON_0002102",
Expand All @@ -62,13 +69,6 @@
"sub" : "http://purl.obolibrary.org/obo/UBERON_0002470",
"pred" : "http://purl.obolibrary.org/obo/BFO_0000050",
"obj" : "http://purl.obolibrary.org/obo/UBERON_0002101"
} ],
"id" : "http://purl.obolibrary.org/obo/test.owl",
"meta" : {
"basicPropertyValues" : [ {
"pred" : "http://www.w3.org/2000/01/rdf-schema#comment",
"val" : "test manus ontology"
} ]
}
} ]
} ]
}
38 changes: 19 additions & 19 deletions examples/basic.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,43 @@
---
graphs:
- nodes:
- meta:
- id: "http://purl.obolibrary.org/obo/test.owl"
meta:
basicPropertyValues:
- pred: "http://www.w3.org/2000/01/rdf-schema#comment"
val: "test manus ontology"
nodes:
- id: "http://purl.obolibrary.org/obo/BFO_0000050"
type: "PROPERTY"
meta:
xrefs:
- val: "BFO:0000050"
basicPropertyValues:
- pred: "http://www.geneontology.org/formats/oboInOwl#shorthand"
val: "part_of"
id: "http://purl.obolibrary.org/obo/BFO_0000050"
type: "PROPERTY"
- id: "http://purl.obolibrary.org/obo/IAO_0000115"
type: "PROPERTY"
lbl: "definition"
type: "PROPERTY"
- id: "http://purl.obolibrary.org/obo/UBERON_0002101"
type: "CLASS"
lbl: "limb"
- id: "http://purl.obolibrary.org/obo/UBERON_0002102"
type: "CLASS"
- id: "http://purl.obolibrary.org/obo/UBERON_0002102"
lbl: "forelimb"
- meta:
definition:
val: "."
id: "http://purl.obolibrary.org/obo/UBERON_0002398"
type: "CLASS"
- id: "http://purl.obolibrary.org/obo/UBERON_0002398"
lbl: "manus"
- id: "http://purl.obolibrary.org/obo/UBERON_0002470"
type: "CLASS"
meta:
definition:
val: "."
- id: "http://purl.obolibrary.org/obo/UBERON_0002470"
lbl: "autopod region"
type: "CLASS"
- id: "http://www.geneontology.org/formats/oboInOwl#hasDbXref"
type: "PROPERTY"
lbl: "database_cross_reference"
- id: "http://www.geneontology.org/formats/oboInOwl#shorthand"
type: "PROPERTY"
- id: "http://www.geneontology.org/formats/oboInOwl#shorthand"
lbl: "shorthand"
type: "PROPERTY"
edges:
- sub: "http://purl.obolibrary.org/obo/UBERON_0002102"
pred: "is_a"
Expand All @@ -46,8 +51,3 @@ graphs:
- sub: "http://purl.obolibrary.org/obo/UBERON_0002470"
pred: "http://purl.obolibrary.org/obo/BFO_0000050"
obj: "http://purl.obolibrary.org/obo/UBERON_0002101"
id: "http://purl.obolibrary.org/obo/test.owl"
meta:
basicPropertyValues:
- pred: "http://www.w3.org/2000/01/rdf-schema#comment"
val: "test manus ontology"
Loading

0 comments on commit dc2ad0f

Please sign in to comment.