Skip to content

Commit

Permalink
Merge pull request #2 from JULIELab/cdbm-1.1.0
Browse files Browse the repository at this point in the history
Cdbm 1.0.0
  • Loading branch information
khituras authored May 18, 2020
2 parents 53edc94 + 912cb01 commit f3a1b31
Show file tree
Hide file tree
Showing 134 changed files with 9,749 additions and 3,183 deletions.
118 changes: 34 additions & 84 deletions ...core/src/main/resources/gene-database.xml → gene-database.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

<conceptdatabase xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.julielab.de/conceptdb"
xsi:schemaLocation="http://www.julielab.de/conceptdb conceptdb.xsd
http://www.julielab.de/conceptdb/concepts/ncbigene ncbigeneconcepts.xsd
http://www.julielab.de/conceptdb/facets/default defaultfacet.xsd">
xsi:schemaLocation="http://www.julielab.de/conceptdb julielab-concept-db-manager-core/src/main/resources/conceptdb.xsd
http://www.julielab.de/conceptdb/concepts/ncbigene http://www.julielab.de/conceptdb/concepts/ncbigeneconcepts-1.0.0.xsd
http://www.julielab.de/conceptdb/facets/default http://www.julielab.de/conceptdb/facets/defaultfacet-1.0.0.xsd
http://www.julielab.de/conceptdb/exporters/serverplugin http://www.julielab.de/conceptdb/exporters/serverpluginexporter-1.0.0.xsd">
<versioning>
<version>1.0-test</version>
</versioning>
<connection>
<uri>http://localhost:7474</uri>
<user>neo4j</user>
<password>erik</password>
</connection>
<imports>
<import>
<serverpluginimporter>
<serverplugininserter>
<pluginname>ConceptManager</pluginname>
<pluginendpoint>insert_concepts</pluginendpoint>
</serverpluginimporter>
</serverplugininserter>
<concepts>
<creator xmlns="http://www.julielab.de/conceptdb/concepts/ncbigene">
<name>de.julielab.concepts.db.creators.NCBIGeneConceptCreator</name>
Expand Down Expand Up @@ -53,82 +53,32 @@
</facet>
</import>
</imports>
<!--<exports>-->
<!--<export>-->
<!--<serverpluginexporter>-->
<!--<configuration>-->
<!--<decoding>-->
<!--<json2bytearray>true</json2bytearray>-->
<!--<base64>false</base64>-->
<!--<gzip>true</gzip>-->
<!--</decoding>-->
<!--<pluginname>-->
<!--Export-->
<!--</pluginname>-->
<!--<pluginendpoint>-->
<!--term_id_mapping-->
<!--</pluginendpoint>-->
<!--<outputfile>-->
<!--genes.idmap-->
<!--</outputfile>-->
<!--<parameters>-->
<!--<id_property>-->
<!--originalId-->
<!--</id_property>-->
<!--<labels tojson="true">-->
<!--<label>ID_MAP_NCBI_GENES</label>-->
<!--</labels>-->
<!--</parameters>-->
<!--</configuration>-->
<!--</serverpluginexporter>-->
<!--</export>-->
<!--<export>-->
<!--<serverpluginexporter>-->
<!--<configuration>-->
<!--<decoding>-->
<!--<json2bytearray>false</json2bytearray>-->
<!--<base64>true</base64>-->
<!--<gzip>true</gzip>-->
<!--</decoding>-->
<!--<pluginname>-->
<!--Export-->
<!--</pluginname>-->
<!--<pluginendpoint>-->
<!--element_aggregate_id_mapping-->
<!--</pluginendpoint>-->
<!--<outputfile>-->
<!--elements.2aggid-->
<!--</outputfile>-->
<!--<parameters>-->
<!--<labels tojson="true">-->
<!--<label>AGGREGATE_TOP_HOMOLOGY</label>-->
<!--<label>AGGREGATE_HOMOLOGENE</label>-->
<!--<label>AGGREGATE_GENEGROUP</label>-->
<!--</labels>-->
<!--</parameters>-->
<!--</configuration>-->
<!--</serverpluginexporter>-->
<!--</export>-->
<!--<export>-->
<!--<serverpluginexporter>-->
<!--<configuration>-->
<!--<decoding>-->
<!--<json2bytearray>true</json2bytearray>-->
<!--<base64>false</base64>-->
<!--<gzip>true</gzip>-->
<!--</decoding>-->
<!--<pluginname>-->
<!--Export-->
<!--</pluginname>-->
<!--<pluginendpoint>-->
<!--hypernyms-->
<!--</pluginendpoint>-->
<!--<outputfile>-->
<!--hypernyms.tid-->
<!--</outputfile>-->
<!--<parameters/>-->
<!--</configuration>-->
<!--</serverpluginexporter>-->
<!--</export>-->
<!--</exports>-->
<exports>
<export xmlns="http://www.julielab.de/conceptdb/exporters/serverplugin">
<pluginendpoint>
term_id_mapping
</pluginendpoint>
<configuration>
<decoding>
<json2bytearray>true</json2bytearray>
<base64>false</base64>
<gzip>true</gzip>
</decoding>
<outputfile>
genes.idmap
</outputfile>
<parameters>
</parameters>
</configuration>
</export>
<export xmlns="http://www.julielab.de/conceptdb/exporters/serverplugin">
</export>
<export xmlns="http://www.julielab.de/conceptdb/exporters/serverplugin">
<pluginname>
Export
</pluginname>
<pluginendpoint>
</pluginendpoint>
</export>
</exports>
</conceptdatabase>
46 changes: 24 additions & 22 deletions julielab-concept-creation-bioportal/pom.xml
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.julielab</groupId>
<artifactId>julielab-concept-db-manager</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>julielab-concept-creation-bioportal</artifactId>
<name>JULIE Lab Concept Creation for BioPortal</name>
<description>This project uses the JULIE Lab BioPortal Tools to create database concepts for ontology classes.</description>
<dependencies>
<dependency>
<groupId>de.julielab</groupId>
<artifactId>julielab-concept-db-manager-core</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>de.julielab</groupId>
<artifactId>julielab-bioportal-ontology-tools</artifactId>
<version>1.0.3</version>
</dependency>
</dependencies>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.julielab</groupId>
<artifactId>julielab-concept-db-manager</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>julielab-concept-creation-bioportal</artifactId>
<name>JULIE Lab Concept Creation for BioPortal</name>
<description>This project uses the JULIE Lab BioPortal Tools to create database concepts for ontology classes.
</description>
<dependencies>
<dependency>
<groupId>de.julielab</groupId>
<artifactId>julielab-concept-db-manager-core</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>de.julielab</groupId>
<artifactId>julielab-bioportal-ontology-tools</artifactId>
<version>1.0.4</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -50,8 +51,8 @@ public class JulielabBioPortalToolsConceptCreator implements ConceptCreator {
@Override
public Stream<ImportConcepts> createConcepts(HierarchicalConfiguration<ImmutableNode> config)
throws ConceptCreationException {
String facetGroupNameKey = dot(FACET, CREATOR, CONFIGURATION, FACET_GROUP, NAME);
String ontologiesPathKey = dot(CONCEPTS, CREATOR, CONFIGURATION, PATH);
String facetGroupNameKey = slash(FACET, CREATOR, CONFIGURATION, FACET_GROUP, NAME);
String ontologiesPathKey = slash(CONCEPTS, CREATOR, CONFIGURATION, PATH);
try {
checkParameters(config, facetGroupNameKey,
ontologiesPathKey);
Expand Down Expand Up @@ -110,6 +111,11 @@ public Stream<ImportConcepts> createConcepts(HierarchicalConfiguration<Immutable
// won't.
ImportFacet facet = new ImportFacet(fg, acronym, acronym, acronym,
FacetConstants.SRC_TYPE_HIERARCHICAL);
boolean noFacet = config.getBoolean(slash(FACET, CREATOR, CONFIGURATION, DefaultFacetCreator.NO_FACET), false);
facet.setNoFacet(noFacet);
String[] labels = config.getStringArray(slash(FACET, CREATOR, CONFIGURATION, DefaultFacetCreator.LABELS));
if (labels != null && labels.length > 0)
facet.setLabels(Arrays.asList(labels));
return new ImportConcepts(conceptStream, facet);
} catch (IOException e) {
throw new ConceptDBManagerRuntimeException(new ConceptCreationException(e));
Expand All @@ -123,7 +129,7 @@ public void exposeParameters(String basePath, HierarchicalConfiguration<Immutabl
template.addProperty(slash(basePath, CONCEPTS, CREATOR, NAME), getName());
template.addProperty(slash(basePath, CONCEPTS, CREATOR, CONFIGURATION, PATH), "");
template.setProperty(slash(basePath, FACET, CREATOR, CONFIGURATION, FACET_GROUP, NAME), "Ontologies");
template.setProperty(slash(basePath, FACET, CREATOR, CONFIGURATION, DefaultFacetCreator.SOURCE_TYPE), FacetConstants.SRC_TYPE_HIERARCHICAL);
template.setProperty(slash(basePath, FACET, CREATOR, CONFIGURATION, DefaultFacetCreator.LABELS), "");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
import java.util.stream.Stream;

import static de.julielab.concepts.db.core.ConfigurationConstants.*;
import static de.julielab.java.utilities.ConfigurationUtilities.dot;
import static de.julielab.java.utilities.ConfigurationUtilities.slash;
import static de.julielab.java.utilities.ConfigurationUtilities.slash;

public class
JulielabBioPortalToolsMappingCreator implements MappingCreator {

public static final String ALLOWED_ACRONYMS = "allowed_acronyms";
public static final String ALLOWED_ACRONYMS = "allowedacronyms";
private final static Logger log = LoggerFactory.getLogger(JulielabBioPortalToolsMappingCreator.class);

@Override
Expand All @@ -50,10 +50,10 @@ public void exposeParameters(String basePath, HierarchicalConfiguration<Immutabl
public Stream<ImportMapping> createMappings(HierarchicalConfiguration<ImmutableNode> importConfig) throws MappingCreationException {

try {
ConfigurationUtilities.checkParameters(importConfig, dot(MAPPINGS, CREATOR, CONFIGURATION, PATH), dot(MAPPINGS, CREATOR, CONFIGURATION, ALLOWED_ACRONYMS));
ConfigurationUtilities.checkFilesExist(importConfig, dot(MAPPINGS, CREATOR, CONFIGURATION, PATH));
String pathToMappings = importConfig.getString(dot(MAPPINGS, CREATOR, CONFIGURATION, PATH));
final Set<Object> allowedAcronyms = new HashSet<>(importConfig.getList(dot(MAPPINGS, CREATOR, CONFIGURATION, ALLOWED_ACRONYMS)));
ConfigurationUtilities.checkParameters(importConfig, slash(MAPPINGS, CREATOR, CONFIGURATION, PATH), slash(MAPPINGS, CREATOR, CONFIGURATION, ALLOWED_ACRONYMS));
ConfigurationUtilities.checkFilesExist(importConfig, slash(MAPPINGS, CREATOR, CONFIGURATION, PATH));
String pathToMappings = importConfig.getString(slash(MAPPINGS, CREATOR, CONFIGURATION, PATH));
final Set<Object> allowedAcronyms = new HashSet<>(importConfig.getList(slash(MAPPINGS, CREATOR, CONFIGURATION, ALLOWED_ACRONYMS)));
log.info("Importing mappings from {}{}", pathToMappings, allowedAcronyms != null && !allowedAcronyms.isEmpty() ? " for acronyms " + allowedAcronyms : "");
File file = new File(pathToMappings);
Stream<ImportMapping> mappings = Stream.empty();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.julielab.de/conceptdb/concepts/bioportal"
targetNamespace="http://www.julielab.de/conceptdb/concepts/bioportal"
version="1.0.0"
elementFormDefault="qualified">

<!-- The name of the BioPortal Concept Creator provider. Only names determining the respective class are allowed. -->
<xs:element name="name">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="JulielabBioPortalToolsConceptCreator"/>
<xs:enumeration value="de.julielab.concepts.db.creators.JulielabBioPortalToolsConceptCreator"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="path" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="en">
The path to a single JSON ontology names file or a directory of such files. The files may be compressed
using GZIP. The JSON format is the one used by the
<a href="https://github.com/JULIELab/julielab-bioportal-ontology-tools">JULIE Lab BioPortal Tools</a>
which can also be used to download ontologies and extract ontology classes, their names and their
hierarchy for concept database import.
</xs:documentation>
</xs:annotation>
</xs:element>

<!-- The provider configuration -->
<xs:element name="configuration">
<xs:complexType>
<xs:all>
<xs:element ref="path"/>
</xs:all>
</xs:complexType>
</xs:element>

<!-- The root concept creator element -->
<xs:element name="creator">
<xs:complexType>
<xs:sequence>
<xs:element ref="name"/>
<xs:element ref="configuration"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.julielab.de/conceptdb/facets/bioportal"
version="1.0.0"
xmlns="http://www.julielab.de/conceptdb/facets/bioportal"
elementFormDefault="qualified">


<xs:element name="labels">
<xs:annotation>
<xs:documentation xml:lang="en">
A set of labels that will be added as Neo4j node labels in the database.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="label" type="xs:string" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="nofacet" type="xs:boolean" default="false">
<xs:annotation>
<xs:documentation xml:lang="en">
Indicates that the facet node should not be placed under the <em>facets</em> top node but under the <em>nofacets</em> top node in the database. "No-facet" facets are still meant to contribute concepts to an application but should be handled as second-class citizens and not be displayed on the application frontend, for example.
</xs:documentation>
</xs:annotation>
</xs:element>

<xs:element name="facetgroup">
<xs:annotation>
<xs:documentation xml:lang="en">
All facets are assembled in facet groups. Facet groups are just nodes in the database that collect multiple facets, creating an additional hierarchical layer. They are uniquely identified via their name.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="configuration">
<xs:complexType>
<xs:sequence>
<xs:element ref="labels" minOccurs="0"/>
<xs:element ref="nofacet" minOccurs="0"/>
<xs:element ref="facetgroup"/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="creator">
<xs:annotation>
<xs:documentation xml:lang="en">
BioPortal facets are directly derived from the respective ontologies. Each ontology is transformed into a
facet. The facet name and ID is the BioPortal ontology acronym. The source type is always hierarchic.
Labels can be specified that would be added to all BioPortal facets and the facet group name.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="configuration"/>
</xs:sequence>
</xs:complexType>
</xs:element>

</xs:schema>
Loading

0 comments on commit f3a1b31

Please sign in to comment.