diff --git a/examples/pom.xml b/examples/pom.xml index 2df95159c..0d846839d 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -3,7 +3,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT 4.0.0 org.bridgedb.examples diff --git a/org.bridgedb.bio/pom.xml b/org.bridgedb.bio/pom.xml index 7c89938f5..d27fe4cb8 100644 --- a/org.bridgedb.bio/pom.xml +++ b/org.bridgedb.bio/pom.xml @@ -8,7 +8,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT diff --git a/org.bridgedb.bio/resources/org/bridgedb/bio/datasources.tsv b/org.bridgedb.bio/resources/org/bridgedb/bio/datasources.tsv index d8c7d7b47..1c4891254 100644 --- a/org.bridgedb.bio/resources/org/bridgedb/bio/datasources.tsv +++ b/org.bridgedb.bio/resources/org/bridgedb/bio/datasources.tsv @@ -54,7 +54,7 @@ ICD-11 ICD11 http://www.who.int/classifications/icd/en/ 1A95 unknown Homo sapie Illumina Il http://www.illumina.com/ ILMN_5668 probe 0 Il ILMN_\d+ Illumina illumina.probe probe InChIKey Ik http://inchi.org/ QTBSBXVTEAMEQO-UHFFFAOYSA-N metabolite 1 urn:miriam:inchikey ^[A-Z]{14}\-[A-Z]{10}(\-[A-Z])? Standard InChIKey P235 inchikey metabolite IntAct Ia http://www.ebi.ac.uk/intact/ http://www.ebi.ac.uk/intact/pages/details/details.xhtml?interactionAc=$id EBI-2307691 interaction 1 urn:miriam:intact ^EBI\-[0-9]+$ IntAct intact interaction -InterPro I http://www.ebi.ac.uk/interpro/ http://www.ebi.ac.uk/interpro/DisplayIproEntry?ac=$id IPR000100 protein 1 urn:miriam:interpro ^IPR\d{6}$ InterPro P2926 interpro protein +InterPro I http://www.ebi.ac.uk/interpro/ https://www.ebi.ac.uk/interpro/entry/InterPro/$id IPR000100 protein 1 urn:miriam:interpro ^IPR\d{6}$ InterPro P2926 interpro protein IPI Ip http://www.ebi.ac.uk/IPI http://www.ebi.ac.uk/cgi-bin/dbfetch?db=IPI&id=$id&format=default IPI00000001 protein 1 ^IPI\d{8}$ IPI interpro protein IRGSP Gene Ir http://rgp.dna.affrc.go.jp/IRGSP/ https://rapdb.dna.affrc.go.jp/viewer/gbrowse_details/irgsp1?name=$id Os12g0561000 gene 1 Ir Os\d{2}g\d+ IRGSP Gene rapdb.locus gene ISBN isbn http://isbndb.com/ http://isbndb.com/search-all.html?kw=$id 9781584885658 publication 1 urn:miriam:isbn ^(ISBN)?(-13|-10)?[:]?[ ]?(\d{2,3}[ -]?)?\d{1,5}[ -]?\d{1,7}[ -]?\d{1,6}[ -]?(\d|X)$ ISBN P212 isbn publication diff --git a/org.bridgedb.bio/src/main/resources/org/bridgedb/bio/datasources.tsv b/org.bridgedb.bio/src/main/resources/org/bridgedb/bio/datasources.tsv index d8c7d7b47..1c4891254 100644 --- a/org.bridgedb.bio/src/main/resources/org/bridgedb/bio/datasources.tsv +++ b/org.bridgedb.bio/src/main/resources/org/bridgedb/bio/datasources.tsv @@ -54,7 +54,7 @@ ICD-11 ICD11 http://www.who.int/classifications/icd/en/ 1A95 unknown Homo sapie Illumina Il http://www.illumina.com/ ILMN_5668 probe 0 Il ILMN_\d+ Illumina illumina.probe probe InChIKey Ik http://inchi.org/ QTBSBXVTEAMEQO-UHFFFAOYSA-N metabolite 1 urn:miriam:inchikey ^[A-Z]{14}\-[A-Z]{10}(\-[A-Z])? Standard InChIKey P235 inchikey metabolite IntAct Ia http://www.ebi.ac.uk/intact/ http://www.ebi.ac.uk/intact/pages/details/details.xhtml?interactionAc=$id EBI-2307691 interaction 1 urn:miriam:intact ^EBI\-[0-9]+$ IntAct intact interaction -InterPro I http://www.ebi.ac.uk/interpro/ http://www.ebi.ac.uk/interpro/DisplayIproEntry?ac=$id IPR000100 protein 1 urn:miriam:interpro ^IPR\d{6}$ InterPro P2926 interpro protein +InterPro I http://www.ebi.ac.uk/interpro/ https://www.ebi.ac.uk/interpro/entry/InterPro/$id IPR000100 protein 1 urn:miriam:interpro ^IPR\d{6}$ InterPro P2926 interpro protein IPI Ip http://www.ebi.ac.uk/IPI http://www.ebi.ac.uk/cgi-bin/dbfetch?db=IPI&id=$id&format=default IPI00000001 protein 1 ^IPI\d{8}$ IPI interpro protein IRGSP Gene Ir http://rgp.dna.affrc.go.jp/IRGSP/ https://rapdb.dna.affrc.go.jp/viewer/gbrowse_details/irgsp1?name=$id Os12g0561000 gene 1 Ir Os\d{2}g\d+ IRGSP Gene rapdb.locus gene ISBN isbn http://isbndb.com/ http://isbndb.com/search-all.html?kw=$id 9781584885658 publication 1 urn:miriam:isbn ^(ISBN)?(-13|-10)?[:]?[ ]?(\d{2,3}[ -]?)?\d{1,5}[ -]?\d{1,7}[ -]?\d{1,6}[ -]?(\d|X)$ ISBN P212 isbn publication diff --git a/org.bridgedb.file.orthoxml/pom.xml b/org.bridgedb.file.orthoxml/pom.xml index a87896961..6cf3c0747 100644 --- a/org.bridgedb.file.orthoxml/pom.xml +++ b/org.bridgedb.file.orthoxml/pom.xml @@ -6,7 +6,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT diff --git a/org.bridgedb.gui/pom.xml b/org.bridgedb.gui/pom.xml index 475cfddc4..a04609afb 100644 --- a/org.bridgedb.gui/pom.xml +++ b/org.bridgedb.gui/pom.xml @@ -7,7 +7,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT diff --git a/org.bridgedb.rdb.construct/pom.xml b/org.bridgedb.rdb.construct/pom.xml index 6824871e6..a4ebb736a 100644 --- a/org.bridgedb.rdb.construct/pom.xml +++ b/org.bridgedb.rdb.construct/pom.xml @@ -7,7 +7,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT diff --git a/org.bridgedb.rdb/pom.xml b/org.bridgedb.rdb/pom.xml index ccec29938..3cd3a306c 100644 --- a/org.bridgedb.rdb/pom.xml +++ b/org.bridgedb.rdb/pom.xml @@ -7,7 +7,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT @@ -108,7 +108,7 @@ org.junit.platform junit-platform-launcher - 1.9.3 + 1.10.1 test diff --git a/org.bridgedb.rdf/pom.xml b/org.bridgedb.rdf/pom.xml index 8aa5cfba7..86cc48316 100644 --- a/org.bridgedb.rdf/pom.xml +++ b/org.bridgedb.rdf/pom.xml @@ -6,7 +6,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT diff --git a/org.bridgedb.rdf/resources/DataSource.ttl b/org.bridgedb.rdf/resources/DataSource.ttl index 9b881fdf5..950b8ac7a 100644 --- a/org.bridgedb.rdf/resources/DataSource.ttl +++ b/org.bridgedb.rdf/resources/DataSource.ttl @@ -646,7 +646,7 @@ bridgeDB:DataSource_InterPro a bridgeDB:DataSource ; bridgeDB:idExample "IPR000100" ; bridgeDB:primary "true"^^ ; bridgeDB:type "protein" ; - bridgeDB:hasPrimaryUriPattern ; + bridgeDB:hasPrimaryUriPattern ; bridgeDB:hasIdentifiersOrgPattern ; bridgeDB:hasUriPattern . diff --git a/org.bridgedb.rdf/resources/IdentifiersOrgDataSource.ttl b/org.bridgedb.rdf/resources/IdentifiersOrgDataSource.ttl index eb1ca8d2a..e97443446 100644 --- a/org.bridgedb.rdf/resources/IdentifiersOrgDataSource.ttl +++ b/org.bridgedb.rdf/resources/IdentifiersOrgDataSource.ttl @@ -1,4 +1,4 @@ - @prefix bridgeDB: . +@prefix bridgeDB: . @prefix dcat: . @prefix dcterms: . @@ -3101,7 +3101,7 @@ bridgeDB:DataSource_InterPro a bridgeDB:DataSource ; bridgeDB:idExample "IPR000100" ; bridgeDB:primary "true"^^ ; bridgeDB:type "protein" ; - bridgeDB:hasPrimaryUriPattern ; + bridgeDB:hasPrimaryUriPattern ; bridgeDB:hasIdentifiersOrgPattern ; bridgeDB:hasIdentifiersOrgInfoPattern ; bridgeDB:hasRegexPattern "^IPR\\d{6}$" ; @@ -11427,8 +11427,8 @@ bridgeDB:Organism_Zm a bridgeDB:Organism ; a bridgeDB:UriPattern ; bridgeDB:hasPrefix "http://www.ebi.ac.uk/intenz/query?cmd=SearchEC&ec=" . - a bridgeDB:UriPattern ; - bridgeDB:hasPrefix "http://www.ebi.ac.uk/interpro/DisplayIproEntry?ac=" . + a bridgeDB:UriPattern ; + bridgeDB:hasPrefix "https://www.ebi.ac.uk/interpro/entry/InterPro/" . a bridgeDB:UriPattern ; bridgeDB:hasPrefix "http://www.ebi.ac.uk/interpro/entry/" . diff --git a/org.bridgedb.rdf/src/org/bridgedb/rdf/BridgeDBRdfHandler.java b/org.bridgedb.rdf/src/org/bridgedb/rdf/BridgeDBRdfHandler.java index 3ee58896f..72fa651dd 100644 --- a/org.bridgedb.rdf/src/org/bridgedb/rdf/BridgeDBRdfHandler.java +++ b/org.bridgedb.rdf/src/org/bridgedb/rdf/BridgeDBRdfHandler.java @@ -47,9 +47,7 @@ import org.eclipse.rdf4j.model.Resource; import org.eclipse.rdf4j.model.Statement; import org.eclipse.rdf4j.model.Value; -import org.eclipse.rdf4j.model.impl.BooleanLiteralImpl; -import org.eclipse.rdf4j.model.impl.LiteralImpl; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.eclipse.rdf4j.repository.Repository; import org.eclipse.rdf4j.repository.RepositoryConnection; import org.eclipse.rdf4j.repository.RepositoryException; @@ -86,7 +84,7 @@ private void doParseRdfInputStream(InputStream stream) throws BridgeDBException RepositoryConnection repositoryConnection = null; try { repository = new SailRepository(new MemoryStore()); - repository.initialize(); + repository.init(); repositoryConnection = repository.getConnection(); repositoryConnection.add(stream, DEFAULT_BASE_URI, DEFAULT_FILE_FORMAT); readAllDataSources(repositoryConnection); @@ -216,7 +214,7 @@ public DataSource readDataSource(RepositoryConnection repositoryConnection, Reso private void readCodeMapper(RepositoryConnection repositoryConnection, String systemCode, Pattern regex) throws RepositoryException, BridgeDBException { RepositoryResult statements = - repositoryConnection.getStatements(null, BridgeDBConstants.SYSTEM_CODE_URI, new LiteralImpl(systemCode), true); + repositoryConnection.getStatements(null, BridgeDBConstants.SYSTEM_CODE_URI, SimpleValueFactory.getInstance().createLiteral(systemCode), true); // String xrefPrefix = null; Resource codeMapperReseource = null; while (statements.hasNext()) { @@ -321,7 +319,7 @@ public static void writeRdfToFile(File file, SortedSet dataSources) RepositoryConnection repositoryConnection = null; try { repository = new SailRepository(new MemoryStore()); - repository.initialize(); + repository.init(); repositoryConnection = repository.getConnection(); for (DataSource dataSource: dataSources){ writeDataSource(repositoryConnection, dataSource); @@ -341,29 +339,25 @@ private static void writeDataSource(RepositoryConnection repositoryConnection, D repositoryConnection.add(id, RdfConstants.TYPE_URI, BridgeDBConstants.DATA_SOURCE_URI); if (dataSource.getFullName() != null){ - repositoryConnection.add(id, BridgeDBConstants.FULL_NAME_URI, new LiteralImpl(dataSource.getFullName())); + repositoryConnection.add(id, BridgeDBConstants.FULL_NAME_URI, SimpleValueFactory.getInstance().createLiteral(dataSource.getFullName())); } if (dataSource.getSystemCode() != null && (!dataSource.getSystemCode().trim().isEmpty())){ - repositoryConnection.add(id, BridgeDBConstants.SYSTEM_CODE_URI, new LiteralImpl(dataSource.getSystemCode())); + repositoryConnection.add(id, BridgeDBConstants.SYSTEM_CODE_URI, SimpleValueFactory.getInstance().createLiteral(dataSource.getSystemCode())); } if (dataSource.getMainUrl() != null){ - repositoryConnection.add(id, BridgeDBConstants.MAIN_URL_URI, new LiteralImpl(dataSource.getMainUrl())); + repositoryConnection.add(id, BridgeDBConstants.MAIN_URL_URI, SimpleValueFactory.getInstance().createLiteral(dataSource.getMainUrl())); } if (dataSource.getExample() != null && dataSource.getExample().getId() != null){ - repositoryConnection.add(id, BridgeDBConstants.ID_EXAMPLE_URI, new LiteralImpl(dataSource.getExample().getId())); + repositoryConnection.add(id, BridgeDBConstants.ID_EXAMPLE_URI, SimpleValueFactory.getInstance().createLiteral(dataSource.getExample().getId())); } - if (dataSource.isPrimary()){ - repositoryConnection.add(id, BridgeDBConstants.PRIMARY_URI, BooleanLiteralImpl.TRUE); - } else { - repositoryConnection.add(id, BridgeDBConstants.PRIMARY_URI, BooleanLiteralImpl.FALSE); - } + repositoryConnection.add(id, BridgeDBConstants.PRIMARY_URI, SimpleValueFactory.getInstance().createLiteral(dataSource.isPrimary())); if (dataSource.getType() != null){ - repositoryConnection.add(id, BridgeDBConstants.TYPE_URI, new LiteralImpl(dataSource.getType())); + repositoryConnection.add(id, BridgeDBConstants.TYPE_URI, SimpleValueFactory.getInstance().createLiteral(dataSource.getType())); } Pattern regex = DataSourcePatterns.getPatterns().get(dataSource); @@ -391,16 +385,16 @@ private static void writeDataSource(RepositoryConnection repositoryConnection, D Pattern pattern = DataSourcePatterns.getPatterns().get(dataSource); if (pattern != null && !pattern.toString().isEmpty()){ - Value patternValue = new LiteralImpl(pattern.toString()); + Value patternValue = SimpleValueFactory.getInstance().createLiteral(pattern.toString()); repositoryConnection.add(id, BridgeDBConstants.HAS_REGEX_PATTERN_URI, patternValue); } if (dataSource.getAlternative() != null){ - repositoryConnection.add(id, DCTermsConstants.ALTERNATIVE_URI, new LiteralImpl(dataSource.getAlternative())); + repositoryConnection.add(id, DCTermsConstants.ALTERNATIVE_URI, SimpleValueFactory.getInstance().createLiteral(dataSource.getAlternative())); } if (dataSource.getDescription() != null){ - repositoryConnection.add(id, DCatConstants.DESCRIPTION_URI, new LiteralImpl(dataSource.getDescription())); + repositoryConnection.add(id, DCatConstants.DESCRIPTION_URI, SimpleValueFactory.getInstance().createLiteral(dataSource.getDescription())); } SortedSet sortedPatterns = UriPattern.byCodeAndType(dataSource.getSystemCode(), UriPatternType.dataSourceUriPattern); @@ -421,8 +415,8 @@ private static void writeCodeMapper(RepositoryConnection repositoryConnection, D } Resource id = asCodeMapperResource(dataSource); repositoryConnection.add(id, RdfConstants.TYPE_URI, BridgeDBConstants.CODE_MAPPER_URI); - repositoryConnection.add(id, BridgeDBConstants.SYSTEM_CODE_URI, new LiteralImpl(dataSource.getSystemCode())); - Value prefixValue = new LiteralImpl(xrefPrefix); + repositoryConnection.add(id, BridgeDBConstants.SYSTEM_CODE_URI, SimpleValueFactory.getInstance().createLiteral(dataSource.getSystemCode())); + Value prefixValue = SimpleValueFactory.getInstance().createLiteral(xrefPrefix); repositoryConnection.add(id, BridgeDBConstants.XREF_PREFIX_URI, prefixValue); SortedSet sortedPatterns = UriPattern.byCodeAndType(dataSource.getSystemCode(), UriPatternType.codeMapperPattern); @@ -476,17 +470,17 @@ private static RDFFormat getFormat(File file){ protected static Resource asResource(DataSource dataSource) { if (dataSource.getFullName() == null){ - return new URIImpl(BridgeDBConstants.DATA_SOURCE1 + "_bysysCode_" + scrub(dataSource.getSystemCode())); + return SimpleValueFactory.getInstance().createIRI(BridgeDBConstants.DATA_SOURCE1 + "_bysysCode_" + scrub(dataSource.getSystemCode())); } else { - return new URIImpl(BridgeDBConstants.DATA_SOURCE1 + "_" + scrub(dataSource.getFullName())); + return SimpleValueFactory.getInstance().createIRI(BridgeDBConstants.DATA_SOURCE1 + "_" + scrub(dataSource.getFullName())); } } protected static Resource asCodeMapperResource(DataSource dataSource) { if (dataSource.getFullName() == null){ - return new URIImpl(BridgeDBConstants.CODE_MAPPER1 + "_bysysCode_" + scrub(dataSource.getSystemCode())); + return SimpleValueFactory.getInstance().createIRI(BridgeDBConstants.CODE_MAPPER1 + "_bysysCode_" + scrub(dataSource.getSystemCode())); } else { - return new URIImpl(BridgeDBConstants.CODE_MAPPER1 + "_" + scrub(dataSource.getFullName())); + return SimpleValueFactory.getInstance().createIRI(BridgeDBConstants.CODE_MAPPER1 + "_" + scrub(dataSource.getFullName())); } } diff --git a/org.bridgedb.rdf/src/org/bridgedb/rdf/OrganismRdf.java b/org.bridgedb.rdf/src/org/bridgedb/rdf/OrganismRdf.java index 36407e02b..a25752ffa 100644 --- a/org.bridgedb.rdf/src/org/bridgedb/rdf/OrganismRdf.java +++ b/org.bridgedb.rdf/src/org/bridgedb/rdf/OrganismRdf.java @@ -22,16 +22,16 @@ import java.io.IOException; import java.util.HashMap; import java.util.Set; + import org.bridgedb.bio.Organism; import org.bridgedb.rdf.constants.BridgeDBConstants; import org.bridgedb.rdf.constants.RdfConstants; import org.bridgedb.utils.BridgeDBException; +import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.Resource; import org.eclipse.rdf4j.model.Statement; -import org.eclipse.rdf4j.model.URI; import org.eclipse.rdf4j.model.Value; -import org.eclipse.rdf4j.model.impl.LiteralImpl; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.eclipse.rdf4j.repository.RepositoryConnection; import org.eclipse.rdf4j.repository.RepositoryException; import org.eclipse.rdf4j.rio.RDFHandler; @@ -64,8 +64,8 @@ public static final String getRdfLabel(Organism organism) { return scrub(organism.code()); } - public static final URI getResourceId(Organism organism){ - return new URIImpl(BridgeDBConstants.ORGANISM1 + "_" + getRdfLabel(organism)); + public static final IRI getResourceId(Organism organism){ + return SimpleValueFactory.getInstance().createIRI(BridgeDBConstants.ORGANISM1 + "_" + getRdfLabel(organism)); } public static void addAll(RepositoryConnection repositoryConnection) throws IOException, RepositoryException { @@ -82,11 +82,11 @@ public void addComments(RDFHandler handler) throws RDFHandlerException{ public static void add(RepositoryConnection repositoryConnection, Organism organism) throws IOException, RepositoryException { - URI id = getResourceId(organism); + IRI id = getResourceId(organism); repositoryConnection.add(id, RdfConstants.TYPE_URI, BridgeDBConstants.ORGANISM_URI); - repositoryConnection.add(id, BridgeDBConstants.CODE_URI, new LiteralImpl(organism.code())); - repositoryConnection.add(id, BridgeDBConstants.SHORT_NAME_URI, new LiteralImpl(organism.shortName())); - repositoryConnection.add(id, BridgeDBConstants.LATIN_NAME_URI, new LiteralImpl(organism.latinName())); + repositoryConnection.add(id, BridgeDBConstants.CODE_URI, SimpleValueFactory.getInstance().createLiteral(organism.code())); + repositoryConnection.add(id, BridgeDBConstants.SHORT_NAME_URI, SimpleValueFactory.getInstance().createLiteral(organism.shortName())); + repositoryConnection.add(id, BridgeDBConstants.LATIN_NAME_URI, SimpleValueFactory.getInstance().createLiteral(organism.latinName())); } public static Object readRdf(Resource organismId, Set allStatements) throws BridgeDBException { diff --git a/org.bridgedb.rdf/src/org/bridgedb/rdf/RdfBase.java b/org.bridgedb.rdf/src/org/bridgedb/rdf/RdfBase.java index 3c2999eda..11847b3d9 100644 --- a/org.bridgedb.rdf/src/org/bridgedb/rdf/RdfBase.java +++ b/org.bridgedb.rdf/src/org/bridgedb/rdf/RdfBase.java @@ -21,13 +21,14 @@ import java.util.HashSet; import java.util.Set; + import org.apache.log4j.Logger; import org.bridgedb.utils.BridgeDBException; +import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.Resource; import org.eclipse.rdf4j.model.Statement; -import org.eclipse.rdf4j.model.URI; import org.eclipse.rdf4j.model.Value; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.eclipse.rdf4j.repository.Repository; import org.eclipse.rdf4j.repository.RepositoryConnection; import org.eclipse.rdf4j.repository.RepositoryException; @@ -61,7 +62,7 @@ static String convertToShortName(Value value) { return id; } - public static String getSingletonString(RepositoryConnection repositoryConnection, Resource id, URI predicate) + public static String getSingletonString(RepositoryConnection repositoryConnection, Resource id, IRI predicate) throws BridgeDBException, RepositoryException { String result = getPossibleSingletonString(repositoryConnection, id, predicate); if (result == null){ @@ -71,7 +72,7 @@ public static String getSingletonString(RepositoryConnection repositoryConnectio } public static String getPossibleSingletonString(RepositoryConnection repositoryConnection, Resource id, - URI predicate) throws RepositoryException, BridgeDBException { + IRI predicate) throws RepositoryException, BridgeDBException { Value result = getPossibleSingleton(repositoryConnection, id, predicate); if (result == null) { return null; @@ -81,7 +82,7 @@ public static String getPossibleSingletonString(RepositoryConnection repositoryC } static Resource getPossibleSingletonResource(RepositoryConnection repositoryConnection, Resource id, - URI predicate) throws RepositoryException, BridgeDBException { + IRI predicate) throws RepositoryException, BridgeDBException { Value value = getPossibleSingleton(repositoryConnection, id, predicate); return toResource(value); } @@ -92,11 +93,11 @@ private static Resource toResource(Value value){ } else if (value instanceof Resource){ return (Resource)value; } - return new URIImpl(value.stringValue()); + return SimpleValueFactory.getInstance().createIRI(value.stringValue()); } static Value getPossibleSingleton(RepositoryConnection repositoryConnection, Resource id, - URI predicate) throws RepositoryException, BridgeDBException { + IRI predicate) throws RepositoryException, BridgeDBException { RepositoryResult statements = repositoryConnection.getStatements(id, predicate, null, true); if (statements.hasNext()) { @@ -111,7 +112,7 @@ static Value getPossibleSingleton(RepositoryConnection repositoryConnection, Res return null; } - static Set getAllStrings(RepositoryConnection repositoryConnection, Resource id, URI predicate) + static Set getAllStrings(RepositoryConnection repositoryConnection, Resource id, IRI predicate) throws RepositoryException { HashSet results = new HashSet(); RepositoryResult statements = @@ -123,7 +124,7 @@ static Set getAllStrings(RepositoryConnection repositoryConnection, Reso return results; } - static Set getAllResources(RepositoryConnection repositoryConnection, Resource id, URI predicate) + static Set getAllResources(RepositoryConnection repositoryConnection, Resource id, IRI predicate) throws RepositoryException { HashSet results = new HashSet(); RepositoryResult statements = diff --git a/org.bridgedb.rdf/src/org/bridgedb/rdf/UriPattern.java b/org.bridgedb.rdf/src/org/bridgedb/rdf/UriPattern.java index af615b6c4..362e8b4ad 100644 --- a/org.bridgedb.rdf/src/org/bridgedb/rdf/UriPattern.java +++ b/org.bridgedb.rdf/src/org/bridgedb/rdf/UriPattern.java @@ -27,18 +27,17 @@ import java.util.SortedSet; import java.util.TreeSet; import java.util.regex.Pattern; + import org.bridgedb.DataSource; import org.bridgedb.DataSourcePatterns; import org.bridgedb.bio.DataSourceTxt; import org.bridgedb.rdf.constants.BridgeDBConstants; -import org.bridgedb.rdf.constants.IdenitifiersOrgConstants; import org.bridgedb.rdf.constants.RdfConstants; import org.bridgedb.rdf.identifiers.org.IdentifersOrgReader; import org.bridgedb.utils.BridgeDBException; +import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.Resource; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.LiteralImpl; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.eclipse.rdf4j.repository.RepositoryConnection; import org.eclipse.rdf4j.repository.RepositoryException; @@ -59,7 +58,7 @@ public class UriPattern extends RdfBase implements Comparable{ private static HashMap> byCode = new HashMap>(); static boolean initialized = false; - private static HashSet expectedPredicates = new HashSet(Arrays.asList(new URI[] { + private static HashSet expectedPredicates = new HashSet(Arrays.asList(new IRI[] { BridgeDBConstants.HAS_POSTFIX_URI, BridgeDBConstants.HAS_PREFIX_URI, RdfConstants.TYPE_URI, @@ -201,8 +200,8 @@ public static UriPattern existingByPrefixAndPostfix(String prefix, String postfi return existingByPattern(prefix + "$id" + postfix); } - public final URI getResourceId(){ - return new URIImpl(getUriPattern()); + public final IRI getResourceId(){ + return SimpleValueFactory.getInstance().createIRI(getUriPattern()); } public String getUriPattern() { @@ -221,11 +220,11 @@ public static void addAll(RepositoryConnection repositoryConnection) } public void add(RepositoryConnection repositoryConnection) throws RepositoryException{ - URI id = getResourceId(); + IRI id = getResourceId(); repositoryConnection.add(id, RdfConstants.TYPE_URI, BridgeDBConstants.URI_PATTERN_URI); - repositoryConnection.add(id, BridgeDBConstants.HAS_PREFIX_URI, new LiteralImpl(prefix)); + repositoryConnection.add(id, BridgeDBConstants.HAS_PREFIX_URI, SimpleValueFactory.getInstance().createLiteral(prefix)); if (!postfix.isEmpty()){ - repositoryConnection.add(id, BridgeDBConstants.HAS_POSTFIX_URI, new LiteralImpl(postfix)); + repositoryConnection.add(id, BridgeDBConstants.HAS_POSTFIX_URI, SimpleValueFactory.getInstance().createLiteral(postfix)); } } diff --git a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/BridgeDBConstants.java b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/BridgeDBConstants.java index b88c61eb1..d0546c091 100644 --- a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/BridgeDBConstants.java +++ b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/BridgeDBConstants.java @@ -19,14 +19,15 @@ // package org.bridgedb.rdf.constants; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; /** * * @author Christian */ public class BridgeDBConstants { + private static final SimpleValueFactory factory = SimpleValueFactory.getInstance(); public static final String OLD_PREFIX = "http://openphacts.cs.man.ac.uk:9090/ontology/DataSource.owl#"; public static final String OLD_PREFIX_NAME = "bridgeDB"; @@ -36,92 +37,92 @@ public class BridgeDBConstants { //Types public static final String DATA_SOURCE_LABEL = "DataSource"; public static final String DATA_SOURCE1 = PREFIX + DATA_SOURCE_LABEL; - public static final URI DATA_SOURCE_URI = new URIImpl(PREFIX + DATA_SOURCE_LABEL); + public static final IRI DATA_SOURCE_URI = factory.createIRI(PREFIX + DATA_SOURCE_LABEL); //public static final String URI_MAPPING = "UriMapping"; - //public static final URI URI_MAPPING_URI = new URIImpl(PREFIX + URI_MAPPING); + //public static final IRI URI_MAPPING_URI = factory.createIRI(PREFIX + URI_MAPPING); public static final String URI_PATTERN_LABEL = "UriPattern"; public static final String URI_PATTERN1 = PREFIX + URI_PATTERN_LABEL; - public static final URI URI_PATTERN_URI = new URIImpl(URI_PATTERN1); + public static final IRI URI_PATTERN_URI = factory.createIRI(URI_PATTERN1); //DataSource fields private static final String FULL_NAME = "fullName"; - public static final URI FULL_NAME_URI = new URIImpl(PREFIX + FULL_NAME); + public static final IRI FULL_NAME_URI = factory.createIRI(PREFIX + FULL_NAME); private static final String ID_EXAMPLE = "idExample"; - public static final URI ID_EXAMPLE_URI = new URIImpl(PREFIX + ID_EXAMPLE); + public static final IRI ID_EXAMPLE_URI = factory.createIRI(PREFIX + ID_EXAMPLE); private static final String MAIN_URL = "mainUrl"; - public static final URI MAIN_URL_URI = new URIImpl(PREFIX + MAIN_URL); + public static final IRI MAIN_URL_URI = factory.createIRI(PREFIX + MAIN_URL); public static final String ORGANISM_LABEL = "Organism"; public static final String ORGANISM1 = PREFIX + ORGANISM_LABEL; - public static final URI ORGANISM_URI = new URIImpl(ORGANISM1); + public static final IRI ORGANISM_URI = factory.createIRI(ORGANISM1); public static final String ABOUT_ORGANISM_LABEL = "aboutOrganism"; public static final String ABOUT_ORGANISM1 = PREFIX + ORGANISM_LABEL; - public static final URI ABOUT_ORGANISM_URI = new URIImpl(ORGANISM1); + public static final IRI ABOUT_ORGANISM_URI = factory.createIRI(ORGANISM1); private static final String PRIMARY = "primary"; - public static final URI PRIMARY_URI = new URIImpl(PREFIX + PRIMARY); + public static final IRI PRIMARY_URI = factory.createIRI(PREFIX + PRIMARY); private static final String SYSTEM_CODE = "systemCode"; - public static final URI SYSTEM_CODE_URI = new URIImpl(PREFIX + SYSTEM_CODE); + public static final IRI SYSTEM_CODE_URI = factory.createIRI(PREFIX + SYSTEM_CODE); private static final String TYPE = "type"; - public static final URI TYPE_URI = new URIImpl(PREFIX + TYPE); - public static final URI HAS_DATA_TYPE_URI = new URIImpl(PREFIX + "hasDataType"); + public static final IRI TYPE_URI = factory.createIRI(PREFIX + TYPE); + public static final IRI HAS_DATA_TYPE_URI = factory.createIRI(PREFIX + "hasDataType"); - public static final URI HAS_REGEX_PATTERN_URI = new URIImpl(PREFIX + "hasRegexPattern"); - public static final URI HAS_REGEX_URL_PATTERN_URI = new URIImpl(PREFIX + "hasRegexUrlPattern"); - public static final URI HAS_PRIMARY_URI_PATTERN_URI = new URIImpl(PREFIX + "hasPrimaryUriPattern"); - public static final URI HAS_URI_PATTERN_URI = new URIImpl(PREFIX + "hasUriPattern"); - public static final URI HAS_REGEX_URI_PATTERN_URI = new URIImpl(PREFIX + "hasRegexUriPattern"); - public static final URI IS_DEPRICATED_BY_URI = new URIImpl(PREFIX + "isDepricatedBy"); + public static final IRI HAS_REGEX_PATTERN_URI = factory.createIRI(PREFIX + "hasRegexPattern"); + public static final IRI HAS_REGEX_URL_PATTERN_URI = factory.createIRI(PREFIX + "hasRegexUrlPattern"); + public static final IRI HAS_PRIMARY_URI_PATTERN_URI = factory.createIRI(PREFIX + "hasPrimaryUriPattern"); + public static final IRI HAS_URI_PATTERN_URI = factory.createIRI(PREFIX + "hasUriPattern"); + public static final IRI HAS_REGEX_URI_PATTERN_URI = factory.createIRI(PREFIX + "hasRegexUriPattern"); + public static final IRI IS_DEPRICATED_BY_URI = factory.createIRI(PREFIX + "isDepricatedBy"); public static final String VARIOUS = PREFIX + "various"; //old verions private static final String URN_BASE = "urnBase"; - public static final URI URN_BASE_URI = new URIImpl(PREFIX + URN_BASE); + public static final IRI URN_BASE_URI = factory.createIRI(PREFIX + URN_BASE); //Organism Fields private static final String CODE = "code"; - public static final URI CODE_URI = new URIImpl(PREFIX + CODE); + public static final IRI CODE_URI = factory.createIRI(PREFIX + CODE); private static final String SHORT_NAME = "shortName"; - public static final URI SHORT_NAME_URI = new URIImpl(PREFIX + SHORT_NAME); + public static final IRI SHORT_NAME_URI = factory.createIRI(PREFIX + SHORT_NAME); private static final String LATIN_NAME = "latinName"; - public static final URI LATIN_NAME_URI = new URIImpl(PREFIX + LATIN_NAME); + public static final IRI LATIN_NAME_URI = factory.createIRI(PREFIX + LATIN_NAME); //UriPatternFields private static final String HAS_PREFIX = "hasPrefix"; - public static final URI HAS_PREFIX_URI = new URIImpl(PREFIX + HAS_PREFIX); + public static final IRI HAS_PREFIX_URI = factory.createIRI(PREFIX + HAS_PREFIX); private static final String HAS_POSTFIX = "hasPostfix"; - public static final URI HAS_POSTFIX_URI = new URIImpl(PREFIX + HAS_POSTFIX); + public static final IRI HAS_POSTFIX_URI = factory.createIRI(PREFIX + HAS_POSTFIX); private static final String IDENTIFERS_ORG_PATTERN = "IdentifiersOrgPattern"; - public static final URI HAS_IDENTIFERS_ORG_PATTERN_URI = new URIImpl(PREFIX + "has" + IDENTIFERS_ORG_PATTERN); + public static final IRI HAS_IDENTIFERS_ORG_PATTERN_URI = factory.createIRI(PREFIX + "has" + IDENTIFERS_ORG_PATTERN); private static final String IDENTIFERS_ORG_INFO_PATTERN = "IdentifiersOrgInfoPattern"; - public static final URI HAS_IDENTIFERS_ORG_INFO_PATTERN_URI = new URIImpl(PREFIX + "has" + IDENTIFERS_ORG_INFO_PATTERN); + public static final IRI HAS_IDENTIFERS_ORG_INFO_PATTERN_URI = factory.createIRI(PREFIX + "has" + IDENTIFERS_ORG_INFO_PATTERN); //CodeMapper feilds private static final String CODE_MAPPER = "CodeMapper"; public static final String CODE_MAPPER1 = PREFIX + CODE_MAPPER; - public static final URI CODE_MAPPER_URI = new URIImpl(CODE_MAPPER1); + public static final IRI CODE_MAPPER_URI = factory.createIRI(CODE_MAPPER1); private static final String XREF_PREFIX = "xrefPrefix"; - public static final URI XREF_PREFIX_URI = new URIImpl(PREFIX + XREF_PREFIX); + public static final IRI XREF_PREFIX_URI = factory.createIRI(PREFIX + XREF_PREFIX); - public static final URI HAS_DATA_SOURCE = new URIImpl(PREFIX + "hasDataSource"); - public static final URI IS_URI_PATTERN_OF = new URIImpl(PREFIX + "isUriPatternOf"); + public static final IRI HAS_DATA_SOURCE = factory.createIRI(PREFIX + "hasDataSource"); + public static final IRI IS_URI_PATTERN_OF = factory.createIRI(PREFIX + "isUriPatternOf"); private static final String bdb = "http://www.bridgedb.org/test#"; - public static final URI TEST_PREDICATE = new URIImpl(bdb + "testPredicate"); + public static final IRI TEST_PREDICATE = factory.createIRI(bdb + "testPredicate"); - public static final URI ASSERTION_METHOD = new URIImpl(PREFIX + "assertionMethod "); - public static final URI VIA_URI = new URIImpl(PREFIX + "isTransativeVia"); - public static final URI IS_SYMETRIC = new URIImpl(PREFIX + "isSymetric"); - public static final URI LINKSET_JUSTIFICATION = new URIImpl(PREFIX + "linksetJustification"); - public static final URI SUBJECTS_DATATYPE = new URIImpl(PREFIX + "subjectsDatatype"); - public static final URI OBJECTS_DATATYPE = new URIImpl(PREFIX + "objectsDatatype"); - public static final URI SUBJECTS_SPECIES = new URIImpl(PREFIX + "subjectsSpecies"); - public static final URI OBJECTS_SPECIES = new URIImpl(PREFIX + "objectsSpecies"); - public static final URI FULFILLS_LENS = new URIImpl(PREFIX + "fulfillsLens"); + public static final IRI ASSERTION_METHOD = factory.createIRI(PREFIX + "assertionMethod "); + public static final IRI VIA_URI = factory.createIRI(PREFIX + "isTransativeVia"); + public static final IRI IS_SYMETRIC = factory.createIRI(PREFIX + "isSymetric"); + public static final IRI LINKSET_JUSTIFICATION = factory.createIRI(PREFIX + "linksetJustification"); + public static final IRI SUBJECTS_DATATYPE = factory.createIRI(PREFIX + "subjectsDatatype"); + public static final IRI OBJECTS_DATATYPE = factory.createIRI(PREFIX + "objectsDatatype"); + public static final IRI SUBJECTS_SPECIES = factory.createIRI(PREFIX + "subjectsSpecies"); + public static final IRI OBJECTS_SPECIES = factory.createIRI(PREFIX + "objectsSpecies"); + public static final IRI FULFILLS_LENS = factory.createIRI(PREFIX + "fulfillsLens"); - public static final URI LENS_URI = new URIImpl(PREFIX + "lens"); + public static final IRI LENS_URI = factory.createIRI(PREFIX + "lens"); public static final String TRANSITIVE = PREFIX + "Transitive"; - public static final URI TRANSITIVE_URI = new URIImpl(TRANSITIVE); + public static final IRI TRANSITIVE_URI = factory.createIRI(TRANSITIVE); } diff --git a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/CitoConstants.java b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/CitoConstants.java index 43b69f2cf..0d036730a 100644 --- a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/CitoConstants.java +++ b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/CitoConstants.java @@ -4,8 +4,8 @@ */ package org.bridgedb.rdf.constants; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; /** * @@ -16,6 +16,6 @@ public class CitoConstants { public static final String PREFIX_NAME = "cito"; public static final String CITE_AS_AUTHORITY = "citeAsAuthority"; - public static final URI CITE_AS_AUTHORITY_URI = new URIImpl(voidns + CITE_AS_AUTHORITY); + public static final IRI CITE_AS_AUTHORITY_URI = SimpleValueFactory.getInstance().createIRI(voidns + CITE_AS_AUTHORITY); } diff --git a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/DCTermsConstants.java b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/DCTermsConstants.java index 27be81a10..0da39f63d 100644 --- a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/DCTermsConstants.java +++ b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/DCTermsConstants.java @@ -4,35 +4,37 @@ */ package org.bridgedb.rdf.constants; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; /** * * @author Christian */ public class DCTermsConstants { + private static final SimpleValueFactory factory = SimpleValueFactory.getInstance(); + public static final String voidns = "http://purl.org/dc/terms/"; public static final String PREFIX_NAME = "dcterms"; public static final String ACCRUAL_PERIODICITY = "accrualPeriodicity"; - public static final URI ACCRUAL_PERIODICITY_URI = new URIImpl(voidns + ACCRUAL_PERIODICITY); + public static final IRI ACCRUAL_PERIODICITY_URI = factory.createIRI(voidns + ACCRUAL_PERIODICITY); public static final String ALTERNATIVE = "alternative"; - public static final URI ALTERNATIVE_URI = new URIImpl(voidns + ALTERNATIVE); + public static final IRI ALTERNATIVE_URI = factory.createIRI(voidns + ALTERNATIVE); public static final String DESCRIPTION = "description"; - public static final URI DESCRIPTION_URI = new URIImpl(voidns + DESCRIPTION); + public static final IRI DESCRIPTION_URI = factory.createIRI(voidns + DESCRIPTION); public static final String ISSUED = "issued"; - public static final URI ISSUED_URI = new URIImpl(voidns + ISSUED); + public static final IRI ISSUED_URI = factory.createIRI(voidns + ISSUED); public static final String LICENSE = "license"; - public static final URI LICENSE_URI = new URIImpl(voidns + LICENSE); + public static final IRI LICENSE_URI = factory.createIRI(voidns + LICENSE); public static final String PUBLISHER = "publisher"; - public static final URI PUBLISHER_URI = new URIImpl(voidns + PUBLISHER); + public static final IRI PUBLISHER_URI = factory.createIRI(voidns + PUBLISHER); public static final String TITLE = "title"; - public static final URI TITLE_URI = new URIImpl(voidns + TITLE); + public static final IRI TITLE_URI = factory.createIRI(voidns + TITLE); } diff --git a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/DCatConstants.java b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/DCatConstants.java index 2e7ee9b89..443f80700 100644 --- a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/DCatConstants.java +++ b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/DCatConstants.java @@ -4,35 +4,37 @@ */ package org.bridgedb.rdf.constants; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; /** * * @author Christian */ public class DCatConstants { + private static final SimpleValueFactory factory = SimpleValueFactory.getInstance(); + public static final String voidns = "http://www.w3.org/ns/dcat#"; public static final String PREFIX_NAME = "dcat"; public static final String ACCESS_URL = "accessURL"; - public static final URI ACCESS_URL_URI = new URIImpl(voidns + ACCESS_URL); + public static final IRI ACCESS_URL_URI = factory.createIRI(voidns + ACCESS_URL); public static final String BYTE_SIZE = "byteSize"; - public static final URI BYTE_SIZE_URI = new URIImpl(voidns + BYTE_SIZE); + public static final IRI BYTE_SIZE_URI = factory.createIRI(voidns + BYTE_SIZE); public static final String DESCRIPTION = "description"; - public static final URI DESCRIPTION_URI = new URIImpl(voidns + DESCRIPTION); + public static final IRI DESCRIPTION_URI = factory.createIRI(voidns + DESCRIPTION); public static final String DISTRIBUTION = "distribution"; - public static final URI DISTRIBUTION_URI = new URIImpl(voidns + DISTRIBUTION); + public static final IRI DISTRIBUTION_URI = factory.createIRI(voidns + DISTRIBUTION); public static final String DOWNLOAD = "downloadURL"; - public static final URI DOWNLOAD_URI = new URIImpl(voidns + DOWNLOAD); + public static final IRI DOWNLOAD_URI = factory.createIRI(voidns + DOWNLOAD); public static final String LANDING_PAGE = "landingPage"; - public static final URI LANDING_PAGE_URI = new URIImpl(voidns + LANDING_PAGE); + public static final IRI LANDING_PAGE_URI = factory.createIRI(voidns + LANDING_PAGE); public static final String MEDIA_TYPE = "mediaType "; - public static final URI MEDIA_TYPE_URI = new URIImpl(voidns + MEDIA_TYPE); + public static final IRI MEDIA_TYPE_URI = factory.createIRI(voidns + MEDIA_TYPE); public static final String THEME = "theme"; - public static final URI THEME_URI = new URIImpl(voidns + THEME); + public static final IRI THEME_URI = factory.createIRI(voidns + THEME); public static final String TITLE = "title"; - public static final URI TITLE_URI = new URIImpl(voidns + TITLE); + public static final IRI TITLE_URI = factory.createIRI(voidns + TITLE); diff --git a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/DulConstants.java b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/DulConstants.java index 7d78296fb..ba92aab66 100644 --- a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/DulConstants.java +++ b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/DulConstants.java @@ -19,13 +19,13 @@ // package org.bridgedb.rdf.constants; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; public class DulConstants { public static final String dulns = "http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#"; - public static final URI EXPRESSES = new URIImpl(dulns + "expresses"); + public static final IRI EXPRESSES = SimpleValueFactory.getInstance().createIRI(dulns + "expresses"); } diff --git a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/FoafConstants.java b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/FoafConstants.java index 0bd87ca78..17a5be926 100644 --- a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/FoafConstants.java +++ b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/FoafConstants.java @@ -4,21 +4,23 @@ */ package org.bridgedb.rdf.constants; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; /** * * @author Christian */ public class FoafConstants { + private static final SimpleValueFactory factory = SimpleValueFactory.getInstance(); + public static final String voidns = "http://xmlns.com/foaf/0.1/"; public static final String PREFIX_NAME = "foaf"; public static final String PAGE = "citeAsAuthority"; - public static final URI PAGE_URI = new URIImpl(voidns + PAGE); + public static final IRI PAGE_URI = factory.createIRI(voidns + PAGE); public static final String PRIMARY_TOPIC = "primaryTopic"; - public static final URI PRIMARY_TOPIC_URI = new URIImpl(voidns + PRIMARY_TOPIC); + public static final IRI PRIMARY_TOPIC_URI = factory.createIRI(voidns + PRIMARY_TOPIC); } diff --git a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/IdenitifiersOrgConstants.java b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/IdenitifiersOrgConstants.java index 7bc37e1c6..c1dec6384 100644 --- a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/IdenitifiersOrgConstants.java +++ b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/IdenitifiersOrgConstants.java @@ -4,22 +4,22 @@ */ package org.bridgedb.rdf.constants; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; /** * * @author Christian */ public class IdenitifiersOrgConstants { + private static final SimpleValueFactory factory = SimpleValueFactory.getInstance(); + public static final String voidns = "http://identifiers.org/terms#"; public static final String PREFIX_NAME = "idot:"; public static final String NAMESPACE = "namespace"; - public static final URI NAMESPACE_URI = new URIImpl(voidns + NAMESPACE); + public static final IRI NAMESPACE_URI = factory.createIRI(voidns + NAMESPACE); public static final String REGEX = "idRegexPattern"; - public static final URI REGEX_URI = new URIImpl(voidns + REGEX); - - + public static final IRI REGEX_URI = factory.createIRI(voidns + REGEX); } diff --git a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/OWLConstants.java b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/OWLConstants.java index a6dcb8ed3..7ba7bb6a2 100644 --- a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/OWLConstants.java +++ b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/OWLConstants.java @@ -19,8 +19,8 @@ // package org.bridgedb.rdf.constants; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; /** * @@ -31,7 +31,7 @@ public class OWLConstants { public static final String EQUIVALENT_CLASS = xmlschemans + "equivalentClass"; public static final String SAME_AS = xmlschemans + "sameAs"; - public static final URI SAMEAS_URI = new URIImpl(SAME_AS); + public static final IRI SAMEAS_URI = SimpleValueFactory.getInstance().createIRI(SAME_AS); public static final String THING = "owl:Thing"; } diff --git a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/PavConstants.java b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/PavConstants.java index 7fb0909cc..abd85435c 100644 --- a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/PavConstants.java +++ b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/PavConstants.java @@ -19,37 +19,38 @@ // package org.bridgedb.rdf.constants; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; /** * */ public class PavConstants { - + private static final SimpleValueFactory factory = SimpleValueFactory.getInstance(); + private static final String pavTermns = "http://purl.org/pav/"; - public static final URI SOURCE_ACCESSED_BY = new URIImpl(pavTermns + "sourceAccessedBy"); - public static final URI SOURCE_ACCESSED_FROM = new URIImpl(pavTermns + "sourceAccessedAt"); - public static final URI SOURCE_ACCESSED_ON = new URIImpl(pavTermns + "sourceAccessedOn"); - public static final URI AUTHORED_BY = new URIImpl(pavTermns + "authoredBy"); - public static final URI AUTHORED_ON = new URIImpl(pavTermns + "authoredOn"); - public static final URI CREATED_BY = new URIImpl(pavTermns + "createdBy"); - public static final URI CREATED_ON = new URIImpl(pavTermns + "createdOn"); - public static final URI CREATED_WITH = new URIImpl(pavTermns + "createdWith"); - public static final URI DERIVED_BY = new URIImpl(pavTermns + "derivedBy"); - public static final URI DERIVED_FROM = new URIImpl(pavTermns + "derivedFrom"); - public static final URI DERIVED_ON = new URIImpl(pavTermns + "derivedOn"); - public static final URI IMPORTED_BY = new URIImpl(pavTermns + "importedBy"); - public static final URI IMPORTED_FROM = new URIImpl(pavTermns + "importedFrom"); - public static final URI IMPORTED_ON = new URIImpl(pavTermns + "importedOn"); - public static final URI LAST_REFERSHED_ON = new URIImpl(pavTermns + "lastRefreshedOn"); - public static final URI MODIFIED_ON = new URIImpl(pavTermns + "modified"); - public static final URI PREVIOUS_VERSION = new URIImpl(pavTermns + "previousVersion"); - public static final URI RETRIEVED_BY = new URIImpl(pavTermns + "retrievedBy"); - public static final URI RETRIEVED_ON = new URIImpl(pavTermns + "retrievedOn"); - public static final URI RETRIEVED_FROM = new URIImpl(pavTermns + "retrievedFrom"); - public static final URI VERSION = new URIImpl(pavTermns + "version"); + public static final IRI SOURCE_ACCESSED_BY = factory.createIRI(pavTermns + "sourceAccessedBy"); + public static final IRI SOURCE_ACCESSED_FROM = factory.createIRI(pavTermns + "sourceAccessedAt"); + public static final IRI SOURCE_ACCESSED_ON = factory.createIRI(pavTermns + "sourceAccessedOn"); + public static final IRI AUTHORED_BY = factory.createIRI(pavTermns + "authoredBy"); + public static final IRI AUTHORED_ON = factory.createIRI(pavTermns + "authoredOn"); + public static final IRI CREATED_BY = factory.createIRI(pavTermns + "createdBy"); + public static final IRI CREATED_ON = factory.createIRI(pavTermns + "createdOn"); + public static final IRI CREATED_WITH = factory.createIRI(pavTermns + "createdWith"); + public static final IRI DERIVED_BY = factory.createIRI(pavTermns + "derivedBy"); + public static final IRI DERIVED_FROM = factory.createIRI(pavTermns + "derivedFrom"); + public static final IRI DERIVED_ON = factory.createIRI(pavTermns + "derivedOn"); + public static final IRI IMPORTED_BY = factory.createIRI(pavTermns + "importedBy"); + public static final IRI IMPORTED_FROM = factory.createIRI(pavTermns + "importedFrom"); + public static final IRI IMPORTED_ON = factory.createIRI(pavTermns + "importedOn"); + public static final IRI LAST_REFERSHED_ON = factory.createIRI(pavTermns + "lastRefreshedOn"); + public static final IRI MODIFIED_ON = factory.createIRI(pavTermns + "modified"); + public static final IRI PREVIOUS_VERSION = factory.createIRI(pavTermns + "previousVersion"); + public static final IRI RETRIEVED_BY = factory.createIRI(pavTermns + "retrievedBy"); + public static final IRI RETRIEVED_ON = factory.createIRI(pavTermns + "retrievedOn"); + public static final IRI RETRIEVED_FROM = factory.createIRI(pavTermns + "retrievedFrom"); + public static final IRI VERSION = factory.createIRI(pavTermns + "version"); } diff --git a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/RdfConstants.java b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/RdfConstants.java index edab7a489..34de791ed 100644 --- a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/RdfConstants.java +++ b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/RdfConstants.java @@ -19,8 +19,8 @@ // package org.bridgedb.rdf.constants; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; /** * @@ -29,5 +29,5 @@ public class RdfConstants { static final String TYPE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"; - public static final URI TYPE_URI = new URIImpl(TYPE); + public static final IRI TYPE_URI = SimpleValueFactory.getInstance().createIRI(TYPE); } diff --git a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/VoidConstants.java b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/VoidConstants.java index b250e2925..336663915 100644 --- a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/VoidConstants.java +++ b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/VoidConstants.java @@ -19,33 +19,34 @@ // package org.bridgedb.rdf.constants; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; /** * */ public class VoidConstants { + private static final SimpleValueFactory factory = SimpleValueFactory.getInstance(); public static final String voidns = "http://rdfs.org/ns/void#"; public static final String PREFIX_NAME = "void:"; - public static final URI DATA_DUMP = new URIImpl(voidns + "dataDump"); - public static final URI DATASET = new URIImpl(voidns + "Dataset"); - public static final URI DATASET_DESCRIPTION = new URIImpl(voidns + "DatasetDescription"); - public static final URI EXAMPLE_RESOURCE = new URIImpl(voidns + "exampleResource"); - public static final URI LINK_PREDICATE = new URIImpl(voidns + "linkPredicate"); - public static final URI IN_DATASET = new URIImpl(voidns + "inDataset"); - public static final URI LINKSET = new URIImpl(voidns + "Linkset"); - public static final URI TARGET = new URIImpl(voidns + "target"); - public static final URI TRIPLES = new URIImpl(voidns + "triples"); - public static final URI SUBJECTSTARGET = new URIImpl(voidns + "subjectsTarget"); - public static final URI OBJECTSTARGET = new URIImpl(voidns + "objectsTarget"); - public static final URI SUBSET = new URIImpl(voidns + "subset"); - public static final URI SPARQL_ENDPOINT = new URIImpl(voidns + "sparqlEndpoint"); + public static final IRI DATA_DUMP = factory.createIRI(voidns + "dataDump"); + public static final IRI DATASET = factory.createIRI(voidns + "Dataset"); + public static final IRI DATASET_DESCRIPTION = factory.createIRI(voidns + "DatasetDescription"); + public static final IRI EXAMPLE_RESOURCE = factory.createIRI(voidns + "exampleResource"); + public static final IRI LINK_PREDICATE = factory.createIRI(voidns + "linkPredicate"); + public static final IRI IN_DATASET = factory.createIRI(voidns + "inDataset"); + public static final IRI LINKSET = factory.createIRI(voidns + "Linkset"); + public static final IRI TARGET = factory.createIRI(voidns + "target"); + public static final IRI TRIPLES = factory.createIRI(voidns + "triples"); + public static final IRI SUBJECTSTARGET = factory.createIRI(voidns + "subjectsTarget"); + public static final IRI OBJECTSTARGET = factory.createIRI(voidns + "objectsTarget"); + public static final IRI SUBSET = factory.createIRI(voidns + "subset"); + public static final IRI SPARQL_ENDPOINT = factory.createIRI(voidns + "sparqlEndpoint"); private static final String URI_SPACE = "uriSpace"; public static final String URI_SPACE_SHORT = PREFIX_NAME + URI_SPACE; - public static final URI URI_SPACE_URI = new URIImpl(voidns + URI_SPACE); - public static final URI VOCABULARY = new URIImpl(voidns + "vocabulary"); + public static final IRI URI_SPACE_URI = factory.createIRI(voidns + URI_SPACE); + public static final IRI VOCABULARY = factory.createIRI(voidns + "vocabulary"); } diff --git a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/XMLSchemaConstants.java b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/XMLSchemaConstants.java index 2a4103b4e..2b0394c0b 100644 --- a/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/XMLSchemaConstants.java +++ b/org.bridgedb.rdf/src/org/bridgedb/rdf/constants/XMLSchemaConstants.java @@ -19,37 +19,34 @@ // package org.bridgedb.rdf.constants; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; -/** - * - */ public class XMLSchemaConstants { - + private static final SimpleValueFactory factory = SimpleValueFactory.getInstance(); public static final String PREFIX = "http://www.w3.org/2001/XMLSchema#"; - public static final URI STRING = new URIImpl(PREFIX + "string"); - public static final URI BOOLEAN = new URIImpl(PREFIX + "boolean"); - public static final URI DECIMAL = new URIImpl(PREFIX + "decimal"); - public static final URI FLOAT = new URIImpl(PREFIX + "float"); - public static final URI DOUBLE = new URIImpl(PREFIX + "double"); - public static final URI DURATION = new URIImpl(PREFIX + "duration"); - public static final URI DATE_TIME = new URIImpl(PREFIX + "dateTime"); - public static final URI TIME = new URIImpl(PREFIX + "time"); - public static final URI DATE = new URIImpl(PREFIX + "date"); - public static final URI G_YEAR_MONTH = new URIImpl(PREFIX + "gYearMonth"); - public static final URI G_YEAR = new URIImpl(PREFIX + "gYear"); - public static final URI G_MONTH_DAY = new URIImpl(PREFIX + "gMonthDay"); - public static final URI G_DAY = new URIImpl(PREFIX + "gDay"); - public static final URI G_MONTH = new URIImpl(PREFIX + "gMonth"); - public static final URI HEX_BINARY = new URIImpl(PREFIX + "hexBinary"); - public static final URI BASE_64_BINARY = new URIImpl(PREFIX + "base64Binary"); - public static final URI ANY_URI = new URIImpl(PREFIX + "anyURI"); - public static final URI QNAME = new URIImpl(PREFIX + "QName"); - public static final URI NOTATION = new URIImpl(PREFIX + "NOTATION"); - public static final URI INTEGER = new URIImpl(PREFIX + "integer"); - public static final URI NON_NEGATIVE_INTEGER = new URIImpl(PREFIX + "nonNegativeInteger"); - public static final URI UNISGNED_BYTE = new URIImpl(PREFIX + "unsignedByte"); + public static final IRI STRING = factory.createIRI(PREFIX + "string"); + public static final IRI BOOLEAN = factory.createIRI(PREFIX + "boolean"); + public static final IRI DECIMAL = factory.createIRI(PREFIX + "decimal"); + public static final IRI FLOAT = factory.createIRI(PREFIX + "float"); + public static final IRI DOUBLE = factory.createIRI(PREFIX + "double"); + public static final IRI DURATION = factory.createIRI(PREFIX + "duration"); + public static final IRI DATE_TIME = factory.createIRI(PREFIX + "dateTime"); + public static final IRI TIME = factory.createIRI(PREFIX + "time"); + public static final IRI DATE = factory.createIRI(PREFIX + "date"); + public static final IRI G_YEAR_MONTH = factory.createIRI(PREFIX + "gYearMonth"); + public static final IRI G_YEAR = factory.createIRI(PREFIX + "gYear"); + public static final IRI G_MONTH_DAY = factory.createIRI(PREFIX + "gMonthDay"); + public static final IRI G_DAY = factory.createIRI(PREFIX + "gDay"); + public static final IRI G_MONTH = factory.createIRI(PREFIX + "gMonth"); + public static final IRI HEX_BINARY = factory.createIRI(PREFIX + "hexBinary"); + public static final IRI BASE_64_BINARY = factory.createIRI(PREFIX + "base64Binary"); + public static final IRI ANY_URI = factory.createIRI(PREFIX + "anyURI"); + public static final IRI QNAME = factory.createIRI(PREFIX + "QName"); + public static final IRI NOTATION = factory.createIRI(PREFIX + "NOTATION"); + public static final IRI INTEGER = factory.createIRI(PREFIX + "integer"); + public static final IRI NON_NEGATIVE_INTEGER = factory.createIRI(PREFIX + "nonNegativeInteger"); + public static final IRI UNISGNED_BYTE = factory.createIRI(PREFIX + "unsignedByte"); } diff --git a/org.bridgedb.rdf/src/org/bridgedb/rdf/create/FormatConvertor.java b/org.bridgedb.rdf/src/org/bridgedb/rdf/create/FormatConvertor.java index 4fb1e9434..415644f16 100644 --- a/org.bridgedb.rdf/src/org/bridgedb/rdf/create/FormatConvertor.java +++ b/org.bridgedb.rdf/src/org/bridgedb/rdf/create/FormatConvertor.java @@ -76,7 +76,7 @@ public static void convert(File inputFile, File outputFile) throws Exception { RepositoryConnection repositoryConnection = null; try { repository = new SailRepository(new MemoryStore()); - repository.initialize(); + repository.init(); repositoryConnection = repository.getConnection(); repositoryConnection.add(inputFile, DEFAULT_BASE_URI, getFormat(inputFile.getName())); writeRDF(repositoryConnection, outputFile); diff --git a/org.bridgedb.rdf/src/org/bridgedb/rdf/create/LinkSetCombiner.java b/org.bridgedb.rdf/src/org/bridgedb/rdf/create/LinkSetCombiner.java index b9d25a2cb..29fb8b077 100644 --- a/org.bridgedb.rdf/src/org/bridgedb/rdf/create/LinkSetCombiner.java +++ b/org.bridgedb.rdf/src/org/bridgedb/rdf/create/LinkSetCombiner.java @@ -77,7 +77,7 @@ public static void convert(Collection inputFiles, File outputFile) throws RepositoryConnection repositoryConnection = null; try { repository = new SailRepository(new MemoryStore()); - repository.initialize(); + repository.init(); repositoryConnection = repository.getConnection(); for (File inputFile:inputFiles){ Reporter.println("Parsing " + inputFile.getAbsolutePath()); @@ -96,7 +96,7 @@ public static long count(File inputFile) throws Exception { RepositoryConnection repositoryConnection = null; try { repository = new SailRepository(new MemoryStore()); - repository.initialize(); + repository.init(); repositoryConnection = repository.getConnection(); Reporter.println("Parsing (to count)" + inputFile.getAbsolutePath()); repositoryConnection.add(inputFile, DEFAULT_BASE_URI, getFormat(inputFile.getName())); diff --git a/org.bridgedb.rdf/src/org/bridgedb/rdf/identifiers/org/IdentifersOrgReader.java b/org.bridgedb.rdf/src/org/bridgedb/rdf/identifiers/org/IdentifersOrgReader.java index 777b7cdc4..32bd0d745 100644 --- a/org.bridgedb.rdf/src/org/bridgedb/rdf/identifiers/org/IdentifersOrgReader.java +++ b/org.bridgedb.rdf/src/org/bridgedb/rdf/identifiers/org/IdentifersOrgReader.java @@ -33,6 +33,7 @@ import java.util.HashSet; import java.util.Set; import java.util.regex.Pattern; + import org.apache.log4j.Logger; import org.bridgedb.DataSource; import org.bridgedb.DataSourcePatterns; @@ -48,10 +49,10 @@ import org.bridgedb.utils.BridgeDBException; import org.bridgedb.utils.ConfigReader; import org.bridgedb.utils.Reporter; +import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.Resource; import org.eclipse.rdf4j.model.Statement; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.eclipse.rdf4j.repository.Repository; import org.eclipse.rdf4j.repository.RepositoryConnection; import org.eclipse.rdf4j.repository.RepositoryException; @@ -85,7 +86,7 @@ private void doParseRdfInputStream(InputStream stream) throws BridgeDBException RepositoryConnection repositoryConnection = null; try { repository = new SailRepository(new MemoryStore()); - repository.initialize(); + repository.init(); repositoryConnection = repository.getConnection(); repositoryConnection.add(stream, DEFAULT_BASE_URI, DEFAULT_FILE_FORMAT); // for (String multiple:multiples){ @@ -283,7 +284,7 @@ private void loadUriPatterns(RepositoryConnection repositoryConnection, Resource } private void checkMultiple(RepositoryConnection repositoryConnection, String multiple) throws Exception{ - URI uri = new URIImpl(multiple); + IRI uri = SimpleValueFactory.getInstance().createIRI(multiple); RepositoryResult accessStatements = repositoryConnection.getStatements(null, null, uri, true); while(accessStatements.hasNext()) { diff --git a/org.bridgedb.rdf/test/org/bridgedb/rdf/DataSourceComparatorTest.java b/org.bridgedb.rdf/test/org/bridgedb/rdf/DataSourceComparatorTest.java index 35d3e49c9..5e084af37 100644 --- a/org.bridgedb.rdf/test/org/bridgedb/rdf/DataSourceComparatorTest.java +++ b/org.bridgedb.rdf/test/org/bridgedb/rdf/DataSourceComparatorTest.java @@ -16,19 +16,24 @@ package org.bridgedb.rdf; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.Matchers.hasItem; +import static org.hamcrest.Matchers.lessThan; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; + import java.io.InputStream; import java.util.Set; + import org.bridgedb.DataSource; import org.bridgedb.bio.DataSourceComparator; import org.bridgedb.utils.BridgeDBException; import org.bridgedb.utils.Reporter; -import static org.hamcrest.Matchers.*; - -import static org.junit.Assert.*; -import org.junit.jupiter.api.*; - import org.eclipse.rdf4j.model.Resource; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; +import org.junit.jupiter.api.Test; /** * @@ -46,7 +51,7 @@ public class DataSourceComparatorTest { public void testGetResourceId() { Reporter.println("getResourceId"); DataSource dataSource = DataSource.register("DataSourceUrisTest_testGetResourceId", "DataSourceUrisTest_testGetResourceId").asDataSource(); - Resource expResult = new URIImpl("http://vocabularies.bridgedb.org/ops#DataSource_DataSourceUrisTest_testGetResourceId"); + Resource expResult = SimpleValueFactory.getInstance().createIRI("http://vocabularies.bridgedb.org/ops#DataSource_DataSourceUrisTest_testGetResourceId"); Resource result = BridgeDBRdfHandler.asResource(dataSource); assertEquals(expResult, result); } diff --git a/org.bridgedb.sql/pom.xml b/org.bridgedb.sql/pom.xml index e6e134ebe..906378f1d 100644 --- a/org.bridgedb.sql/pom.xml +++ b/org.bridgedb.sql/pom.xml @@ -7,7 +7,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT diff --git a/org.bridgedb.tools.batchmapper/pom.xml b/org.bridgedb.tools.batchmapper/pom.xml index 9756a1224..97dac4e30 100644 --- a/org.bridgedb.tools.batchmapper/pom.xml +++ b/org.bridgedb.tools.batchmapper/pom.xml @@ -6,7 +6,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT @@ -33,19 +33,19 @@ org.bridgedb org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT compile org.bridgedb org.bridgedb.bio - 3.1.0 + 3.1.1-SNAPSHOT compile org.bridgedb org.bridgedb.rdb - 3.1.0 + 3.1.1-SNAPSHOT compile diff --git a/org.bridgedb.tools.info/pom.xml b/org.bridgedb.tools.info/pom.xml index dfa510219..06fcfd984 100644 --- a/org.bridgedb.tools.info/pom.xml +++ b/org.bridgedb.tools.info/pom.xml @@ -7,7 +7,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT diff --git a/org.bridgedb.tools.qc/pom.xml b/org.bridgedb.tools.qc/pom.xml index a48cb34e5..14e8a177d 100644 --- a/org.bridgedb.tools.qc/pom.xml +++ b/org.bridgedb.tools.qc/pom.xml @@ -7,7 +7,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT diff --git a/org.bridgedb.tools.voidtool/pom.xml b/org.bridgedb.tools.voidtool/pom.xml index 49900d9db..508a522df 100644 --- a/org.bridgedb.tools.voidtool/pom.xml +++ b/org.bridgedb.tools.voidtool/pom.xml @@ -7,7 +7,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT diff --git a/org.bridgedb.uri.api/pom.xml b/org.bridgedb.uri.api/pom.xml index 674408375..5e98f4024 100644 --- a/org.bridgedb.uri.api/pom.xml +++ b/org.bridgedb.uri.api/pom.xml @@ -7,7 +7,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT diff --git a/org.bridgedb.uri.loader/pom.xml b/org.bridgedb.uri.loader/pom.xml index 67a890ef6..3a10ac109 100644 --- a/org.bridgedb.uri.loader/pom.xml +++ b/org.bridgedb.uri.loader/pom.xml @@ -6,7 +6,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT diff --git a/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/LinkHandler.java b/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/LinkHandler.java index 1b6c5f380..f799087f0 100644 --- a/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/LinkHandler.java +++ b/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/LinkHandler.java @@ -19,16 +19,17 @@ // package org.bridgedb.uri.loader; +import java.net.URI; + import org.apache.log4j.Logger; -import org.bridgedb.uri.tools.RegexUriPattern; import org.bridgedb.uri.tools.UriListener; import org.bridgedb.utils.BridgeDBException; +import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.Resource; import org.eclipse.rdf4j.model.Statement; -import org.eclipse.rdf4j.model.URI; import org.eclipse.rdf4j.model.Value; import org.eclipse.rdf4j.rio.RDFHandlerException; -import org.eclipse.rdf4j.rio.helpers.RDFHandlerBase; +import org.eclipse.rdf4j.rio.helpers.AbstractRDFHandler; /** * Reads an RDF linkset file and passes the information on to a RdfLoader. @@ -39,9 +40,9 @@ * * @author Christian */ -public class LinkHandler extends RDFHandlerBase{ +public class LinkHandler extends AbstractRDFHandler { - protected final URI linkPredicate; + protected final IRI linkPredicate; private boolean symetric; protected final UriListener uriListener; @@ -49,13 +50,13 @@ public class LinkHandler extends RDFHandlerBase{ static final Logger logger = Logger.getLogger(LinkHandler.class); - public LinkHandler(UriListener uriListener, URI linkPredicate, boolean symetric){ + public LinkHandler(UriListener uriListener, IRI linkPredicate, boolean symetric){ this.uriListener = uriListener; this.linkPredicate = linkPredicate; this.symetric = symetric; } - public LinkHandler(UriListener uriListener, URI linkPredicate){ + public LinkHandler(UriListener uriListener, IRI linkPredicate){ this (uriListener, linkPredicate, true); } @@ -87,10 +88,10 @@ public void endRDF() throws RDFHandlerException{ private void insertUriMapping(Statement st) throws RDFHandlerException { Resource subject = st.getSubject(); Value object = st.getObject(); - if (!(subject instanceof URI)){ + if (!(subject instanceof IRI)){ throw new RDFHandlerException ("None URI subject in " + st); } - if (!(object instanceof URI)){ + if (!(object instanceof IRI)){ throw new RDFHandlerException ("None URI object in " + st); } String sourceUri = subject.stringValue(); diff --git a/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/LinksetHandler.java b/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/LinksetHandler.java index 5049c2b92..41709c78b 100644 --- a/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/LinksetHandler.java +++ b/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/LinksetHandler.java @@ -25,9 +25,9 @@ import org.bridgedb.uri.tools.UriListener; import org.bridgedb.utils.BridgeDBException; import org.bridgedb.utils.Reporter; +import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.Resource; import org.eclipse.rdf4j.model.Statement; -import org.eclipse.rdf4j.model.URI; import org.eclipse.rdf4j.model.Value; import org.eclipse.rdf4j.rio.RDFHandlerException; @@ -46,12 +46,12 @@ public class LinksetHandler extends LinkHandler{ protected final String justification; protected final String backwardJustification; - protected final URI mappingSource; + protected final IRI mappingSource; private int noneLinkStatements; static final Logger logger = Logger.getLogger(LinksetHandler.class); - public LinksetHandler(UriListener uriListener, URI linkPredicate, String justification, URI mappingSource){ + public LinksetHandler(UriListener uriListener, IRI linkPredicate, String justification, IRI mappingSource){ super(uriListener, linkPredicate); this.justification = justification; this.mappingSource = mappingSource; @@ -66,7 +66,7 @@ public LinksetHandler(UriListener uriListener, URI linkPredicate, String justifi * @param mappingSource * @param ignore */ - public LinksetHandler(UriListener uriListener, URI linkPredicate, String justification, URI mappingSource, boolean ignore){ + public LinksetHandler(UriListener uriListener, IRI linkPredicate, String justification, IRI mappingSource, boolean ignore){ this(uriListener, linkPredicate, justification, mappingSource); } @@ -91,17 +91,17 @@ public void handleStatement(Statement st) throws RDFHandlerException { * @throws RDFHandlerException */ private void processFirstStatement(Statement st) throws RDFHandlerException{ - final URI predicate = st.getPredicate(); + final IRI predicate = st.getPredicate(); if (predicate.equals(linkPredicate)) { Resource subject = st.getSubject(); Value object = st.getObject(); try { processingFirstStatement = false; - if (!(subject instanceof URI)){ + if (!(subject instanceof IRI)){ Reporter.error("None URI subject in " + st); return; } - if (!(object instanceof URI)){ + if (!(object instanceof IRI)){ Reporter.error("None URI object in " + st); return; } diff --git a/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/LinksetListener.java b/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/LinksetListener.java index 783f7110c..7b29d2f59 100644 --- a/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/LinksetListener.java +++ b/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/LinksetListener.java @@ -20,12 +20,12 @@ package org.bridgedb.uri.loader; import java.io.File; -import java.util.Set; +import java.net.URI; + import org.apache.log4j.Logger; import org.bridgedb.uri.tools.UriListener; import org.bridgedb.utils.BridgeDBException; -import org.eclipse.rdf4j.model.Resource; -import org.eclipse.rdf4j.model.URI; +import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.rio.RDFHandler; public class LinksetListener { @@ -39,15 +39,15 @@ public LinksetListener(UriListener uriListener){ static final Logger logger = Logger.getLogger(LinksetListener.class); - public int parse(File file, URI linkPredicate, String justification, boolean symetric) throws BridgeDBException{ - URI mappingUri = RdfParser.fileToURL(file); + public int parse(File file, IRI linkPredicate, String justification, boolean symetric) throws BridgeDBException{ + IRI mappingUri = RdfParser.fileToURL(file); LinksetHandler handler = new LinksetHandler(uriListener, linkPredicate, justification, mappingUri, symetric); RdfParser parser = getParser(handler); parser.parse(mappingUri.stringValue(), file); return handler.getMappingsetId(); } - public int parse(File file, URI mappingSource, URI linkPredicate, String justification, + public int parse(File file, IRI mappingSource, IRI linkPredicate, String justification, Boolean symetric) throws BridgeDBException{ LinksetHandler handler = new LinksetHandler(uriListener, linkPredicate, justification, mappingSource, symetric); RdfParser parser = getParser(handler); @@ -55,7 +55,7 @@ public int parse(File file, URI mappingSource, URI linkPredicate, String justifi return handler.getMappingsetId(); } - public int parse(String uri, URI mappingSource, URI linkPredicate, String justification, boolean symetric) + public int parse(String uri, IRI mappingSource, IRI linkPredicate, String justification, boolean symetric) throws BridgeDBException{ LinksetHandler handler = new LinksetHandler(uriListener, linkPredicate, justification, mappingSource, symetric); RdfParser parser = getParser(handler); diff --git a/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/RdfParser.java b/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/RdfParser.java index d441a645b..679d8f92b 100644 --- a/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/RdfParser.java +++ b/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/RdfParser.java @@ -32,9 +32,9 @@ import org.apache.log4j.Logger; import org.bridgedb.uri.loader.transative.TransativeConfig; import org.bridgedb.utils.BridgeDBException; -import org.eclipse.rdf4j.OpenRDFException; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.common.exception.RDF4JException; +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.eclipse.rdf4j.rio.RDFFormat; import org.eclipse.rdf4j.rio.RDFHandler; import org.eclipse.rdf4j.rio.RDFParser; @@ -66,11 +66,10 @@ public void parse(String baseURI, File file, String rdfFormatName) throws Bridge RDFParser parser = getParser(file.getName(), rdfFormatName); parser.setRDFHandler(handler); parser.setParseErrorListener(new LinksetParserErrorListener()); - parser.setVerifyData(true); parser.parse (reader, baseURI); } catch (IOException ex) { throw new BridgeDBException("Error reading " + file.getAbsolutePath() + " " + ex.getMessage(), ex); - } catch (OpenRDFException ex) { + } catch (RDF4JException ex) { throw new BridgeDBException("Error parsing " + file.getAbsolutePath() + " " + ex.getMessage(), ex); } finally { try { @@ -98,11 +97,10 @@ public void parse(InputStream stream, String mappingSource, String rdfFormatName RDFParser parser = getParser(mappingSource, rdfFormatName); parser.setRDFHandler(handler); parser.setParseErrorListener(new LinksetParserErrorListener()); - parser.setVerifyData(true); parser.parse (stream, mappingSource); } catch (IOException ex) { throw new BridgeDBException("Error reading " + mappingSource + " " + ex.getMessage(), ex); - } catch (OpenRDFException ex) { + } catch (RDF4JException ex) { throw new BridgeDBException("Error parsing " + mappingSource + " " + ex.getMessage(), ex); } finally { try { @@ -128,22 +126,22 @@ public InputStream getInputStream(String uri) throws BridgeDBException { } } - public static URI fileToURL(File file) throws BridgeDBException{ + public static IRI fileToURL(File file) throws BridgeDBException{ String baseURI = TransativeConfig.getTransitiveBaseUri(); if (baseURI == null || baseURI.isEmpty()){ return fileToURI(file); } if (file.getParent().equals(TransativeConfig.getTransativeDirectory())){ - return new URIImpl(baseURI + file.getName()); + return SimpleValueFactory.getInstance().createIRI(baseURI + file.getName()); } else { return RdfParser.fileToURI(file); } } - private static URI fileToURI(File file) throws BridgeDBException{ + private static IRI fileToURI(File file) throws BridgeDBException{ try { String uri = file.toURI().toURL().toExternalForm(); - return new URIImpl(uri); + return SimpleValueFactory.getInstance().createIRI(uri); } catch (MalformedURLException ex) { throw new BridgeDBException("Unable to convert file to URI", ex); } diff --git a/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/SetupWithTestData.java b/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/SetupWithTestData.java index be84bea78..7382bcf63 100644 --- a/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/SetupWithTestData.java +++ b/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/SetupWithTestData.java @@ -5,12 +5,13 @@ package org.bridgedb.uri.loader; import java.io.File; + import org.bridgedb.sql.SQLUriMapper; import org.bridgedb.uri.lens.Lens; import org.bridgedb.utils.BridgeDBException; import org.bridgedb.utils.Reporter; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; /** * @@ -20,7 +21,7 @@ public class SetupWithTestData { static final String MAIN_JUSTIFCATION = "http://semanticscience.org/resource/CHEMINF_000059"; static final String LENS_JUSTIFCATION = "http://www.bridgedb.org/test#testJustification"; - static final URI linkPredicate = new URIImpl("http://www.w3.org/2004/02/skos/core#exactMatch"); + static final IRI linkPredicate = SimpleValueFactory.getInstance().createIRI("http://www.w3.org/2004/02/skos/core#exactMatch"); private SQLUriMapper uriListener; private LinksetListener instance; diff --git a/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/transative/TransativeCreator.java b/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/transative/TransativeCreator.java index e76d8743b..c25150890 100644 --- a/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/transative/TransativeCreator.java +++ b/org.bridgedb.uri.loader/src/main/java/org/bridgedb/uri/loader/transative/TransativeCreator.java @@ -10,6 +10,7 @@ import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; + import org.apache.log4j.Logger; import org.bridgedb.DataSource; import org.bridgedb.rdf.UriPattern; @@ -24,10 +25,9 @@ import org.bridgedb.uri.tools.RegexUriPattern; import org.bridgedb.utils.BridgeDBException; import org.bridgedb.utils.Reporter; +import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.Statement; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.StatementImpl; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.eclipse.rdf4j.rio.RDFHandlerException; import org.eclipse.rdf4j.rio.RDFWriter; import org.eclipse.rdf4j.rio.turtle.TurtleWriter; @@ -42,13 +42,13 @@ public class TransativeCreator { private final UriMapper mapper; protected final MappingSetInfo leftInfo; protected final MappingSetInfo rightInfo; - protected final URI predicate; + protected final IRI predicate; protected final String justification; private final RegexUriPattern sourceRegexUriPattern; private final RegexUriPattern targetRegexUriPattern; private final boolean reflexive; - private static URI GENERATE_PREDICATE = null; + private static IRI GENERATE_PREDICATE = null; static final Logger logger = Logger.getLogger(TransativeCreator.class); @@ -73,7 +73,7 @@ protected TransativeCreator(MappingSetInfo left, MappingSetInfo right) mapper = SQLUriMapper.getExisting(); leftInfo = left; rightInfo = right; - predicate = new URIImpl(LoosePredicateMaker.getInstance().combine(left.getPredicate(), right.getPredicate())); + predicate = SimpleValueFactory.getInstance().createIRI(LoosePredicateMaker.getInstance().combine(left.getPredicate(), right.getPredicate())); justification = OpsJustificationMaker.getInstance().combine(left.getJustification(), right.getJustification()); reflexive = left.getSource().getSysCode().equals(right.getTarget().getSysCode()); UriPattern sourceUriPattern = getUriPattern(left.getSource()); @@ -145,10 +145,10 @@ private boolean getSQL(RDFWriter rdfwriter) throws BridgeDBException, IOExceptio //do nothing as same uri; } else { String sourceUri = sourceRegexUriPattern.getUri(sourceId); - URI sourceURI = new URIImpl(sourceUri); + IRI sourceURI = SimpleValueFactory.getInstance().createIRI(sourceUri); String targetUri = targetRegexUriPattern.getUri(targetId); - URI targetURI = new URIImpl(targetUri); - Statement statment = new StatementImpl(sourceURI, predicate, targetURI); + IRI targetURI = SimpleValueFactory.getInstance().createIRI(targetUri); + Statement statment = SimpleValueFactory.getInstance().createStatement(sourceURI, predicate, targetURI); rdfwriter.handleStatement(statment); found = true; } diff --git a/org.bridgedb.uri.loader/src/test/java/org/bridgedb/loader/LinksetListenerTest.java b/org.bridgedb.uri.loader/src/test/java/org/bridgedb/loader/LinksetListenerTest.java index 14181297c..429a4f9ee 100644 --- a/org.bridgedb.uri.loader/src/test/java/org/bridgedb/loader/LinksetListenerTest.java +++ b/org.bridgedb.uri.loader/src/test/java/org/bridgedb/loader/LinksetListenerTest.java @@ -4,12 +4,14 @@ */ package org.bridgedb.loader; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.greaterThanOrEqualTo; + import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import org.apache.commons.io.IOUtils; -import org.bridgedb.loader.transative.TransativeCreatorTest; import org.bridgedb.sql.SQLUriMapper; import org.bridgedb.sql.TestSqlFactory; import org.bridgedb.statistics.MappingSetInfo; @@ -18,22 +20,18 @@ import org.bridgedb.utils.BridgeDBException; import org.bridgedb.utils.ConfigReader; import org.bridgedb.utils.Reporter; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.URIImpl; - +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.*; - /** * * @author Christian */ public class LinksetListenerTest { - static final URI linkPredicate = new URIImpl("http://www.w3.org/2004/02/skos/core#exactMatch"); + static final IRI linkPredicate = SimpleValueFactory.getInstance().createIRI("http://www.w3.org/2004/02/skos/core#exactMatch"); static SQLUriMapper uriListener; static LinksetListener instance; diff --git a/org.bridgedb.uri.loader/src/test/java/org/bridgedb/loader/transative/TransativeCreatorTest.java b/org.bridgedb.uri.loader/src/test/java/org/bridgedb/loader/transative/TransativeCreatorTest.java index 36841348f..bfaea772c 100644 --- a/org.bridgedb.uri.loader/src/test/java/org/bridgedb/loader/transative/TransativeCreatorTest.java +++ b/org.bridgedb.uri.loader/src/test/java/org/bridgedb/loader/transative/TransativeCreatorTest.java @@ -20,7 +20,7 @@ package org.bridgedb.loader.transative; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.greaterThanOrEqualTo; import java.io.File; import java.io.FileOutputStream; @@ -37,10 +37,10 @@ import org.bridgedb.utils.BridgeDBException; import org.bridgedb.utils.ConfigReader; import org.bridgedb.utils.Reporter; +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.URIImpl; /** * @@ -48,7 +48,7 @@ */ public class TransativeCreatorTest { - static final URI linkPredicate = new URIImpl("http://www.w3.org/2004/02/skos/core#exactMatch"); + static final IRI linkPredicate = SimpleValueFactory.getInstance().createIRI("http://www.w3.org/2004/02/skos/core#exactMatch"); static SQLUriMapper uriListener; static LinksetListener instance; diff --git a/org.bridgedb.uri.sql/pom.xml b/org.bridgedb.uri.sql/pom.xml index cc24df3e0..efc09f859 100644 --- a/org.bridgedb.uri.sql/pom.xml +++ b/org.bridgedb.uri.sql/pom.xml @@ -7,7 +7,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT diff --git a/org.bridgedb.uri.sql/src/org/bridgedb/uri/lens/LensTools.java b/org.bridgedb.uri.sql/src/org/bridgedb/uri/lens/LensTools.java index 746c4d7ec..216873956 100644 --- a/org.bridgedb.uri.sql/src/org/bridgedb/uri/lens/LensTools.java +++ b/org.bridgedb.uri.sql/src/org/bridgedb/uri/lens/LensTools.java @@ -26,6 +26,7 @@ import java.util.List; import java.util.Properties; import java.util.Set; + import org.apache.log4j.Logger; import org.bridgedb.rdf.BridgeDBRdfHandler; import org.bridgedb.rdf.constants.BridgeDBConstants; @@ -35,11 +36,9 @@ import org.bridgedb.uri.api.UriMapper; import org.bridgedb.utils.BridgeDBException; import org.bridgedb.utils.ConfigReader; +import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.Statement; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.LiteralImpl; -import org.eclipse.rdf4j.model.impl.StatementImpl; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.eclipse.rdf4j.sail.memory.model.CalendarMemLiteral; /** @@ -291,15 +290,15 @@ public static Set getLensAsRdf(String baseUri, String group) throws B public static Set asRdf(Lens lens, String baseUri) { HashSet results = new HashSet(); - URI subject = new URIImpl(lens.toUri(baseUri)); - results.add(new StatementImpl(subject, RdfConstants.TYPE_URI, BridgeDBConstants.LENS_URI)); - results.add(new StatementImpl(subject, DCTermsConstants.TITLE_URI, new LiteralImpl(lens.getName()))); - results.add(new StatementImpl(subject, DCTermsConstants.DESCRIPTION_URI, new LiteralImpl(lens.getDescription()))); - results.add(new StatementImpl(subject, PavConstants.CREATED_BY, new LiteralImpl(lens.getCreatedBy()))); + IRI subject = SimpleValueFactory.getInstance().createIRI(lens.toUri(baseUri)); + results.add(SimpleValueFactory.getInstance().createStatement(subject, RdfConstants.TYPE_URI, BridgeDBConstants.LENS_URI)); + results.add(SimpleValueFactory.getInstance().createStatement(subject, DCTermsConstants.TITLE_URI, SimpleValueFactory.getInstance().createLiteral(lens.getName()))); + results.add(SimpleValueFactory.getInstance().createStatement(subject, DCTermsConstants.DESCRIPTION_URI, SimpleValueFactory.getInstance().createLiteral(lens.getDescription()))); + results.add(SimpleValueFactory.getInstance().createStatement(subject, PavConstants.CREATED_BY, SimpleValueFactory.getInstance().createLiteral(lens.getCreatedBy()))); CalendarMemLiteral createdOnLiteral = new CalendarMemLiteral(lens, lens.getCreatedOn()); - results.add(new StatementImpl(subject, PavConstants.CREATED_ON, createdOnLiteral)); + results.add(SimpleValueFactory.getInstance().createStatement(subject, PavConstants.CREATED_ON, createdOnLiteral)); for (String justification:lens.getJustifications()){ - results.add(new StatementImpl(subject, BridgeDBConstants.LINKSET_JUSTIFICATION, new URIImpl(justification))); + results.add(SimpleValueFactory.getInstance().createStatement(subject, BridgeDBConstants.LINKSET_JUSTIFICATION, SimpleValueFactory.getInstance().createIRI(justification))); } return results; } diff --git a/org.bridgedb.uri.sql/src/org/bridgedb/uri/tools/DirectStatementMaker.java b/org.bridgedb.uri.sql/src/org/bridgedb/uri/tools/DirectStatementMaker.java index 4e1b00c7a..d05e438c3 100644 --- a/org.bridgedb.uri.sql/src/org/bridgedb/uri/tools/DirectStatementMaker.java +++ b/org.bridgedb.uri.sql/src/org/bridgedb/uri/tools/DirectStatementMaker.java @@ -26,11 +26,9 @@ import org.bridgedb.uri.lens.Lens; import org.bridgedb.uri.lens.LensTools; import org.bridgedb.utils.BridgeDBException; +import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.Statement; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.ContextStatementImpl; -import org.eclipse.rdf4j.model.impl.StatementImpl; -import org.eclipse.rdf4j.model.impl.URIImpl; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; /** * @@ -38,41 +36,41 @@ */ public class DirectStatementMaker implements StatementMaker{ - protected final URI toURI(String text){ + protected final IRI toURI(String text){ try { - return new URIImpl(text); + return SimpleValueFactory.getInstance().createIRI(text); } catch (IllegalArgumentException ex){ - return new URIImpl("<" + text + ">"); + return SimpleValueFactory.getInstance().createIRI("<" + text + ">"); } } private Set asRDF(SetMappings setMappings, String lens, String baseUri, String methodName) throws BridgeDBException { HashSet statements = new HashSet(); - URI setUri; - setUri = new URIImpl(baseUri + methodName + "/" + setMappings.getId()); - URI predicateURI = toURI(setMappings.getPredicate()); - Statement statement = new StatementImpl(setUri, VoidConstants.LINK_PREDICATE, predicateURI); + IRI setUri; + setUri = SimpleValueFactory.getInstance().createIRI(baseUri + methodName + "/" + setMappings.getId()); + IRI predicateURI = toURI(setMappings.getPredicate()); + Statement statement = SimpleValueFactory.getInstance().createStatement(setUri, VoidConstants.LINK_PREDICATE, predicateURI); statements.add(statement); - URI justifcationURI = toURI(setMappings.getJustification()); - statement = new StatementImpl(setUri, DulConstants.EXPRESSES, justifcationURI); + IRI justifcationURI = toURI(setMappings.getJustification()); + statement = SimpleValueFactory.getInstance().createStatement(setUri, DulConstants.EXPRESSES, justifcationURI); statements.add(statement); String source = setMappings.getMappingSource(); if (source != null && !source.isEmpty()){ - URI mappingSourceURI = toURI(setMappings.getMappingSource()); - statement = new StatementImpl(setUri, VoidConstants.DATA_DUMP, mappingSourceURI); + IRI mappingSourceURI = toURI(setMappings.getMappingSource()); + statement = SimpleValueFactory.getInstance().createStatement(setUri, VoidConstants.DATA_DUMP, mappingSourceURI); statements.add(statement); } if (lens != null){ Lens theLens = LensTools.byId(lens); - URI lensUri = new URIImpl(theLens.toUri(baseUri)); - URI hasLensUri = BridgeDBConstants.FULFILLS_LENS; - statement = new StatementImpl(setUri, hasLensUri, lensUri); + IRI lensUri = SimpleValueFactory.getInstance().createIRI(theLens.toUri(baseUri)); + IRI hasLensUri = BridgeDBConstants.FULFILLS_LENS; + statement = SimpleValueFactory.getInstance().createStatement(setUri, hasLensUri, lensUri); statements.add(statement); } for (UriMapping mapping:setMappings.getMappings()){ - URI sourceURI = toURI(mapping.getSourceUri()); - URI targetURI = toURI(mapping.getTargetUri()); - statement = new ContextStatementImpl(sourceURI, predicateURI, targetURI, setUri); + IRI sourceURI = toURI(mapping.getSourceUri()); + IRI targetURI = toURI(mapping.getTargetUri()); + statement = SimpleValueFactory.getInstance().createStatement(sourceURI, predicateURI, targetURI, setUri); statements.add(statement); } return statements; @@ -95,9 +93,9 @@ public Set asRDF(MappingsBySet mappingsBySet, String baseUri, String for (UriMapping mapping:mappingsBySet.getMappings()){ //Inclusion of mapping to self at Antonis request April 2014 //if (!mapping.getSourceUri().equals(mapping.getTargetUri())){ - URI sourceURI = toURI(mapping.getSourceUri()); - URI targetURI = toURI(mapping.getTargetUri()); - Statement statement = new StatementImpl(sourceURI, OWLConstants.SAMEAS_URI, targetURI); + IRI sourceURI = toURI(mapping.getSourceUri()); + IRI targetURI = toURI(mapping.getTargetUri()); + Statement statement = SimpleValueFactory.getInstance().createStatement(sourceURI, OWLConstants.SAMEAS_URI, targetURI); statements.add(statement); //} } @@ -105,7 +103,7 @@ public Set asRDF(MappingsBySet mappingsBySet, String baseUri, String return statements; } - protected URI mappingSetURI(String id, String baseUri, String predicateURI){ + protected IRI mappingSetURI(String id, String baseUri, String predicateURI){ String uriStr = baseUri + UriConstants.MAPPING_SET + UriConstants.RDF + "/" + id; if (predicateURI != null) { String p; @@ -129,28 +127,28 @@ private String encodeWithinQuery(String str) { @Override public Set asRDF(MappingSetInfo info, String baseUri, String contextString) throws BridgeDBException{ HashSet results = new HashSet(); - URI linksetId = mappingSetURI(info.getStringId(), baseUri, null); - URI source = toURI(info.getMappingSource()); - URI context = new URIImpl(contextString); - results.add(new ContextStatementImpl(linksetId, PavConstants.IMPORTED_FROM, source, context)); - URI predicate = toURI(info.getPredicate()); - results.add(new ContextStatementImpl(linksetId, VoidConstants.LINK_PREDICATE, predicate, context)); - URI justification = toURI(info.getJustification()); - results.add(new ContextStatementImpl(linksetId, BridgeDBConstants.LINKSET_JUSTIFICATION, justification, context)); + IRI linksetId = mappingSetURI(info.getStringId(), baseUri, null); + IRI source = toURI(info.getMappingSource()); + IRI context = SimpleValueFactory.getInstance().createIRI(contextString); + results.add(SimpleValueFactory.getInstance().createStatement(linksetId, PavConstants.IMPORTED_FROM, source, context)); + IRI predicate = toURI(info.getPredicate()); + results.add(SimpleValueFactory.getInstance().createStatement(linksetId, VoidConstants.LINK_PREDICATE, predicate, context)); + IRI justification = toURI(info.getJustification()); + results.add(SimpleValueFactory.getInstance().createStatement(linksetId, BridgeDBConstants.LINKSET_JUSTIFICATION, justification, context)); return results; } - private void addMappingsRDF(Set statements, Mapping mapping, URI predicateUri, URI mappingSet) throws BridgeDBException{ + private void addMappingsRDF(Set statements, Mapping mapping, IRI predicateUri, IRI mappingSet) throws BridgeDBException{ for (String source:mapping.getSourceUri()){ - URI sourceUri = new URIImpl(source); + IRI sourceUri = SimpleValueFactory.getInstance().createIRI(source); for (String target: mapping.getTargetUri()){ - URI targetUri = new URIImpl(target); - statements.add(new ContextStatementImpl(sourceUri, predicateUri, targetUri, mappingSet)); + IRI targetUri = SimpleValueFactory.getInstance().createIRI(target); + statements.add(SimpleValueFactory.getInstance().createStatement(sourceUri, predicateUri, targetUri, mappingSet)); } } } - protected void addLinksetInfo(Set statements, Mapping mapping, URI mappingSet) throws BridgeDBException{ + protected void addLinksetInfo(Set statements, Mapping mapping, IRI mappingSet) throws BridgeDBException{ if (mapping.isMappingToSelf()){ //No void for mapping to self at the moment. } else if (mapping.isTransitive()){ @@ -162,26 +160,26 @@ protected void addLinksetInfo(Set statements, Mapping mapping, URI ma } } - protected void addMappingVoid(Set statements, Mapping mapping, URI mappingSet) + protected void addMappingVoid(Set statements, Mapping mapping, IRI mappingSet) throws BridgeDBException { - URI sourceUri = toURI(mapping.getMappingSource()); - statements.add(new ContextStatementImpl(mappingSet, PavConstants.DERIVED_FROM, sourceUri, mappingSet)); + IRI sourceUri = toURI(mapping.getMappingSource()); + statements.add(SimpleValueFactory.getInstance().createStatement(mappingSet, PavConstants.DERIVED_FROM, sourceUri, mappingSet)); } private void addSelfMappingsRDF(Set statements, Mapping mapping, String selfMappingPredicateURI) throws BridgeDBException{ - URI predicate; + IRI predicate; if (selfMappingPredicateURI == null || selfMappingPredicateURI.isEmpty()) { predicate = OWLConstants.SAMEAS_URI; } else { - predicate = new URIImpl(selfMappingPredicateURI); + predicate = SimpleValueFactory.getInstance().createIRI(selfMappingPredicateURI); } for (String source:mapping.getSourceUri()){ - URI sourceUri = new URIImpl(source); + IRI sourceUri = SimpleValueFactory.getInstance().createIRI(source); for (String target: mapping.getTargetUri()){ if (!source.equals(target)){ - URI targetUri = new URIImpl(target); - statements.add(new StatementImpl(sourceUri, predicate, targetUri)); + IRI targetUri = SimpleValueFactory.getInstance().createIRI(target); + statements.add(SimpleValueFactory.getInstance().createStatement(sourceUri, predicate, targetUri)); } } } @@ -200,8 +198,8 @@ public Set asRDF(Set mappings, String baseUri, boolean links } if (predicate != null){ String id = mapping.getMappingSetId(); - URI mappingSet = mappingSetURI(id, baseUri, overridePredicateURI); - URI predicateUri = new URIImpl(predicate); + IRI mappingSet = mappingSetURI(id, baseUri, overridePredicateURI); + IRI predicateUri = SimpleValueFactory.getInstance().createIRI(predicate); addMappingsRDF(statements, mapping, predicateUri, mappingSet); if (linksetInfo){ addLinksetInfo(statements, mapping, mappingSet); diff --git a/org.bridgedb.uri.sql/test/org/bridgedb/mysql/UriMapperRecoverTest.java b/org.bridgedb.uri.sql/test/org/bridgedb/mysql/UriMapperRecoverTest.java index 4738159c3..d1eee6396 100644 --- a/org.bridgedb.uri.sql/test/org/bridgedb/mysql/UriMapperRecoverTest.java +++ b/org.bridgedb.uri.sql/test/org/bridgedb/mysql/UriMapperRecoverTest.java @@ -21,7 +21,10 @@ package org.bridgedb.mysql; +import static org.junit.jupiter.api.Assertions.assertEquals; + import java.util.Date; + import org.bridgedb.sql.SQLUriMapper; import org.bridgedb.sql.TestSqlFactory; import org.bridgedb.statistics.OverallStatistics; @@ -29,13 +32,10 @@ import org.bridgedb.uri.lens.Lens; import org.bridgedb.utils.BridgeDBException; import org.bridgedb.utils.ConfigReader; - -import org.junit.jupiter.api.Test; import org.eclipse.rdf4j.model.Resource; -import org.eclipse.rdf4j.model.impl.URIImpl; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; /** @@ -68,7 +68,7 @@ public void testRecover()throws BridgeDBException{ stats = uriMapper.getOverallStatistics(Lens.ALL_LENS_NAME); assertEquals(12, stats.getNumberOfMappings()); assertEquals(4, stats.getNumberOfMappingSets()); - Resource resource = new URIImpl("http://example.com/1to2Another"); + Resource resource = SimpleValueFactory.getInstance().createIRI("http://example.com/1to2Another"); int mappingSet = listener.registerMappingSet(regexUriPattern1, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPattern2, resource); assertEquals(5, mappingSet); diff --git a/org.bridgedb.uri.sql/test/org/bridgedb/mysql/transative/TransitiveTest.java b/org.bridgedb.uri.sql/test/org/bridgedb/mysql/transative/TransitiveTest.java index 557742e5f..b158346fd 100644 --- a/org.bridgedb.uri.sql/test/org/bridgedb/mysql/transative/TransitiveTest.java +++ b/org.bridgedb.uri.sql/test/org/bridgedb/mysql/transative/TransitiveTest.java @@ -20,7 +20,11 @@ package org.bridgedb.mysql.transative; +import static org.bridgedb.uri.UriListenerTest.SYMETRIC; +import static org.junit.jupiter.api.Assertions.assertEquals; + import java.util.Set; + import org.bridgedb.DataSource; import org.bridgedb.pairs.IdSysCodePair; import org.bridgedb.rdf.UriPattern; @@ -28,9 +32,6 @@ import org.bridgedb.sql.SQLUriMapper; import org.bridgedb.sql.TestSqlFactory; import org.bridgedb.sql.transative.DirectMapping; -import static org.bridgedb.uri.UriListenerTest.SYMETRIC; -import static org.junit.jupiter.api.Assertions.assertEquals; - import org.bridgedb.uri.api.Mapping; import org.bridgedb.uri.lens.Lens; import org.bridgedb.uri.lens.LensTools; @@ -38,11 +39,10 @@ import org.bridgedb.utils.BridgeDBException; import org.bridgedb.utils.ConfigReader; import org.bridgedb.utils.Reporter; - +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Tag; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.URIImpl; /** * Tests the UriMapper interface (and by loading the UriListener interface) @@ -162,107 +162,107 @@ public static void setupIDMapper() throws BridgeDBException{ public static void loadData() throws BridgeDBException{ - URI source = new URIImpl("http://example.com/TransitiveTest/AtoB"); + IRI source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/AtoB"); mappingSetAB = sqlUriMapper.registerMappingSet(regexUriPatternA, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternB, source); - source = new URIImpl("http://example.com/TransitiveTest/AtoB2"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/AtoB2"); mappingSetAB2 = sqlUriMapper.registerMappingSet(regexUriPatternA, TEST_PREDICATE2, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternB, source); - source = new URIImpl("http://example.com/TransitiveTest/AtoC"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/AtoC"); mappingSetAC = sqlUriMapper.registerMappingSet(regexUriPatternA, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternC, source); - source = new URIImpl("http://example.com/TransitiveTest/AtoD"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/AtoD"); mappingSetAD = sqlUriMapper.registerMappingSet(regexUriPatternA, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternD, source); - source = new URIImpl("http://example.com/TransitiveTest/AtoE"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/AtoE"); mappingSetAE = sqlUriMapper.registerMappingSet(regexUriPatternA, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternE, source); - source = new URIImpl("http://example.com/TransitiveTest/AtoF"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/AtoF"); mappingSetAF = sqlUriMapper.registerMappingSet(regexUriPatternA, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternF, source); - source = new URIImpl("http://example.com/TransitiveTest/BtoC"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/BtoC"); mappingSetBC = sqlUriMapper.registerMappingSet(regexUriPatternB, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternC, source); - source = new URIImpl("http://example.com/TransitiveTest/BtoC2"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/BtoC2"); mappingSetBC2 = sqlUriMapper.registerMappingSet(regexUriPatternB, TEST_PREDICATE2, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternC, source); - source = new URIImpl("http://example.com/TransitiveTest/BtoC9"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/BtoC9"); mappingSetBC9 = sqlUriMapper.registerMappingSet(regexUriPatternB, TEST_PREDICATE, TEST_JUSTIFICATION9, TEST_JUSTIFICATION9, regexUriPatternC, source); - source = new URIImpl("http://example.com/TransitiveTest/BtoD"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/BtoD"); mappingSetBD = sqlUriMapper.registerMappingSet(regexUriPatternB, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternD, source); - source = new URIImpl("http://example.com/TransitiveTest/BtoE"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/BtoE"); mappingSetBE = sqlUriMapper.registerMappingSet(regexUriPatternB, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternE, source); - source = new URIImpl("http://example.com/TransitiveTest/BtoF"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/BtoF"); mappingSetBF = sqlUriMapper.registerMappingSet(regexUriPatternB, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternF, source); - source = new URIImpl("http://example.com/TransitiveTest/CtoD"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/CtoD"); mappingSetCD = sqlUriMapper.registerMappingSet(regexUriPatternC, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternD, source); - source = new URIImpl("http://example.com/TransitiveTest/CtoD2"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/CtoD2"); mappingSetCD2 = sqlUriMapper.registerMappingSet(regexUriPatternC, TEST_PREDICATE2, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternD, source); - source = new URIImpl("http://example.com/TransitiveTest/CtoD9"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/CtoD9"); mappingSetCD9 = sqlUriMapper.registerMappingSet(regexUriPatternC, TEST_PREDICATE, TEST_JUSTIFICATION9, TEST_JUSTIFICATION9, regexUriPatternD, source); - source = new URIImpl("http://example.com/TransitiveTest/CtoE"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/CtoE"); mappingSetCE = sqlUriMapper.registerMappingSet(regexUriPatternC, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternE, source); - source = new URIImpl("http://example.com/TransitiveTest/CtoF"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/CtoF"); mappingSetCF = sqlUriMapper.registerMappingSet(regexUriPatternC, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternF, source); - source = new URIImpl("http://example.com/TransitiveTest/DtoE"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/DtoE"); mappingSetDE = sqlUriMapper.registerMappingSet(regexUriPatternD, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternE, source); - source = new URIImpl("http://example.com/TransitiveTest/DtoF"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/DtoF"); mappingSetDF = sqlUriMapper.registerMappingSet(regexUriPatternD, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternF, source); - source = new URIImpl("http://example.com/TransitiveTest/EtoE"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/EtoE"); mappingSetEE = sqlUriMapper.registerMappingSet(regexUriPatternE, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternE, source); - source = new URIImpl("http://example.com/TransitiveTest/EtoF"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/EtoF"); mappingSetEF = sqlUriMapper.registerMappingSet(regexUriPatternE, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternF, source); - source = new URIImpl("http://example.com/TransitiveTest/FtoF"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/FtoF"); mappingSetFF = sqlUriMapper.registerMappingSet(regexUriPatternF, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternF, source); - source = new URIImpl("http://example.com/TransitiveTest/AtoX"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/AtoX"); mappingSetAX = sqlUriMapper.registerMappingSet(regexUriPatternA, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternX, source); - source = new URIImpl("http://example.com/TransitiveTest/CtoX"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/CtoX"); mappingSetCX = sqlUriMapper.registerMappingSet(regexUriPatternC, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternX, source); - source = new URIImpl("http://example.com/TransitiveTest/AtoY"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/AtoY"); mappingSetAY = sqlUriMapper.registerMappingSet(regexUriPatternA, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternY, source); - source = new URIImpl("http://example.com/TransitiveTest/CtoY"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/TransitiveTest/CtoY"); mappingSetCY = sqlUriMapper.registerMappingSet(regexUriPatternC, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPatternY, source); diff --git a/org.bridgedb.uri.sql/test/org/bridgedb/uri/UriListenerTest.java b/org.bridgedb.uri.sql/test/org/bridgedb/uri/UriListenerTest.java index 441cc3c36..8d12943bd 100644 --- a/org.bridgedb.uri.sql/test/org/bridgedb/uri/UriListenerTest.java +++ b/org.bridgedb.uri.sql/test/org/bridgedb/uri/UriListenerTest.java @@ -21,8 +21,11 @@ package org.bridgedb.uri; +import static org.junit.jupiter.api.Assertions.assertFalse; + import java.util.Set; import java.util.regex.Pattern; + import org.bridgedb.DataSourcePatterns; import org.bridgedb.Xref; import org.bridgedb.rdf.UriPattern; @@ -33,13 +36,10 @@ import org.bridgedb.uri.tools.UriListener; import org.bridgedb.utils.BridgeDBException; import org.bridgedb.utils.IDMapperTestBase; - +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Tag; -import org.eclipse.rdf4j.model.URI; -import org.eclipse.rdf4j.model.impl.URIImpl; - -import static org.junit.jupiter.api.Assertions.assertFalse; /** * Base class of all Test using Uris @@ -215,14 +215,14 @@ public static void setupUriPatterns() throws BridgeDBException{ */ public static void loadDataPart1() throws BridgeDBException{ - URI source = new URIImpl("http://example.com/1to2"); + IRI source = SimpleValueFactory.getInstance().createIRI("http://example.com/1to2"); mappingSet1to2 = listener.registerMappingSet(regexUriPattern1, TEST_PREDICATE, Lens.getDefaultJustifictaionString(), Lens.getDefaultJustifictaionString(), regexUriPattern2, source); listener.insertUriMapping(map1Uri1, map1Uri2, mappingSet1to2, SYMETRIC); listener.insertUriMapping(map2Uri1, map2Uri2, mappingSet1to2, SYMETRIC); listener.insertUriMapping(map3Uri1, map3Uri2, mappingSet1to2, SYMETRIC); - source = new URIImpl("http://example.com/2to3"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/2to3"); mappingSet2to3 = listener.registerMappingSet(regexUriPattern2, TEST_PREDICATE, Lens.getDefaultJustifictaionString(), Lens.getDefaultJustifictaionString(), regexUriPattern3, source); listener.insertUriMapping(map1Uri2, map1Uri3, mappingSet2to3, SYMETRIC); @@ -232,21 +232,21 @@ public static void loadDataPart1() throws BridgeDBException{ //Close here to test recover listener.closeInput(); - source = new URIImpl("http://example.com/3to3Lensed"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/3to3Lensed"); mappingSet3to3Lensed = listener.registerMappingSet(regexUriPattern3, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPattern3, source); listener.insertUriMapping(map1Uri3, map1AUri3, mappingSet3to3Lensed, SYMETRIC); listener.insertUriMapping(map2Uri3, map2AUri3, mappingSet3to3Lensed, SYMETRIC); listener.insertUriMapping(map3Uri3, map3AUri3, mappingSet3to3Lensed, SYMETRIC); - source = new URIImpl("http://example.com/1to2lensed"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/1to2lensed"); mappingSet1to2Lensed = listener.registerMappingSet(regexUriPattern1, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPattern2, source); listener.insertUriMapping(map1AUri1, map1AUri2, mappingSet1to2Lensed, SYMETRIC); listener.insertUriMapping(map2AUri1, map2AUri2, mappingSet1to2Lensed, SYMETRIC); listener.insertUriMapping(map3AUri1, map3AUri2, mappingSet1to2Lensed, SYMETRIC); - source = new URIImpl("http://example.com/2to3"); + source = SimpleValueFactory.getInstance().createIRI("http://example.com/2to3"); mappingSet2to3Lensed = listener.registerMappingSet(regexUriPattern2, TEST_PREDICATE, Lens.getTestJustifictaion(), Lens.getTestJustifictaion(), regexUriPattern3, source); listener.insertUriMapping(map1AUri2, map1AUri3, mappingSet2to3Lensed, SYMETRIC); @@ -267,7 +267,7 @@ public static void loadData() throws BridgeDBException{ * @throws BridgeDBException */ public static void loadData2Way() throws BridgeDBException{ - URI source = new URIImpl("http://example.com/2to3Lensed"); + IRI source = SimpleValueFactory.getInstance().createIRI("http://example.com/2to3Lensed"); int mappingSet = listener.registerMappingSet(regexUriPattern2, TEST_PREDICATE, Lens.getTestJustifictaion() +"Forward", Lens.getTestJustifictaion() +"BackWard", regexUriPattern3, source); listener.insertUriMapping(map1Uri2, map1AUri3, mappingSet, SYMETRIC); diff --git a/org.bridgedb.uri.sql/test/org/bridgedb/uri/UriMapperRdfTest.java b/org.bridgedb.uri.sql/test/org/bridgedb/uri/UriMapperRdfTest.java index fd7540036..d7662147a 100644 --- a/org.bridgedb.uri.sql/test/org/bridgedb/uri/UriMapperRdfTest.java +++ b/org.bridgedb.uri.sql/test/org/bridgedb/uri/UriMapperRdfTest.java @@ -19,6 +19,9 @@ */ package org.bridgedb.uri; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.util.Set; import org.bridgedb.DataSource; @@ -26,18 +29,16 @@ import org.bridgedb.statistics.MappingSetInfo; import org.bridgedb.uri.api.Mapping; import org.bridgedb.uri.tools.StatementMaker; -import org.junit.jupiter.api.*; +import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.Model; import org.eclipse.rdf4j.model.Statement; -import org.eclipse.rdf4j.model.URI; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.eclipse.rdf4j.model.impl.TreeModel; -import org.eclipse.rdf4j.model.impl.URIImpl; import org.eclipse.rdf4j.rio.RDFFormat; import org.eclipse.rdf4j.rio.RDFHandlerException; import org.eclipse.rdf4j.rio.Rio; - -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; /** * Tests the UriMapper interface (and by loading the UriListener interface) @@ -57,20 +58,20 @@ public abstract class UriMapperRdfTest extends UriListenerTest{ public static StatementMaker statementMaker; - URI mappingSet1 = new URIImpl("http://example.com/testBasemappingSetRDF/1"); - URI linksetJustification = new URIImpl("http://openphacts.cs.man.ac.uk:9090/ontology/DataSource.owl#linksetJustification"); - URI inChlKey = new URIImpl("http://semanticscience.org/resource/CHEMINF_000059"); + IRI mappingSet1 = SimpleValueFactory.getInstance().createIRI("http://example.com/testBasemappingSetRDF/1"); + IRI linksetJustification = SimpleValueFactory.getInstance().createIRI("http://openphacts.cs.man.ac.uk:9090/ontology/DataSource.owl#linksetJustification"); + IRI inChlKey = SimpleValueFactory.getInstance().createIRI("http://semanticscience.org/resource/CHEMINF_000059"); - URI importedFrom = new URIImpl("http://purl.org/pav/importedFrom"); - URI derivedFrom = new URIImpl("http://purl.org/pav/derivedFrom"); - URI example1to2 = new URIImpl("http://example.com/1to2"); - URI linkPredicate = new URIImpl("http://rdfs.org/ns/void#linkPredicate"); - URI exactMatch = new URIImpl("http://www.w3.org/2004/02/skos/core#exactMatch"); + IRI importedFrom = SimpleValueFactory.getInstance().createIRI("http://purl.org/pav/importedFrom"); + IRI derivedFrom = SimpleValueFactory.getInstance().createIRI("http://purl.org/pav/derivedFrom"); + IRI example1to2 = SimpleValueFactory.getInstance().createIRI("http://example.com/1to2"); + IRI linkPredicate = SimpleValueFactory.getInstance().createIRI("http://rdfs.org/ns/void#linkPredicate"); + IRI exactMatch = SimpleValueFactory.getInstance().createIRI("http://www.w3.org/2004/02/skos/core#exactMatch"); - URI sameAs = new URIImpl("http://www.w3.org/2002/07/owl#sameAs"); - URI concept = new URIImpl("http://www.conceptwiki.org/concept/f25a234e-df03-419f-8504-cde8689a4d1f"); + IRI sameAs = SimpleValueFactory.getInstance().createIRI("http://www.w3.org/2002/07/owl#sameAs"); + IRI concept = SimpleValueFactory.getInstance().createIRI("http://www.conceptwiki.org/concept/f25a234e-df03-419f-8504-cde8689a4d1f"); - URI override = new URIImpl("http://example.com/override"); + IRI override = SimpleValueFactory.getInstance().createIRI("http://example.com/override"); public void checkMapping(Mapping mapping){ if (!mapping.isMappingToSelf()){ @@ -116,22 +117,22 @@ public void testMappingNoLink() throws Exception { Set rdf = statementMaker.asRDF(mappings, "http://example.com/testContext", false, null); Model m = asModel(rdf); - assertTrue(m.contains(concept, sameAs, new URIImpl("http://www.conceptwiki.org/concept/index/f25a234e-df03-419f-8504-cde8689a4d1f"))); - assertTrue(m.contains(concept, sameAs, new URIImpl("http://www.conceptwiki.org/web-ws/concept/get?uuid=f25a234e-df03-419f-8504-cde8689a4d1f"))); + assertTrue(m.contains(concept, sameAs, SimpleValueFactory.getInstance().createIRI("http://www.conceptwiki.org/concept/index/f25a234e-df03-419f-8504-cde8689a4d1f"))); + assertTrue(m.contains(concept, sameAs, SimpleValueFactory.getInstance().createIRI("http://www.conceptwiki.org/web-ws/concept/get?uuid=f25a234e-df03-419f-8504-cde8689a4d1f"))); - assertTrue(m.contains(concept, exactMatch, new URIImpl("http://identifiers.org/chemspider/28509384"))); - assertTrue(m.contains(concept, exactMatch, new URIImpl("http://info.identifiers.org/chemspider/28509384"))); + assertTrue(m.contains(concept, exactMatch, SimpleValueFactory.getInstance().createIRI("http://identifiers.org/chemspider/28509384"))); + assertTrue(m.contains(concept, exactMatch, SimpleValueFactory.getInstance().createIRI("http://info.identifiers.org/chemspider/28509384"))); - assertTrue(m.contains(concept, exactMatch, new URIImpl("http://ops.rsc.org/Compounds/Get/8"))); - assertTrue(m.contains(concept, exactMatch, new URIImpl("http://ops.rsc-us.org/OPS8"))); - assertTrue(m.contains(concept, exactMatch, new URIImpl("http://ops.rsc.org/OPS8"))); - assertTrue(m.contains(concept, exactMatch, new URIImpl("http://ops.rsc.org/OPS8/rdf"))); + assertTrue(m.contains(concept, exactMatch, SimpleValueFactory.getInstance().createIRI("http://ops.rsc.org/Compounds/Get/8"))); + assertTrue(m.contains(concept, exactMatch, SimpleValueFactory.getInstance().createIRI("http://ops.rsc-us.org/OPS8"))); + assertTrue(m.contains(concept, exactMatch, SimpleValueFactory.getInstance().createIRI("http://ops.rsc.org/OPS8"))); + assertTrue(m.contains(concept, exactMatch, SimpleValueFactory.getInstance().createIRI("http://ops.rsc.org/OPS8/rdf"))); - assertTrue(m.contains(concept, exactMatch, new URIImpl("http://rdf.chemspider.com/28509384"))); - assertTrue(m.contains(concept, exactMatch, new URIImpl("http://www.chemspider.com/28509384"))); - assertTrue(m.contains(concept, exactMatch, new URIImpl("http://www.chemspider.com/Chemical-Structure.28509384"))); - assertTrue(m.contains(concept, exactMatch, new URIImpl("http://www.chemspider.com/Chemical-Structure.28509384.html"))); - assertTrue(m.contains(concept, exactMatch, new URIImpl("http://www.chemspider.com/Chemical-Structure.28509384.rdf"))); + assertTrue(m.contains(concept, exactMatch, SimpleValueFactory.getInstance().createIRI("http://rdf.chemspider.com/28509384"))); + assertTrue(m.contains(concept, exactMatch, SimpleValueFactory.getInstance().createIRI("http://www.chemspider.com/28509384"))); + assertTrue(m.contains(concept, exactMatch, SimpleValueFactory.getInstance().createIRI("http://www.chemspider.com/Chemical-Structure.28509384"))); + assertTrue(m.contains(concept, exactMatch, SimpleValueFactory.getInstance().createIRI("http://www.chemspider.com/Chemical-Structure.28509384.html"))); + assertTrue(m.contains(concept, exactMatch, SimpleValueFactory.getInstance().createIRI("http://www.chemspider.com/Chemical-Structure.28509384.rdf"))); } @@ -143,34 +144,34 @@ public void testMappingNoLinkFixedPredicate() throws Exception { Set rdf = statementMaker.asRDF(mappings, "http://example.com/testContext", true, "http://example.com/override"); Model m = asModel(rdf); - assertTrue(m.contains(concept, override, new URIImpl("http://www.conceptwiki.org/concept/index/f25a234e-df03-419f-8504-cde8689a4d1f"))); - assertTrue(m.contains(concept, override, new URIImpl("http://www.conceptwiki.org/web-ws/concept/get?uuid=f25a234e-df03-419f-8504-cde8689a4d1f"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://www.conceptwiki.org/concept/index/f25a234e-df03-419f-8504-cde8689a4d1f"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://www.conceptwiki.org/web-ws/concept/get?uuid=f25a234e-df03-419f-8504-cde8689a4d1f"))); - assertTrue(m.contains(concept, override, new URIImpl("http://identifiers.org/chemspider/28509384"))); - assertTrue(m.contains(concept, override, new URIImpl("http://info.identifiers.org/chemspider/28509384"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://identifiers.org/chemspider/28509384"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://info.identifiers.org/chemspider/28509384"))); - assertTrue(m.contains(concept, override, new URIImpl("http://ops.rsc.org/Compounds/Get/8"))); - assertTrue(m.contains(concept, override, new URIImpl("http://ops.rsc-us.org/OPS8"))); - assertTrue(m.contains(concept, override, new URIImpl("http://ops.rsc.org/OPS8"))); - assertTrue(m.contains(concept, override, new URIImpl("http://ops.rsc.org/OPS8/rdf"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://ops.rsc.org/Compounds/Get/8"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://ops.rsc-us.org/OPS8"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://ops.rsc.org/OPS8"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://ops.rsc.org/OPS8/rdf"))); - assertTrue(m.contains(concept, override, new URIImpl("http://rdf.chemspider.com/28509384"))); - assertTrue(m.contains(concept, override, new URIImpl("http://www.chemspider.com/28509384"))); - assertTrue(m.contains(concept, override, new URIImpl("http://www.chemspider.com/Chemical-Structure.28509384"))); - assertTrue(m.contains(concept, override, new URIImpl("http://www.chemspider.com/Chemical-Structure.28509384.html"))); - assertTrue(m.contains(concept, override, new URIImpl("http://www.chemspider.com/Chemical-Structure.28509384.rdf"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://rdf.chemspider.com/28509384"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://www.chemspider.com/28509384"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://www.chemspider.com/Chemical-Structure.28509384"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://www.chemspider.com/Chemical-Structure.28509384.html"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://www.chemspider.com/Chemical-Structure.28509384.rdf"))); - URI mapSet1Override = new URIImpl("http://example.com/testContextmappingSetRDF/1?predicate=http%3A%2F%2Fexample.com%2Foverride"); - URI mapSet1_3Override = new URIImpl("http://example.com/testContextmappingSetRDF/1_3?predicate=http%3A%2F%2Fexample.com%2Foverride"); - URI example1to2 = new URIImpl("http://example.com/1to2"); - URI example2to3 = new URIImpl("http://example.com/2to3"); + IRI mapSet1Override = SimpleValueFactory.getInstance().createIRI("http://example.com/testContextmappingSetRDF/1?predicate=http%3A%2F%2Fexample.com%2Foverride"); + IRI mapSet1_3Override = SimpleValueFactory.getInstance().createIRI("http://example.com/testContextmappingSetRDF/1_3?predicate=http%3A%2F%2Fexample.com%2Foverride"); + IRI example1to2 = SimpleValueFactory.getInstance().createIRI("http://example.com/1to2"); + IRI example2to3 = SimpleValueFactory.getInstance().createIRI("http://example.com/2to3"); // FIXME: Exactly how should the provenance chains go here? -// URIImpl mapset1 = new URIImpl("http://example.com/testContextmappingSetRDF/1"); +// URIImpl mapset1 = SimpleValueFactory.getInstance().createIRI("http://example.com/testContextmappingSetRDF/1"); // assertTrue(m.contains(mapSet1Override, derivedFrom, mapset1)); // assertTrue(m.contains(mapset1, derivedFrom, example1to2)); // -// URIImpl mapset1_3 = new URIImpl("http://example.com/testContextmappingSetRDF/1_3"); +// URIImpl mapset1_3 = SimpleValueFactory.getInstance().createIRI("http://example.com/testContextmappingSetRDF/1_3"); // assertTrue(m.contains(mapSet1_3Override, derivedFrom, mapset1_3)); // assertTrue(m.contains(mapset1_3, derivedFrom, example1to2)); // assertTrue(m.contains(mapset1_3, derivedFrom, example2to3)); @@ -183,22 +184,22 @@ public void testMappingWithLink() throws Exception { Set mappings = uriMapper.mapFull(map1Uri1, null, true, null, null); Set rdf = statementMaker.asRDF(mappings, "http://example.com/testContext", false, "http://example.com/override"); Model m = asModel(rdf); - assertTrue(m.contains(concept, override, new URIImpl("http://www.conceptwiki.org/concept/index/f25a234e-df03-419f-8504-cde8689a4d1f"))); - assertTrue(m.contains(concept, override, new URIImpl("http://www.conceptwiki.org/web-ws/concept/get?uuid=f25a234e-df03-419f-8504-cde8689a4d1f"))); - - assertTrue(m.contains(concept, override, new URIImpl("http://identifiers.org/chemspider/28509384"))); - assertTrue(m.contains(concept, override, new URIImpl("http://info.identifiers.org/chemspider/28509384"))); - - assertTrue(m.contains(concept, override, new URIImpl("http://ops.rsc.org/Compounds/Get/8"))); - assertTrue(m.contains(concept, override, new URIImpl("http://ops.rsc-us.org/OPS8"))); - assertTrue(m.contains(concept, override, new URIImpl("http://ops.rsc.org/OPS8"))); - assertTrue(m.contains(concept, override, new URIImpl("http://ops.rsc.org/OPS8/rdf"))); - - assertTrue(m.contains(concept, override, new URIImpl("http://rdf.chemspider.com/28509384"))); - assertTrue(m.contains(concept, override, new URIImpl("http://www.chemspider.com/28509384"))); - assertTrue(m.contains(concept, override, new URIImpl("http://www.chemspider.com/Chemical-Structure.28509384"))); - assertTrue(m.contains(concept, override, new URIImpl("http://www.chemspider.com/Chemical-Structure.28509384.html"))); - assertTrue(m.contains(concept, override, new URIImpl("http://www.chemspider.com/Chemical-Structure.28509384.rdf"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://www.conceptwiki.org/concept/index/f25a234e-df03-419f-8504-cde8689a4d1f"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://www.conceptwiki.org/web-ws/concept/get?uuid=f25a234e-df03-419f-8504-cde8689a4d1f"))); + + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://identifiers.org/chemspider/28509384"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://info.identifiers.org/chemspider/28509384"))); + + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://ops.rsc.org/Compounds/Get/8"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://ops.rsc-us.org/OPS8"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://ops.rsc.org/OPS8"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://ops.rsc.org/OPS8/rdf"))); + + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://rdf.chemspider.com/28509384"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://www.chemspider.com/28509384"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://www.chemspider.com/Chemical-Structure.28509384"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://www.chemspider.com/Chemical-Structure.28509384.html"))); + assertTrue(m.contains(concept, override, SimpleValueFactory.getInstance().createIRI("http://www.chemspider.com/Chemical-Structure.28509384.rdf"))); } @Test @@ -207,22 +208,22 @@ public void testMappingWithLinkOverride() throws Exception { Set mappings = uriMapper.mapFull(map1Uri1, null, true, null, null); Set rdf = statementMaker.asRDF(mappings, "http://example.com/testContext", false, null); Model m = asModel(rdf); - assertTrue(m.contains(concept, sameAs, new URIImpl("http://www.conceptwiki.org/concept/index/f25a234e-df03-419f-8504-cde8689a4d1f"))); - assertTrue(m.contains(concept, sameAs, new URIImpl("http://www.conceptwiki.org/web-ws/concept/get?uuid=f25a234e-df03-419f-8504-cde8689a4d1f"))); - - assertTrue(m.contains(concept, exactMatch, new URIImpl("http://identifiers.org/chemspider/28509384"))); - assertTrue(m.contains(concept, exactMatch, new URIImpl("http://info.identifiers.org/chemspider/28509384"))); - - assertTrue(m.contains(concept, exactMatch, new URIImpl("http://ops.rsc.org/Compounds/Get/8"))); - assertTrue(m.contains(concept, exactMatch, new URIImpl("http://ops.rsc-us.org/OPS8"))); - assertTrue(m.contains(concept, exactMatch, new URIImpl("http://ops.rsc.org/OPS8"))); - assertTrue(m.contains(concept, exactMatch, new URIImpl("http://ops.rsc.org/OPS8/rdf"))); - - assertTrue(m.contains(concept, exactMatch, new URIImpl("http://rdf.chemspider.com/28509384"))); - assertTrue(m.contains(concept, exactMatch, new URIImpl("http://www.chemspider.com/28509384"))); - assertTrue(m.contains(concept, exactMatch, new URIImpl("http://www.chemspider.com/Chemical-Structure.28509384"))); - assertTrue(m.contains(concept, exactMatch, new URIImpl("http://www.chemspider.com/Chemical-Structure.28509384.html"))); - assertTrue(m.contains(concept, exactMatch, new URIImpl("http://www.chemspider.com/Chemical-Structure.28509384.rdf"))); + assertTrue(m.contains(concept, sameAs, SimpleValueFactory.getInstance().createIRI("http://www.conceptwiki.org/concept/index/f25a234e-df03-419f-8504-cde8689a4d1f"))); + assertTrue(m.contains(concept, sameAs, SimpleValueFactory.getInstance().createIRI("http://www.conceptwiki.org/web-ws/concept/get?uuid=f25a234e-df03-419f-8504-cde8689a4d1f"))); + + assertTrue(m.contains(concept, exactMatch, SimpleValueFactory.getInstance().createIRI("http://identifiers.org/chemspider/28509384"))); + assertTrue(m.contains(concept, exactMatch, SimpleValueFactory.getInstance().createIRI("http://info.identifiers.org/chemspider/28509384"))); + + assertTrue(m.contains(concept, exactMatch, SimpleValueFactory.getInstance().createIRI("http://ops.rsc.org/Compounds/Get/8"))); + assertTrue(m.contains(concept, exactMatch, SimpleValueFactory.getInstance().createIRI("http://ops.rsc-us.org/OPS8"))); + assertTrue(m.contains(concept, exactMatch, SimpleValueFactory.getInstance().createIRI("http://ops.rsc.org/OPS8"))); + assertTrue(m.contains(concept, exactMatch, SimpleValueFactory.getInstance().createIRI("http://ops.rsc.org/OPS8/rdf"))); + + assertTrue(m.contains(concept, exactMatch, SimpleValueFactory.getInstance().createIRI("http://rdf.chemspider.com/28509384"))); + assertTrue(m.contains(concept, exactMatch, SimpleValueFactory.getInstance().createIRI("http://www.chemspider.com/28509384"))); + assertTrue(m.contains(concept, exactMatch, SimpleValueFactory.getInstance().createIRI("http://www.chemspider.com/Chemical-Structure.28509384"))); + assertTrue(m.contains(concept, exactMatch, SimpleValueFactory.getInstance().createIRI("http://www.chemspider.com/Chemical-Structure.28509384.html"))); + assertTrue(m.contains(concept, exactMatch, SimpleValueFactory.getInstance().createIRI("http://www.chemspider.com/Chemical-Structure.28509384.rdf"))); } } diff --git a/org.bridgedb.uri.ws.client/pom.xml b/org.bridgedb.uri.ws.client/pom.xml index 7b6e68550..3f746819b 100644 --- a/org.bridgedb.uri.ws.client/pom.xml +++ b/org.bridgedb.uri.ws.client/pom.xml @@ -8,7 +8,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT diff --git a/org.bridgedb.uri.ws.core/pom.xml b/org.bridgedb.uri.ws.core/pom.xml index 934a95b68..093873e9a 100644 --- a/org.bridgedb.uri.ws.core/pom.xml +++ b/org.bridgedb.uri.ws.core/pom.xml @@ -8,7 +8,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT diff --git a/org.bridgedb.uri.ws.server/pom.xml b/org.bridgedb.uri.ws.server/pom.xml index d7544240d..8d15232f0 100644 --- a/org.bridgedb.uri.ws.server/pom.xml +++ b/org.bridgedb.uri.ws.server/pom.xml @@ -8,7 +8,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT diff --git a/org.bridgedb.utils/pom.xml b/org.bridgedb.utils/pom.xml index a486e30a5..0b3b58fa1 100644 --- a/org.bridgedb.utils/pom.xml +++ b/org.bridgedb.utils/pom.xml @@ -7,7 +7,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT diff --git a/org.bridgedb.webservice.biomart/pom.xml b/org.bridgedb.webservice.biomart/pom.xml index b2243e70e..069cbc011 100644 --- a/org.bridgedb.webservice.biomart/pom.xml +++ b/org.bridgedb.webservice.biomart/pom.xml @@ -8,7 +8,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT diff --git a/org.bridgedb.webservice.bridgerest/pom.xml b/org.bridgedb.webservice.bridgerest/pom.xml index c674b05ee..b20768f56 100644 --- a/org.bridgedb.webservice.bridgerest/pom.xml +++ b/org.bridgedb.webservice.bridgerest/pom.xml @@ -8,7 +8,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT diff --git a/org.bridgedb.ws.client/pom.xml b/org.bridgedb.ws.client/pom.xml index 26193f525..2019f425f 100644 --- a/org.bridgedb.ws.client/pom.xml +++ b/org.bridgedb.ws.client/pom.xml @@ -8,7 +8,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT diff --git a/org.bridgedb.ws.core/pom.xml b/org.bridgedb.ws.core/pom.xml index 816863fbf..328f127eb 100644 --- a/org.bridgedb.ws.core/pom.xml +++ b/org.bridgedb.ws.core/pom.xml @@ -8,7 +8,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT diff --git a/org.bridgedb.ws.server/pom.xml b/org.bridgedb.ws.server/pom.xml index f1f119ebe..d535b5f68 100644 --- a/org.bridgedb.ws.server/pom.xml +++ b/org.bridgedb.ws.server/pom.xml @@ -8,7 +8,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT diff --git a/org.bridgedb/pom.xml b/org.bridgedb/pom.xml index 9f65fa0de..f1ea89d80 100644 --- a/org.bridgedb/pom.xml +++ b/org.bridgedb/pom.xml @@ -33,7 +33,7 @@ bridgedb-bundle org.bridgedb - 3.1.0 + 3.1.1-SNAPSHOT diff --git a/pom.xml b/pom.xml index 470a6524a..7d960b9b8 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.bridgedb bridgedb-bundle pom - 3.1.0 + 3.1.1-SNAPSHOT BridgeDb bundle BridgeDb is a framework for finding and mapping equivalent database @@ -48,16 +48,16 @@ 3.2.14 2.2 1.10 - 2.20.0 + 2.22.0 8.0.33 Tomcat 3.4 - 3.7.7 + 4.3.8 2.5 - 1.6.4 + 2.0.9 10.15.2.0 1.3.2 - 5.10.0 + 5.10.1 mysql