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.*;
* see http://www.sandre.eaufrance.fr/atlas/srv/fre/catalog.search#/metadata/0bea2eb9-a4ee-4a81-b494-bd4fb5338ef8
*/
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 String getURI() {
return NS;
......
......@@ -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
*/
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 String getURI() {
......@@ -52,14 +52,14 @@ public class INC {
public static final Resource Interlocuteur = resource("Interlocuteur");
public static final Resource AdresseInterlocuteur = resource("1.0/#AdresseInterlocuteur");
public static final Resource Compl2Adresse = resource("1.0/Compl2Adresse");
public static final Resource Compl3Adresse = resource("1.0/Compl3Adresse");
public static final Resource NumLbVoieAdresse = resource("1.0/NumLbVoieAdresse");
public static final Resource LgAcheAdresse = resource("1.0/LgAcheAdresse");
public static final Resource PaysInterlocuteur = resource("1.0/PaysInterlocuteur");
public static final Resource CdPays = resource("1.0/CdPays");
public static final Resource DateCreInterlocuteur = resource("1.0/DateCreInterlocuteur");
public static final Resource DateMAJInterlocuteur = resource("1.0/DateMAJInterlocuteur");
public static final Resource AdresseInterlocuteur = resource("AdresseInterlocuteur");
public static final Resource Compl2Adresse = resource("Compl2Adresse");
public static final Resource Compl3Adresse = resource("Compl3Adresse");
public static final Resource NumLbVoieAdresse = resource("NumLbVoieAdresse");
public static final Resource LgAcheAdresse = resource("LgAcheAdresse");
public static final Resource PaysInterlocuteur = resource("PaysInterlocuteur");
public static final Resource CdPays = resource("CdPays");
public static final Resource DateCreInterlocuteur = resource("DateCreInterlocuteur");
public static final Resource DateMAJInterlocuteur = resource("DateMAJInterlocuteur");
}
......@@ -44,84 +44,83 @@ import java.util.stream.Collectors;
public class ModelURIs {
public static final Map<String, String> NAMESPACE_BY_PREFIX = ImmutableMap.<String, String>builder()
.put("rdf", RDF.uri)
.put("rdfs", RDFS.getURI())
.put("owl", OWL2.NS)
.put("rdf", RDF.uri)
.put("rdfs", RDFS.getURI())
.put("owl", OWL2.NS)
.put("dc", DC_11.NS)
.put("dcam", "http://purl.org/dc/dcam/") // DCMI abstract model
.put("dcterms", DCTerms.NS) // DCMI Terms
.put("dctypes", DCTypes.NS) // DCMI Types
.put("dc", DC_11.NS)
.put("dcam", "http://purl.org/dc/dcam/") // DCMI abstract model
.put("dcterms", DCTerms.NS) // DCMI Terms
.put("dctypes", DCTypes.NS) // DCMI Types
.put("foaf", FOAF.NS)
.put("skos", SKOS.getURI())
.put(GR.PREFIX, GR.NS) // Good relation
.put(W3NS.Org.PREFIX, W3NS.Org.NS)
.put(SCHEMA.PREFIX, SCHEMA.NS)
.put("foaf", FOAF.NS)
.put("skos", SKOS.getURI())
.put(GR.PREFIX, GR.NS) // Good relation
.put(W3NS.Org.PREFIX, W3NS.Org.NS)
.put(SCHEMA.PREFIX, SCHEMA.NS)
// Spatial
.put("spatial",org.eclipse.rdf4j.model.vocabulary.GEO.NAMESPACE) // GeoSparql
.put("geo", "http://www.w3.org/2003/01/geo/wgs84_pos#")
.put("gn", "http://www.geonames.org/ontology#") // Geo names
// Spatial
.put("spatial",org.eclipse.rdf4j.model.vocabulary.GEO.NAMESPACE) // GeoSparql
.put("geo", "http://www.w3.org/2003/01/geo/wgs84_pos#")
.put("gn", "http://www.geonames.org/ontology#") // Geo names
// Darwin core
.put("dwc", DWC.Terms.NS)
.put("dwciri", "http://rs.tdwg.org/dwc/iri/")
.put("dwctax", "http://rs.tdwg.org/ontology/voc/TaxonName#")
// Darwin core
.put("dwc", DWC.Terms.NS)
.put("dwciri", "http://rs.tdwg.org/dwc/iri/")
.put("dwctax", "http://rs.tdwg.org/ontology/voc/TaxonName#")
// TaxonConcept
.put("txn", "http://lod.taxonconcept.org/ontology/txn.owl")
// TaxonConcept
.put("txn", "http://lod.taxonconcept.org/ontology/txn.owl")
// Sandre
.put("apt", APT.NS)
.put("apt2", APT.NS + "2.1/")
.put("inc", INC.NS)
.put("inc1", INC.NS + "1.0/")
// Data catalog
.put("dcat", "http://www.w3.org/ns/dcat")
// TaxRef (MNHN)
.put("taxref", "http://taxref.mnhn.fr/lod/")
.put("taxrefprop", "http://taxref.mnhn.fr/lod/property/")
// Sandre
.put("apt", APT.NS)
.put("inc", INC.NS)
// Data catalog
.put("dcat", "http://www.w3.org/ns/dcat")
// TaxRef (MNHN)
.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()
.put("rdf", RDF.uri)
.put("rdfs", RDFS.getURI())
.put("owl", OWL2.NS)
.put("rdf", RDF.uri)
.put("rdfs", RDFS.getURI())
.put("owl", OWL2.NS)
.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("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("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("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")
// TODO: find the prefix
.put("spatial", org.eclipse.rdf4j.model.vocabulary.GEO.NAMESPACE)
.put("geo", GEO.WGS84Pos.NS)
.put("gn", "http://www.geonames.org/ontology") // Geo names
// TODO: find the prefix
.put("spatial", org.eclipse.rdf4j.model.vocabulary.GEO.NAMESPACE)
.put("geo", GEO.WGS84Pos.NS)
.put("gn", "http://www.geonames.org/ontology") // Geo names
//.put("", "http://www.w3.org/2000/10/swap/pim/contact")
.put("foaf", "http://xmlns.com/foaf/spec/index.rdf")
.put("skos", SKOS.getURI())
//.put("", "http://www.w3.org/2000/10/swap/pim/contact")
.put("foaf", "http://xmlns.com/foaf/spec/index.rdf")
.put("skos", SKOS.getURI())
// Darwin core
.put("dwc", "http://rs.tdwg.org/dwc/terms/")
.put("dwctax", "http://rs.tdwg.org/ontology/voc/TaxonName.rdf")
// Darwin core
.put("dwc", "http://rs.tdwg.org/dwc/terms/")
.put("dwctax", "http://rs.tdwg.org/ontology/voc/TaxonName.rdf")
// TaxonConcept
.put("txn", "http://lod.taxonconcept.org/ontology/txn.owl")
// TaxonConcept
.put("txn", "http://lod.taxonconcept.org/ontology/txn.owl")
// Sandre
.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")
// Sandre
.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")
// Data Catalog
.put("dcat", "http://www.w3.org/ns/dcat")
// Data Catalog
.put("dcat", "http://www.w3.org/ns/dcat")
.build();
.build();
public static String getClassUri(Resource schema, Class clazz) {
return getClassUri(schema.getURI(), clazz);
......
......@@ -22,7 +22,7 @@
package net.sumaris.server.http;
public interface RestPaths {
public interface RdfRestPaths {
String SPARQL_ENDPOINT = "/sparql";
String ONTOLOGY_BASE_PATH = "/ontology";
......
......@@ -25,7 +25,7 @@ package net.sumaris.server.http.config;
import net.sumaris.rdf.config.RdfConfiguration;
import net.sumaris.rdf.model.ModelURIs;
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.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
......@@ -145,13 +145,13 @@ public class RdfWebConfiguration {
public void addCorsMappings(CorsRegistry registry) {
// 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
registry.addMapping(RestPaths.SPARQL_ENDPOINT + "/**")
registry.addMapping(RdfRestPaths.SPARQL_ENDPOINT + "/**")
.allowedOriginPatterns("*")
.allowedMethods("GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS")
.allowedHeaders("accept", "access-control-allow-origin", "authorization", "content-type")
.allowCredentials(true);
registry.addMapping(RestPaths.ONTOLOGY_BASE_PATH + "/**")
registry.addMapping(RdfRestPaths.ONTOLOGY_BASE_PATH + "/**")
.allowedOriginPatterns("*")
.allowedMethods("GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS")
.allowedHeaders("accept", "access-control-allow-origin", "authorization", "content-type")
......
......@@ -37,7 +37,7 @@ import net.sumaris.rdf.service.schema.RdfSchemaService;
import net.sumaris.rdf.util.ModelUtils;
import net.sumaris.rdf.util.RdfFormat;
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.jena.rdf.model.Model;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
......@@ -61,7 +61,7 @@ import java.util.Objects;
@RestController
@ConditionalOnBean({WebMvcConfigurer.class, RdfConfiguration.class})
@Slf4j
public class OntologyRestController implements RestPaths {
public class OntologyRdfRestController implements RdfRestPaths {
protected static final String EXTENSION_PATH_PARAM = ".{extension:[a-z0-9-_]+}";
......
......@@ -34,7 +34,7 @@ import net.sumaris.rdf.service.store.RdfDatasetService;
import net.sumaris.rdf.util.ModelUtils;
import net.sumaris.rdf.util.RdfFormat;
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.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
......@@ -64,7 +64,7 @@ import java.util.Optional;
@RestController
@ConditionalOnBean({WebMvcConfigurer.class, RdfConfiguration.class})
@Slf4j
public class SparqlRestController implements RestPaths {
public class SparqlRdfRestController implements RdfRestPaths {
@Resource
private RdfSchemaService schemaService;
......
......@@ -33,7 +33,7 @@ import net.sumaris.rdf.service.RdfModelService;
import net.sumaris.rdf.util.ModelUtils;
import net.sumaris.rdf.util.RdfFormat;
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.jena.rdf.model.Model;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
......@@ -57,7 +57,7 @@ import java.util.Optional;
@RestController
@ConditionalOnBean({WebMvcConfigurer.class, RdfConfiguration.class})
@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 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