Commit 4b15a735 authored by LAVENIER's avatar LAVENIER
Browse files

[fix] Fix RDF URIs

parent 70180a10
...@@ -30,7 +30,7 @@ import org.apache.jena.rdf.model.*; ...@@ -30,7 +30,7 @@ import org.apache.jena.rdf.model.*;
* see http://www.sandre.eaufrance.fr/atlas/srv/fre/catalog.search#/metadata/0bea2eb9-a4ee-4a81-b494-bd4fb5338ef8 * see http://www.sandre.eaufrance.fr/atlas/srv/fre/catalog.search#/metadata/0bea2eb9-a4ee-4a81-b494-bd4fb5338ef8
*/ */
public class APT { public class APT {
public static final String NS = "http://id.eaufrance.fr/ddd/APT/"; public static final String NS = "http://id.eaufrance.fr/ddd/APT/2.1/";
public static final String PREFIX = "apt"; public static final String PREFIX = "apt";
public static String getURI() { public static String getURI() {
return NS; return NS;
......
...@@ -33,7 +33,7 @@ import org.w3.GEO; ...@@ -33,7 +33,7 @@ import org.w3.GEO;
* see http://www.sandre.eaufrance.fr/atlas/srv/fre/catalog.search#/metadata/0bea2eb9-a4ee-4a81-b494-bd4fb5338ef8 * see http://www.sandre.eaufrance.fr/atlas/srv/fre/catalog.search#/metadata/0bea2eb9-a4ee-4a81-b494-bd4fb5338ef8
*/ */
public class INC { public class INC {
public static final String NS = "http://id.eaufrance.fr/ddd/INC/"; public static final String NS = "http://id.eaufrance.fr/ddd/INC/1.0/";
public static final String PREFIX = "inc"; public static final String PREFIX = "inc";
public static String getURI() { public static String getURI() {
...@@ -52,14 +52,14 @@ public class INC { ...@@ -52,14 +52,14 @@ public class INC {
public static final Resource Interlocuteur = resource("Interlocuteur"); public static final Resource Interlocuteur = resource("Interlocuteur");
public static final Resource AdresseInterlocuteur = resource("1.0/#AdresseInterlocuteur"); public static final Resource AdresseInterlocuteur = resource("AdresseInterlocuteur");
public static final Resource Compl2Adresse = resource("1.0/Compl2Adresse"); public static final Resource Compl2Adresse = resource("Compl2Adresse");
public static final Resource Compl3Adresse = resource("1.0/Compl3Adresse"); public static final Resource Compl3Adresse = resource("Compl3Adresse");
public static final Resource NumLbVoieAdresse = resource("1.0/NumLbVoieAdresse"); public static final Resource NumLbVoieAdresse = resource("NumLbVoieAdresse");
public static final Resource LgAcheAdresse = resource("1.0/LgAcheAdresse"); public static final Resource LgAcheAdresse = resource("LgAcheAdresse");
public static final Resource PaysInterlocuteur = resource("1.0/PaysInterlocuteur"); public static final Resource PaysInterlocuteur = resource("PaysInterlocuteur");
public static final Resource CdPays = resource("1.0/CdPays"); public static final Resource CdPays = resource("CdPays");
public static final Resource DateCreInterlocuteur = resource("1.0/DateCreInterlocuteur"); public static final Resource DateCreInterlocuteur = resource("DateCreInterlocuteur");
public static final Resource DateMAJInterlocuteur = resource("1.0/DateMAJInterlocuteur"); public static final Resource DateMAJInterlocuteur = resource("DateMAJInterlocuteur");
} }
...@@ -44,84 +44,83 @@ import java.util.stream.Collectors; ...@@ -44,84 +44,83 @@ import java.util.stream.Collectors;
public class ModelURIs { public class ModelURIs {
public static final Map<String, String> NAMESPACE_BY_PREFIX = ImmutableMap.<String, String>builder() public static final Map<String, String> NAMESPACE_BY_PREFIX = ImmutableMap.<String, String>builder()
.put("rdf", RDF.uri) .put("rdf", RDF.uri)
.put("rdfs", RDFS.getURI()) .put("rdfs", RDFS.getURI())
.put("owl", OWL2.NS) .put("owl", OWL2.NS)
.put("dc", DC_11.NS) .put("dc", DC_11.NS)
.put("dcam", "http://purl.org/dc/dcam/") // DCMI abstract model .put("dcam", "http://purl.org/dc/dcam/") // DCMI abstract model
.put("dcterms", DCTerms.NS) // DCMI Terms .put("dcterms", DCTerms.NS) // DCMI Terms
.put("dctypes", DCTypes.NS) // DCMI Types .put("dctypes", DCTypes.NS) // DCMI Types
.put("foaf", FOAF.NS) .put("foaf", FOAF.NS)
.put("skos", SKOS.getURI()) .put("skos", SKOS.getURI())
.put(GR.PREFIX, GR.NS) // Good relation .put(GR.PREFIX, GR.NS) // Good relation
.put(W3NS.Org.PREFIX, W3NS.Org.NS) .put(W3NS.Org.PREFIX, W3NS.Org.NS)
.put(SCHEMA.PREFIX, SCHEMA.NS) .put(SCHEMA.PREFIX, SCHEMA.NS)
// Spatial // Spatial
.put("spatial",org.eclipse.rdf4j.model.vocabulary.GEO.NAMESPACE) // GeoSparql .put("spatial",org.eclipse.rdf4j.model.vocabulary.GEO.NAMESPACE) // GeoSparql
.put("geo", "http://www.w3.org/2003/01/geo/wgs84_pos#") .put("geo", "http://www.w3.org/2003/01/geo/wgs84_pos#")
.put("gn", "http://www.geonames.org/ontology#") // Geo names .put("gn", "http://www.geonames.org/ontology#") // Geo names
// Darwin core // Darwin core
.put("dwc", DWC.Terms.NS) .put("dwc", DWC.Terms.NS)
.put("dwciri", "http://rs.tdwg.org/dwc/iri/") .put("dwciri", "http://rs.tdwg.org/dwc/iri/")
.put("dwctax", "http://rs.tdwg.org/ontology/voc/TaxonName#") .put("dwctax", "http://rs.tdwg.org/ontology/voc/TaxonName#")
// TaxonConcept // TaxonConcept
.put("txn", "http://lod.taxonconcept.org/ontology/txn.owl") .put("txn", "http://lod.taxonconcept.org/ontology/txn.owl")
// Sandre // Data catalog
.put("apt", APT.NS) .put("dcat", "http://www.w3.org/ns/dcat")
.put("apt2", APT.NS + "2.1/")
.put("inc", INC.NS)
.put("inc1", INC.NS + "1.0/")
// TaxRef (MNHN) // Sandre
.put("taxref", "http://taxref.mnhn.fr/lod/") .put("apt", APT.NS)
.put("taxrefprop", "http://taxref.mnhn.fr/lod/property/") .put("inc", INC.NS)
// Data catalog // TaxRef (MNHN)
.put("dcat", "http://www.w3.org/ns/dcat") .put("taxref", "http://taxref.mnhn.fr/lod/")
.put("taxrefprop", "http://taxref.mnhn.fr/lod/property/")
.build();
.build();
public static final Map<String, String> RDF_URL_BY_PREFIX = ImmutableMap.<String, String>builder() public static final Map<String, String> RDF_URL_BY_PREFIX = ImmutableMap.<String, String>builder()
.put("rdf", RDF.uri) .put("rdf", RDF.uri)
.put("rdfs", RDFS.getURI()) .put("rdfs", RDFS.getURI())
.put("owl", OWL2.NS) .put("owl", OWL2.NS)
.put("dc", "https://www.dublincore.org/specifications/dublin-core/dcmi-terms/dublin_core_elements.rdf") .put("dc", "https://www.dublincore.org/specifications/dublin-core/dcmi-terms/dublin_core_elements.rdf")
.put("dcam", "https://www.dublincore.org/specifications/dublin-core/dcmi-terms/dublin_core_abstract_model.rdf") .put("dcam", "https://www.dublincore.org/specifications/dublin-core/dcmi-terms/dublin_core_abstract_model.rdf")
.put("dcterms", "https://www.dublincore.org/specifications/dublin-core/dcmi-terms/dublin_core_terms.rdf") .put("dcterms", "https://www.dublincore.org/specifications/dublin-core/dcmi-terms/dublin_core_terms.rdf")
.put("dctypes", "https://www.dublincore.org/specifications/dublin-core/dcmi-terms/dublin_core_type.rdf") .put("dctypes", "https://www.dublincore.org/specifications/dublin-core/dcmi-terms/dublin_core_type.rdf")
// TODO: find the prefix // TODO: find the prefix
.put("spatial", org.eclipse.rdf4j.model.vocabulary.GEO.NAMESPACE) .put("spatial", org.eclipse.rdf4j.model.vocabulary.GEO.NAMESPACE)
.put("geo", GEO.WGS84Pos.NS) .put("geo", GEO.WGS84Pos.NS)
.put("gn", "http://www.geonames.org/ontology") // Geo names .put("gn", "http://www.geonames.org/ontology") // Geo names
//.put("", "http://www.w3.org/2000/10/swap/pim/contact") //.put("", "http://www.w3.org/2000/10/swap/pim/contact")
.put("foaf", "http://xmlns.com/foaf/spec/index.rdf") .put("foaf", "http://xmlns.com/foaf/spec/index.rdf")
.put("skos", SKOS.getURI()) .put("skos", SKOS.getURI())
// Darwin core // Darwin core
.put("dwc", "http://rs.tdwg.org/dwc/terms/") .put("dwc", "http://rs.tdwg.org/dwc/terms/")
.put("dwctax", "http://rs.tdwg.org/ontology/voc/TaxonName.rdf") .put("dwctax", "http://rs.tdwg.org/ontology/voc/TaxonName.rdf")
// TaxonConcept // TaxonConcept
.put("txn", "http://lod.taxonconcept.org/ontology/txn.owl") .put("txn", "http://lod.taxonconcept.org/ontology/txn.owl")
// Sandre // Sandre
.put("apt", "http://owl.sandre.eaufrance.fr/apt/2.1/sandre_fmt_owl_apt.owl") .put("apt", "http://owl.sandre.eaufrance.fr/apt/2.1/sandre_fmt_owl_apt.owl")
.put("inc", "http://owl.sandre.eaufrance.fr/inc/1/sandre_fmt_owl_inc.owl") .put("inc", "http://owl.sandre.eaufrance.fr/inc/1/sandre_fmt_owl_inc.owl")
// Data Catalog // Data Catalog
.put("dcat", "http://www.w3.org/ns/dcat") .put("dcat", "http://www.w3.org/ns/dcat")
.build(); .build();
public static String getClassUri(Resource schema, Class clazz) { public static String getClassUri(Resource schema, Class clazz) {
return getClassUri(schema.getURI(), clazz); return getClassUri(schema.getURI(), clazz);
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
package net.sumaris.server.http; package net.sumaris.server.http;
public interface RestPaths { public interface RdfRestPaths {
String SPARQL_ENDPOINT = "/sparql"; String SPARQL_ENDPOINT = "/sparql";
String ONTOLOGY_BASE_PATH = "/ontology"; String ONTOLOGY_BASE_PATH = "/ontology";
......
...@@ -25,7 +25,7 @@ package net.sumaris.server.http.config; ...@@ -25,7 +25,7 @@ package net.sumaris.server.http.config;
import net.sumaris.rdf.config.RdfConfiguration; import net.sumaris.rdf.config.RdfConfiguration;
import net.sumaris.rdf.model.ModelURIs; import net.sumaris.rdf.model.ModelURIs;
import net.sumaris.rdf.util.RdfFormat; import net.sumaris.rdf.util.RdfFormat;
import net.sumaris.server.http.RestPaths; import net.sumaris.server.http.RdfRestPaths;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
...@@ -145,13 +145,13 @@ public class RdfWebConfiguration { ...@@ -145,13 +145,13 @@ public class RdfWebConfiguration {
public void addCorsMappings(CorsRegistry registry) { public void addCorsMappings(CorsRegistry registry) {
// Enable Global CORS support for the application // Enable Global CORS support for the application
//See https://stackoverflow.com/questions/35315090/spring-boot-enable-global-cors-support-issue-only-get-is-working-post-put-and //See https://stackoverflow.com/questions/35315090/spring-boot-enable-global-cors-support-issue-only-get-is-working-post-put-and
registry.addMapping(RestPaths.SPARQL_ENDPOINT + "/**") registry.addMapping(RdfRestPaths.SPARQL_ENDPOINT + "/**")
.allowedOriginPatterns("*") .allowedOriginPatterns("*")
.allowedMethods("GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS") .allowedMethods("GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS")
.allowedHeaders("accept", "access-control-allow-origin", "authorization", "content-type") .allowedHeaders("accept", "access-control-allow-origin", "authorization", "content-type")
.allowCredentials(true); .allowCredentials(true);
registry.addMapping(RestPaths.ONTOLOGY_BASE_PATH + "/**") registry.addMapping(RdfRestPaths.ONTOLOGY_BASE_PATH + "/**")
.allowedOriginPatterns("*") .allowedOriginPatterns("*")
.allowedMethods("GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS") .allowedMethods("GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS")
.allowedHeaders("accept", "access-control-allow-origin", "authorization", "content-type") .allowedHeaders("accept", "access-control-allow-origin", "authorization", "content-type")
......
...@@ -37,7 +37,7 @@ import net.sumaris.rdf.service.schema.RdfSchemaService; ...@@ -37,7 +37,7 @@ import net.sumaris.rdf.service.schema.RdfSchemaService;
import net.sumaris.rdf.util.ModelUtils; import net.sumaris.rdf.util.ModelUtils;
import net.sumaris.rdf.util.RdfFormat; import net.sumaris.rdf.util.RdfFormat;
import net.sumaris.rdf.util.RdfMediaType; import net.sumaris.rdf.util.RdfMediaType;
import net.sumaris.server.http.RestPaths; import net.sumaris.server.http.RdfRestPaths;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.Model;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
...@@ -61,7 +61,7 @@ import java.util.Objects; ...@@ -61,7 +61,7 @@ import java.util.Objects;
@RestController @RestController
@ConditionalOnBean({WebMvcConfigurer.class, RdfConfiguration.class}) @ConditionalOnBean({WebMvcConfigurer.class, RdfConfiguration.class})
@Slf4j @Slf4j
public class OntologyRestController implements RestPaths { public class OntologyRdfRestController implements RdfRestPaths {
protected static final String EXTENSION_PATH_PARAM = ".{extension:[a-z0-9-_]+}"; protected static final String EXTENSION_PATH_PARAM = ".{extension:[a-z0-9-_]+}";
......
...@@ -34,7 +34,7 @@ import net.sumaris.rdf.service.store.RdfDatasetService; ...@@ -34,7 +34,7 @@ import net.sumaris.rdf.service.store.RdfDatasetService;
import net.sumaris.rdf.util.ModelUtils; import net.sumaris.rdf.util.ModelUtils;
import net.sumaris.rdf.util.RdfFormat; import net.sumaris.rdf.util.RdfFormat;
import net.sumaris.rdf.util.RdfMediaType; import net.sumaris.rdf.util.RdfMediaType;
import net.sumaris.server.http.RestPaths; import net.sumaris.server.http.RdfRestPaths;
import org.apache.jena.query.*; import org.apache.jena.query.*;
import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.rdf.model.ModelFactory;
...@@ -64,7 +64,7 @@ import java.util.Optional; ...@@ -64,7 +64,7 @@ import java.util.Optional;
@RestController @RestController
@ConditionalOnBean({WebMvcConfigurer.class, RdfConfiguration.class}) @ConditionalOnBean({WebMvcConfigurer.class, RdfConfiguration.class})
@Slf4j @Slf4j
public class SparqlRestController implements RestPaths { public class SparqlRdfRestController implements RdfRestPaths {
@Resource @Resource
private RdfSchemaService schemaService; private RdfSchemaService schemaService;
......
...@@ -33,7 +33,7 @@ import net.sumaris.rdf.service.RdfModelService; ...@@ -33,7 +33,7 @@ import net.sumaris.rdf.service.RdfModelService;
import net.sumaris.rdf.util.ModelUtils; import net.sumaris.rdf.util.ModelUtils;
import net.sumaris.rdf.util.RdfFormat; import net.sumaris.rdf.util.RdfFormat;
import net.sumaris.rdf.util.RdfMediaType; import net.sumaris.rdf.util.RdfMediaType;
import net.sumaris.server.http.RestPaths; import net.sumaris.server.http.RdfRestPaths;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.Model;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
...@@ -57,7 +57,7 @@ import java.util.Optional; ...@@ -57,7 +57,7 @@ import java.util.Optional;
@RestController @RestController
@ConditionalOnBean({WebMvcConfigurer.class, RdfConfiguration.class}) @ConditionalOnBean({WebMvcConfigurer.class, RdfConfiguration.class})
@Slf4j @Slf4j
public class WebvowlRestController implements RestPaths { public class WebvowlRdfRestController implements RdfRestPaths {
public static final String SERVER_TIMESTAMP_PATH = WEBVOWL_BASE_PATH +"/serverTimeStamp"; public static final String SERVER_TIMESTAMP_PATH = WEBVOWL_BASE_PATH +"/serverTimeStamp";
public static final String CONVERT_PATH = WEBVOWL_BASE_PATH + "/convert"; public static final String CONVERT_PATH = WEBVOWL_BASE_PATH + "/convert";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment