}
- */
-public class DH
-{
-
- /** The RDF model that holds the vocabulary terms
*/
- private static OntModel m_model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, null);
-
- /** The namespace of the vocabulary as a string
*/
- public static final String NS = "https://www.w3.org/ns/ldt/document-hierarchy#";
-
- /** The namespace of the vocabulary as a string
- * @see #NS */
- public static String getURI()
- {
- return NS;
- }
-
- /** The namespace of the vocabulary as a resource
*/
- public static final Resource NAMESPACE = m_model.createResource( NS );
-
- public static final OntClass Document = m_model.createClass( NS + "Document" );
-
- public static final OntClass Container = m_model.createClass( NS + "Container" );
-
- public static final OntClass Item = m_model.createClass( NS + "Item" );
-
- public static final DatatypeProperty slug = m_model.createDatatypeProperty( NS + "slug" );
-
- public static final ObjectProperty select = m_model.createObjectProperty( NS + "select");
-
-}
diff --git a/src/main/java/com/atomgraph/processor/vocabulary/NGT.java b/src/main/java/com/atomgraph/processor/vocabulary/NGT.java
deleted file mode 100644
index f509d78c..00000000
--- a/src/main/java/com/atomgraph/processor/vocabulary/NGT.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2017 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.atomgraph.processor.vocabulary;
-
-import org.apache.jena.ontology.OntClass;
-import org.apache.jena.ontology.OntModel;
-import org.apache.jena.ontology.OntModelSpec;
-import org.apache.jena.rdf.model.ModelFactory;
-import org.apache.jena.rdf.model.Resource;
-
-/**
- *
- * @author Martynas Jusevičius {@literal }
- */
-public class NGT
-{
-
- /** The RDF model that holds the vocabulary terms
*/
- private static OntModel m_model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, null);
-
- /** The namespace of the vocabulary as a string
*/
- public static final String NS = "https://www.w3.org/ns/ldt/named-graphs/templates#";
-
- /** The namespace of the vocabulary as a string
- * @see #NS */
- public static String getURI()
- {
- return NS;
- }
-
- /** The namespace of the vocabulary as a resource
*/
- public static final Resource NAMESPACE = m_model.createResource( NS );
-
- public static final OntClass Container = m_model.createClass( NS + "Container" );
-
- public static final OntClass Item = m_model.createClass( NS + "Item" );
-
-}
diff --git a/src/main/java/com/atomgraph/server/exception/ModelException.java b/src/main/java/com/atomgraph/server/exception/ModelException.java
deleted file mode 100644
index b8ae5e3f..00000000
--- a/src/main/java/com/atomgraph/server/exception/ModelException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2016 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.atomgraph.server.exception;
-
-import org.apache.jena.rdf.model.Model;
-
-/**
- *
- * @author Martynas Jusevičius {@literal }
- */
-public class ModelException extends RuntimeException
-{
-
- private final Model model;
-
- public ModelException(Model model)
- {
- this.model = model;
- }
-
- public ModelException(Throwable throwable, Model model)
- {
- super(throwable);
- this.model = model;
- }
-
- public Model getModel()
- {
- return model;
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/com/atomgraph/server/exception/SHACLConstraintViolationException.java b/src/main/java/com/atomgraph/server/exception/SHACLConstraintViolationException.java
deleted file mode 100644
index 585f0ac0..00000000
--- a/src/main/java/com/atomgraph/server/exception/SHACLConstraintViolationException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2021 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.atomgraph.server.exception;
-
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.shacl.ValidationReport;
-
-/**
- *
- * @author Martynas Jusevičius {@literal }
- */
-public class SHACLConstraintViolationException extends ModelException
-{
-
- private final ValidationReport report;
-
- public SHACLConstraintViolationException(ValidationReport report, Model model)
- {
- super(model);
- this.report = report;
- }
-
- public ValidationReport getValidationReport()
- {
- return report;
- }
-
-}
diff --git a/src/main/java/com/atomgraph/server/exception/SPINConstraintViolationException.java b/src/main/java/com/atomgraph/server/exception/SPINConstraintViolationException.java
deleted file mode 100644
index 59723b41..00000000
--- a/src/main/java/com/atomgraph/server/exception/SPINConstraintViolationException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2013 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.atomgraph.server.exception;
-
-import org.apache.jena.rdf.model.Model;
-import java.util.List;
-import com.atomgraph.spinrdf.constraints.ConstraintViolation;
-
-/**
- *
- * @author Martynas Jusevičius {@literal }
- */
-public class SPINConstraintViolationException extends ModelException
-{
- private final List cvs;
-
- public SPINConstraintViolationException(List cvs, Model model, String graphURI)
- {
- super(model);
- this.cvs = cvs;
- }
-
- public SPINConstraintViolationException(List cvs, Model model)
- {
- this(cvs, model, null);
- }
-
- public List getConstraintViolations()
- {
- return cvs;
- }
-
-}
diff --git a/src/main/java/com/atomgraph/server/exception/SkolemizationException.java b/src/main/java/com/atomgraph/server/exception/SkolemizationException.java
deleted file mode 100644
index 3a12ba90..00000000
--- a/src/main/java/com/atomgraph/server/exception/SkolemizationException.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2016 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.atomgraph.server.exception;
-
-import org.apache.jena.rdf.model.Model;
-
-/**
- *
- * @author Martynas Jusevičius {@literal }
- */
-public class SkolemizationException extends ModelException
-{
-
- public SkolemizationException(IllegalArgumentException ex, Model model)
- {
- super(ex, model);
- }
-
-}
diff --git a/src/main/java/com/atomgraph/server/io/BasedModelProvider.java b/src/main/java/com/atomgraph/server/io/BasedModelProvider.java
deleted file mode 100644
index ba86d734..00000000
--- a/src/main/java/com/atomgraph/server/io/BasedModelProvider.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2017 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.atomgraph.server.io;
-
-import com.atomgraph.core.io.ModelProvider;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import jakarta.ws.rs.core.Context;
-import jakarta.ws.rs.core.MediaType;
-import jakarta.ws.rs.core.MultivaluedMap;
-import jakarta.ws.rs.core.UriInfo;
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.rdf.model.ModelFactory;
-import org.apache.jena.riot.Lang;
-import org.apache.jena.riot.RDFLanguages;
-import org.apache.jena.shared.NoReaderForLangException;
-import org.apache.jena.shared.NoWriterForLangException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * A provider that reads/writes model and resolves relative URIs against request base URI.
- *
- * @author Martynas Jusevičius {@literal }
- */
-public class BasedModelProvider extends ModelProvider
-{
-
- private static final Logger log = LoggerFactory.getLogger(BasedModelProvider.class);
-
- @Context UriInfo uriInfo;
-
- @Override
- public Model readFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) throws IOException
- {
- if (log.isTraceEnabled()) log.trace("Reading Model with HTTP headers: {} MediaType: {}", httpHeaders, mediaType);
-
- Model model = ModelFactory.createDefaultModel();
-
- MediaType formatType = new MediaType(mediaType.getType(), mediaType.getSubtype()); // discard charset param
- Lang lang = RDFLanguages.contentTypeToLang(formatType.toString());
- if (lang == null)
- {
- if (log.isErrorEnabled()) log.error("MediaType '{}' not supported by Jena", formatType);
- throw new NoReaderForLangException("MediaType not supported: " + formatType);
- }
- if (log.isDebugEnabled()) log.debug("RDF language used to read Model: {}", lang);
-
- return read(model, entityStream, lang, getUriInfo().getAbsolutePath().toString());
- }
-
- @Override
- public void writeTo(Model model, Class> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException
- {
- if (log.isTraceEnabled()) log.trace("Writing Model with HTTP headers: {} MediaType: {}", httpHeaders, mediaType);
-
- MediaType formatType = new MediaType(mediaType.getType(), mediaType.getSubtype()); // discard charset param
- Lang lang = RDFLanguages.contentTypeToLang(formatType.toString());
- if (lang == null)
- {
- if (log.isErrorEnabled()) log.error("MediaType '{}' not supported by Jena", formatType);
- throw new NoWriterForLangException("MediaType not supported: " + formatType);
- }
- if (log.isDebugEnabled()) log.debug("RDF language used to read Model: {}", lang);
-
- write(model, entityStream, lang, getUriInfo().getAbsolutePath().toString());
- }
-
- public UriInfo getUriInfo()
- {
- return uriInfo;
- }
-
-}
diff --git a/src/main/java/com/atomgraph/server/io/ValidatingDatasetProvider.java b/src/main/java/com/atomgraph/server/io/ValidatingDatasetProvider.java
deleted file mode 100644
index a026d422..00000000
--- a/src/main/java/com/atomgraph/server/io/ValidatingDatasetProvider.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright 2019 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.atomgraph.server.io;
-
-import com.atomgraph.core.io.DatasetProvider;
-import com.atomgraph.processor.util.Validator;
-import com.atomgraph.server.exception.SHACLConstraintViolationException;
-import com.atomgraph.server.exception.SPINConstraintViolationException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Iterator;
-import java.util.List;
-import jakarta.inject.Inject;
-import jakarta.ws.rs.core.Context;
-import jakarta.ws.rs.core.MediaType;
-import jakarta.ws.rs.core.MultivaluedMap;
-import jakarta.ws.rs.ext.Providers;
-import org.apache.jena.ontology.Ontology;
-import org.apache.jena.query.Dataset;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import com.atomgraph.spinrdf.constraints.ConstraintViolation;
-import java.util.Optional;
-import org.apache.jena.shacl.ShaclValidator;
-import org.apache.jena.shacl.Shapes;
-import org.apache.jena.shacl.ValidationReport;
-
-/**
- * Dataset provider that validates read triples in each graph against SPIN constraints in an ontology.
- *
- * @author Martynas Jusevičius {@literal }
- */
-public class ValidatingDatasetProvider extends DatasetProvider
-{
-
- private static final Logger log = LoggerFactory.getLogger(ValidatingDatasetProvider.class);
-
- @Context private Providers providers;
-
- @Inject jakarta.inject.Provider> ontology;
-
- @Override
- public Dataset readFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) throws IOException
- {
- return process(super.readFrom(type, genericType, annotations, mediaType, httpHeaders, entityStream));
- }
-
- public Dataset process(Dataset dataset)
- {
- return validate(dataset);
- }
-
- public Dataset validate(Dataset dataset)
- {
- if (getOntology().isPresent())
- {
- // SPIN validation
- Validator validator = new Validator(getOntology().get().getOntModel());
- List cvs = validator.validate(dataset.getDefaultModel());
- if (!cvs.isEmpty())
- {
- if (log.isDebugEnabled()) log.debug("SPIN constraint violations: {}", cvs);
- throw new SPINConstraintViolationException(cvs, dataset.getDefaultModel());
- }
-
- // SHACL validation
- Shapes shapes = Shapes.parse(getOntology().get().getOntModel().getGraph());
- ValidationReport report = ShaclValidator.get().validate(shapes, dataset.getDefaultModel().getGraph());
- if (!report.conforms())
- {
- if (log.isDebugEnabled()) log.debug("SHACL constraint violations: {}", report);
- throw new SHACLConstraintViolationException(report, dataset.getDefaultModel());
- }
-
- Iterator it = dataset.listNames();
- while (it.hasNext())
- {
- String graphURI = it.next();
-
- // SPIN validation
- cvs = validator.validate(dataset.getNamedModel(graphURI));
- if (!cvs.isEmpty())
- {
- if (log.isDebugEnabled()) log.debug("SPIN constraint violations: {}", cvs);
- throw new SPINConstraintViolationException(cvs, dataset.getNamedModel(graphURI), graphURI);
- }
-
- // SHACL validation
- report = ShaclValidator.get().validate(shapes, dataset.getNamedModel(graphURI).getGraph());
- if (!report.conforms())
- {
- if (log.isDebugEnabled()) log.debug("SHACL constraint violations: {}", report);
- throw new SHACLConstraintViolationException(report, dataset.getNamedModel(graphURI));
- }
- }
- }
-
- return dataset;
- }
-
- public Optional getOntology()
- {
- return ontology.get();
- }
-
- public Providers getProviders()
- {
- return providers;
- }
-
-}
diff --git a/src/main/java/com/atomgraph/server/io/ValidatingModelProvider.java b/src/main/java/com/atomgraph/server/io/ValidatingModelProvider.java
deleted file mode 100644
index 7576635b..00000000
--- a/src/main/java/com/atomgraph/server/io/ValidatingModelProvider.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 2015 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.atomgraph.server.io;
-
-import org.apache.jena.ontology.Ontology;
-import org.apache.jena.rdf.model.Model;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.List;
-import jakarta.ws.rs.core.Context;
-import jakarta.ws.rs.core.MediaType;
-import jakarta.ws.rs.core.MultivaluedMap;
-import jakarta.ws.rs.ext.Providers;
-import com.atomgraph.server.exception.SPINConstraintViolationException;
-import com.atomgraph.processor.util.Validator;
-import com.atomgraph.server.exception.SHACLConstraintViolationException;
-import jakarta.inject.Inject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import com.atomgraph.spinrdf.constraints.ConstraintViolation;
-import java.io.OutputStream;
-import java.util.Optional;
-import org.apache.jena.shacl.ShaclValidator;
-import org.apache.jena.shacl.Shapes;
-import org.apache.jena.shacl.ValidationReport;
-
-/**
- * Model provider that validates read triples against SPIN constraints in an ontology.
- *
- * @author Martynas Jusevičius {@literal }
- */
-public class ValidatingModelProvider extends BasedModelProvider
-{
- private static final Logger log = LoggerFactory.getLogger(ValidatingModelProvider.class);
-
- @Context private Providers providers;
-
- @Inject jakarta.inject.Provider> ontology;
-
- @Override
- public Model readFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) throws IOException
- {
- return processRead(super.readFrom(type, genericType, annotations, mediaType, httpHeaders, entityStream));
- }
-
- public Model processRead(Model model)
- {
- return validate(model);
- }
-
- public Model validate(Model model)
- {
- if (getOntology().isPresent())
- {
- // SPIN validation
- List cvs = new Validator(getOntology().get().getOntModel()).validate(model);
- if (!cvs.isEmpty())
- {
- if (log.isDebugEnabled()) log.debug("SPIN constraint violations: {}", cvs);
- throw new SPINConstraintViolationException(cvs, model);
- }
-
- // SHACL validation
- Shapes shapes = Shapes.parse(getOntology().get().getOntModel().getGraph());
- ValidationReport report = ShaclValidator.get().validate(shapes, model.getGraph());
- if (!report.conforms())
- {
- if (log.isDebugEnabled()) log.debug("SHACL constraint violations: {}", report);
- throw new SHACLConstraintViolationException(report, model);
- }
- }
-
- return model;
- }
-
- @Override
- public void writeTo(Model model, Class> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException
- {
- super.writeTo(processWrite(model), type, genericType, annotations, mediaType, httpHeaders, entityStream);
- }
-
- public Model processWrite(Model model)
- {
- return model;
- }
-
- public Optional getOntology()
- {
- return ontology.get();
- }
-
- public Providers getProviders()
- {
- return providers;
- }
-
-}
diff --git a/src/main/java/com/atomgraph/server/mapper/BadGatewayExceptionMapper.java b/src/main/java/com/atomgraph/server/mapper/BadGatewayExceptionMapper.java
deleted file mode 100644
index 6ffb15fa..00000000
--- a/src/main/java/com/atomgraph/server/mapper/BadGatewayExceptionMapper.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2015 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.atomgraph.server.mapper;
-
-import com.atomgraph.core.MediaTypes;
-import com.atomgraph.core.exception.BadGatewayException;
-import jakarta.inject.Inject;
-import org.apache.jena.rdf.model.ResourceFactory;
-import jakarta.ws.rs.core.Response;
-import jakarta.ws.rs.ext.ExceptionMapper;
-import org.apache.jena.rdf.model.Resource;
-
-/**
- *
- * @author Martynas Jusevičius {@literal }
- */
-public class BadGatewayExceptionMapper extends ExceptionMapperBase implements ExceptionMapper
-{
-
- @Inject
- public BadGatewayExceptionMapper(MediaTypes mediaTypes)
- {
- super(mediaTypes);
- }
-
- @Override
- public Response toResponse(BadGatewayException ex)
- {
- Resource exRes = toResource(ex, Response.Status.INTERNAL_SERVER_ERROR,
- ResourceFactory.createResource("http://www.w3.org/2011/http-statusCodes#BadGateway"));
-
- return getResponseBuilder(exRes.getModel()).
- status(Response.Status.INTERNAL_SERVER_ERROR).
- build();
- }
-
-}
diff --git a/src/main/java/com/atomgraph/server/mapper/ConfigurationExceptionMapper.java b/src/main/java/com/atomgraph/server/mapper/ConfigurationExceptionMapper.java
deleted file mode 100644
index b796607c..00000000
--- a/src/main/java/com/atomgraph/server/mapper/ConfigurationExceptionMapper.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2017 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.atomgraph.server.mapper;
-
-import com.atomgraph.core.MediaTypes;
-import org.apache.jena.rdf.model.ResourceFactory;
-import jakarta.ws.rs.core.Response;
-import jakarta.ws.rs.ext.ExceptionMapper;
-import com.atomgraph.core.exception.ConfigurationException;
-import jakarta.inject.Inject;
-
-/**
- *
- * @author Martynas Jusevičius {@literal }
- */
-public class ConfigurationExceptionMapper extends ExceptionMapperBase implements ExceptionMapper
-{
-
- @Inject
- public ConfigurationExceptionMapper(MediaTypes mediaTypes)
- {
- super(mediaTypes);
- }
-
- @Override
- public Response toResponse(ConfigurationException ex)
- {
- return getResponseBuilder(toResource(ex, Response.Status.INTERNAL_SERVER_ERROR,
- ResourceFactory.createResource("http://www.w3.org/2011/http-statusCodes#InternalServerError")).
- getModel()).
- status(Response.Status.INTERNAL_SERVER_ERROR).
- build();
- }
-
-}
diff --git a/src/main/java/com/atomgraph/server/mapper/ExceptionMapperBase.java b/src/main/java/com/atomgraph/server/mapper/ExceptionMapperBase.java
deleted file mode 100644
index 90762430..00000000
--- a/src/main/java/com/atomgraph/server/mapper/ExceptionMapperBase.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright 2014 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.atomgraph.server.mapper;
-
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.rdf.model.ModelFactory;
-import org.apache.jena.rdf.model.Resource;
-import org.apache.jena.vocabulary.DCTerms;
-import org.apache.jena.vocabulary.RDF;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-import jakarta.ws.rs.core.Context;
-import jakarta.ws.rs.core.Request;
-import jakarta.ws.rs.core.Response;
-import jakarta.ws.rs.core.UriInfo;
-import jakarta.ws.rs.core.Variant;
-import jakarta.ws.rs.ext.Provider;
-import com.atomgraph.core.MediaTypes;
-import com.atomgraph.core.util.Link;
-import com.atomgraph.core.util.ModelUtils;
-import com.atomgraph.processor.vocabulary.LDT;
-import com.atomgraph.server.vocabulary.HTTP;
-import jakarta.inject.Inject;
-import jakarta.ws.rs.core.EntityTag;
-import jakarta.ws.rs.core.HttpHeaders;
-import jakarta.ws.rs.core.MediaType;
-
-/**
- * Abstract base class for ExceptionMappers that build responses with exceptions as RDF resources.
- *
- * @author Martynas Jusevičius {@literal }
- */
-@Provider
-abstract public class ExceptionMapperBase
-{
-
- @Context private Request request;
- @Context private UriInfo uriInfo;
-
- private final MediaTypes mediaTypes;
-
- @Inject
- public ExceptionMapperBase(MediaTypes mediaTypes)
- {
- this.mediaTypes = mediaTypes;
- }
-
- public Resource toResource(Exception ex, Response.StatusType status, Resource statusResource)
- {
- if (ex == null) throw new IllegalArgumentException("Exception cannot be null");
- if (status == null) throw new IllegalArgumentException("Response.Status cannot be null");
-
- Resource resource = ModelFactory.createDefaultModel().createResource().
- addProperty(RDF.type, HTTP.Response).
- addLiteral(HTTP.statusCodeValue, status.getStatusCode()).
- addLiteral(HTTP.reasonPhrase, status.getReasonPhrase());
-
- if (statusResource != null) resource.addProperty(HTTP.sc, statusResource);
- if (ex.getMessage() != null) resource.addLiteral(DCTerms.title, ex.getMessage());
-
- return resource;
- }
-
- // TO-DO: set Link headers in a ContainerResponseFilter instead
- public Response.ResponseBuilder getResponseBuilder(Model model)
- {
- Variant variant = getRequest().selectVariant(getVariants(Model.class));
- if (variant == null) variant = new Variant(com.atomgraph.core.MediaType.TEXT_TURTLE_TYPE, (Locale)null, null); // if still not acceptable, default to Turtle
-
- return new com.atomgraph.core.model.impl.Response(getRequest(),
- model,
- null,
- new EntityTag(Long.toHexString(ModelUtils.hashModel(model))),
- variant).
- getResponseBuilder().
- header(HttpHeaders.LINK, new Link(getUriInfo().getBaseUri(), LDT.base.getURI(), null));
- }
-
- /**
- * Builds a list of acceptable response variants for a certain class.
- *
- * @param clazz class
- * @return list of variants
- */
- public List getVariants(Class clazz)
- {
- return getVariants(getWritableMediaTypes(clazz));
- }
-
- /**
- * Builds a list of acceptable response variants.
- *
- * @param mediaTypes
- * @return supported variants
- */
- public List getVariants(List mediaTypes)
- {
- return com.atomgraph.core.model.impl.Response.getVariantListBuilder(mediaTypes, getLanguages(), getEncodings()).add().build();
- }
-
- /**
- * Get writable media types for a certain class.
- *
- * @param clazz class
- * @return list of media types
- */
- public List getWritableMediaTypes(Class clazz)
- {
- return getMediaTypes().getWritable(clazz);
- }
-
- public List getLanguages()
- {
- return new ArrayList<>();
- }
-
- public List getEncodings()
- {
- return new ArrayList<>();
- }
-
- public Request getRequest()
- {
- return request;
- }
-
- public MediaTypes getMediaTypes()
- {
- return mediaTypes;
- }
-
- public UriInfo getUriInfo()
- {
- return uriInfo;
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/com/atomgraph/server/mapper/ModelExceptionMapper.java b/src/main/java/com/atomgraph/server/mapper/ModelExceptionMapper.java
deleted file mode 100644
index 0ef76de8..00000000
--- a/src/main/java/com/atomgraph/server/mapper/ModelExceptionMapper.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2013 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.atomgraph.server.mapper;
-
-import com.atomgraph.core.MediaTypes;
-import org.apache.jena.rdf.model.Resource;
-import org.apache.jena.rdf.model.ResourceFactory;
-import jakarta.ws.rs.core.Response;
-import jakarta.ws.rs.ext.ExceptionMapper;
-import com.atomgraph.server.exception.ModelException;
-import jakarta.inject.Inject;
-
-/**
- *
- * @author Martynas Jusevičius {@literal }
- */
-public class ModelExceptionMapper extends ExceptionMapperBase implements ExceptionMapper
-{
-
- @Inject
- public ModelExceptionMapper(MediaTypes mediaTypes)
- {
- super(mediaTypes);
- }
-
- @Override
- public Response toResponse(ModelException ex)
- {
- Resource exception = toResource(ex, Response.Status.BAD_REQUEST,
- ResourceFactory.createResource("http://www.w3.org/2011/http-statusCodes#BadRequest"));
- ex.getModel().add(exception.getModel());
-
- return getResponseBuilder(ex.getModel()).status(Response.Status.BAD_REQUEST).build();
- }
-
-}
diff --git a/src/main/java/com/atomgraph/server/mapper/NotAcceptableExceptionMapper.java b/src/main/java/com/atomgraph/server/mapper/NotAcceptableExceptionMapper.java
deleted file mode 100644
index df69687e..00000000
--- a/src/main/java/com/atomgraph/server/mapper/NotAcceptableExceptionMapper.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2020 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.atomgraph.server.mapper;
-
-import com.atomgraph.core.MediaTypes;
-import jakarta.inject.Inject;
-import jakarta.ws.rs.NotAcceptableException;
-import jakarta.ws.rs.core.Response;
-import jakarta.ws.rs.ext.ExceptionMapper;
-import org.apache.jena.rdf.model.ResourceFactory;
-
-/**
- *
- * @author Martynas Jusevičius {@literal }
- */
-public class NotAcceptableExceptionMapper extends ExceptionMapperBase implements ExceptionMapper
-{
-
- @Inject
- public NotAcceptableExceptionMapper(MediaTypes mediaTypes)
- {
- super(mediaTypes);
- }
-
- @Override
- public Response toResponse(NotAcceptableException ex)
- {
- return getResponseBuilder(toResource(ex, ex.getResponse().getStatusInfo(),
- ResourceFactory.createResource("http://www.w3.org/2011/http-statusCodes#NotAcceptable")).
- getModel()).
- status(ex.getResponse().getStatusInfo()).
- build();
- }
-
-}
diff --git a/src/main/java/com/atomgraph/server/mapper/NotFoundExceptionMapper.java b/src/main/java/com/atomgraph/server/mapper/NotFoundExceptionMapper.java
deleted file mode 100644
index 1857f3aa..00000000
--- a/src/main/java/com/atomgraph/server/mapper/NotFoundExceptionMapper.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2014 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.atomgraph.server.mapper;
-
-import com.atomgraph.core.MediaTypes;
-import jakarta.inject.Inject;
-import jakarta.ws.rs.NotFoundException;
-import org.apache.jena.rdf.model.ResourceFactory;
-import jakarta.ws.rs.core.Response;
-import jakarta.ws.rs.ext.ExceptionMapper;
-
-/**
- *
- * @author Martynas Jusevičius {@literal }
- */
-public class NotFoundExceptionMapper extends ExceptionMapperBase implements ExceptionMapper
-{
-
- @Inject
- public NotFoundExceptionMapper(MediaTypes mediaTypes)
- {
- super(mediaTypes);
- }
-
- @Override
- public Response toResponse(NotFoundException ex)
- {
- return getResponseBuilder(toResource(ex, ex.getResponse().getStatusInfo(),
- ResourceFactory.createResource("http://www.w3.org/2011/http-statusCodes#NotFound")).
- getModel()).
- status(ex.getResponse().getStatusInfo()).
- build();
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/com/atomgraph/server/mapper/NotSupportedExceptionMapper.java b/src/main/java/com/atomgraph/server/mapper/NotSupportedExceptionMapper.java
deleted file mode 100644
index 20e78e04..00000000
--- a/src/main/java/com/atomgraph/server/mapper/NotSupportedExceptionMapper.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2020 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.atomgraph.server.mapper;
-
-import com.atomgraph.core.MediaTypes;
-import jakarta.inject.Inject;
-import jakarta.ws.rs.NotSupportedException;
-import jakarta.ws.rs.core.Response;
-import jakarta.ws.rs.ext.ExceptionMapper;
-import org.apache.jena.rdf.model.ResourceFactory;
-
-/**
- *
- * @author Martynas Jusevičius {@literal }
- */
-public class NotSupportedExceptionMapper extends ExceptionMapperBase implements ExceptionMapper
-{
-
- @Inject
- public NotSupportedExceptionMapper(MediaTypes mediaTypes)
- {
- super(mediaTypes);
- }
-
- @Override
- public Response toResponse(NotSupportedException ex)
- {
- return getResponseBuilder(toResource(ex, ex.getResponse().getStatusInfo(),
- ResourceFactory.createResource("http://www.w3.org/2011/http-statusCodes#NotAcceptable")).
- getModel()).
- status(ex.getResponse().getStatusInfo()).
- build();
- }
-
-}
diff --git a/src/main/java/com/atomgraph/server/mapper/OntologyExceptionMapper.java b/src/main/java/com/atomgraph/server/mapper/OntologyExceptionMapper.java
deleted file mode 100644
index 46b36de2..00000000
--- a/src/main/java/com/atomgraph/server/mapper/OntologyExceptionMapper.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2016 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.atomgraph.server.mapper;
-
-import com.atomgraph.core.MediaTypes;
-import com.atomgraph.processor.exception.OntologyException;
-import jakarta.inject.Inject;
-import jakarta.ws.rs.core.Response;
-import jakarta.ws.rs.ext.ExceptionMapper;
-import org.apache.jena.rdf.model.ResourceFactory;
-
-/**
- *
- * @author Martynas Jusevičius {@literal }
- */
-public class OntologyExceptionMapper extends ExceptionMapperBase implements ExceptionMapper
-{
-
- @Inject
- public OntologyExceptionMapper(MediaTypes mediaTypes)
- {
- super(mediaTypes);
- }
-
- @Override
- public Response toResponse(OntologyException ex)
- {
- return getResponseBuilder(toResource(ex, Response.Status.INTERNAL_SERVER_ERROR,
- ResourceFactory.createResource("http://www.w3.org/2011/http-statusCodes#InternalServerError")).
- getModel()).
- status(Response.Status.INTERNAL_SERVER_ERROR).
- build();
- }
-
-}
diff --git a/src/main/java/com/atomgraph/server/mapper/SHACLConstraintViolationExceptionMapper.java b/src/main/java/com/atomgraph/server/mapper/SHACLConstraintViolationExceptionMapper.java
deleted file mode 100644
index 806bf11f..00000000
--- a/src/main/java/com/atomgraph/server/mapper/SHACLConstraintViolationExceptionMapper.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2021 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.atomgraph.server.mapper;
-
-import com.atomgraph.core.MediaTypes;
-import com.atomgraph.server.exception.SHACLConstraintViolationException;
-import jakarta.inject.Inject;
-import jakarta.ws.rs.core.Response;
-import jakarta.ws.rs.ext.ExceptionMapper;
-import org.apache.jena.rdf.model.Resource;
-import org.apache.jena.rdf.model.ResourceFactory;
-
-/**
- *
- * @author Martynas Jusevičius {@literal }
- */
-public class SHACLConstraintViolationExceptionMapper extends ExceptionMapperBase implements ExceptionMapper
-{
-
- @Inject
- public SHACLConstraintViolationExceptionMapper(MediaTypes mediaTypes)
- {
- super(mediaTypes);
- }
-
- @Override
- public Response toResponse(SHACLConstraintViolationException ex)
- {
- Resource exception = toResource(ex, Response.Status.BAD_REQUEST,
- ResourceFactory.createResource("http://www.w3.org/2011/http-statusCodes#BadRequest"));
- ex.getModel().add(exception.getModel());
-
- ex.getModel().add(ex.getValidationReport().getModel());
-
- return getResponseBuilder(ex.getModel()).
- status(422). // 422 Unprocessable Entity
- build();
- }
-
-}
diff --git a/src/main/java/com/atomgraph/server/mapper/SPINConstraintViolationExceptionMapper.java b/src/main/java/com/atomgraph/server/mapper/SPINConstraintViolationExceptionMapper.java
deleted file mode 100644
index 95de66b8..00000000
--- a/src/main/java/com/atomgraph/server/mapper/SPINConstraintViolationExceptionMapper.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2017 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.atomgraph.server.mapper;
-
-import com.atomgraph.core.MediaTypes;
-import com.atomgraph.server.exception.SPINConstraintViolationException;
-import jakarta.ws.rs.core.Response;
-import jakarta.ws.rs.ext.ExceptionMapper;
-import org.apache.jena.rdf.model.ResIterator;
-import org.apache.jena.rdf.model.Resource;
-import org.apache.jena.rdf.model.ResourceFactory;
-import org.apache.jena.vocabulary.RDF;
-import com.atomgraph.spinrdf.constraints.SPINConstraints;
-import com.atomgraph.spinrdf.vocabulary.SPIN;
-import jakarta.inject.Inject;
-
-/**
- *
- * @author Martynas Jusevičius {@literal }
- */
-public class SPINConstraintViolationExceptionMapper extends ExceptionMapperBase implements ExceptionMapper
-{
-
- @Inject
- public SPINConstraintViolationExceptionMapper(MediaTypes mediaTypes)
- {
- super(mediaTypes);
- }
-
- @Override
- public Response toResponse(SPINConstraintViolationException ex)
- {
- Resource exception = toResource(ex, Response.Status.BAD_REQUEST,
- ResourceFactory.createResource("http://www.w3.org/2011/http-statusCodes#BadRequest"));
- ex.getModel().add(exception.getModel());
-
- SPINConstraints.addConstraintViolationsRDF(ex.getConstraintViolations(), ex.getModel(), true);
- ResIterator it = ex.getModel().listSubjectsWithProperty(RDF.type, SPIN.ConstraintViolation);
- try
- {
- while (it.hasNext())
- {
- Resource violation = it.next();
- // connect Response to ConstraintViolations
- ex.getModel().add(exception, ResourceFactory.createProperty("http://www.w3.org/ns/prov#wasDerivedFrom"), violation);
- }
- }
- finally
- {
- it.close();
- }
-
- return getResponseBuilder(ex.getModel()).
- status(422). // 422 Unprocessable Entity
- build();
- }
-
-}
diff --git a/src/main/java/com/atomgraph/server/mapper/jena/DatatypeFormatExceptionMapper.java b/src/main/java/com/atomgraph/server/mapper/jena/DatatypeFormatExceptionMapper.java
deleted file mode 100644
index a9218d14..00000000
--- a/src/main/java/com/atomgraph/server/mapper/jena/DatatypeFormatExceptionMapper.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2016 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.atomgraph.server.mapper.jena;
-
-import com.atomgraph.core.MediaTypes;
-import jakarta.ws.rs.core.Response;
-import jakarta.ws.rs.ext.ExceptionMapper;
-import org.apache.jena.datatypes.DatatypeFormatException;
-import org.apache.jena.rdf.model.ResourceFactory;
-import com.atomgraph.server.mapper.ExceptionMapperBase;
-import jakarta.inject.Inject;
-
-/**
- *
- * @author Martynas Jusevičius {@literal }
- */
-public class DatatypeFormatExceptionMapper extends ExceptionMapperBase implements ExceptionMapper
-{
-
- @Inject
- public DatatypeFormatExceptionMapper(MediaTypes mediaTypes)
- {
- super(mediaTypes);
- }
-
- @Override
- public Response toResponse(DatatypeFormatException ex)
- {
- return getResponseBuilder(toResource(ex, Response.Status.BAD_REQUEST,
- ResourceFactory.createResource("http://www.w3.org/2011/http-statusCodes#BadRequest")).
- getModel()).
- status(Response.Status.BAD_REQUEST).
- build();
- }
-
-}
diff --git a/src/main/java/com/atomgraph/server/mapper/jena/QueryParseExceptionMapper.java b/src/main/java/com/atomgraph/server/mapper/jena/QueryParseExceptionMapper.java
deleted file mode 100644
index 4df4212e..00000000
--- a/src/main/java/com/atomgraph/server/mapper/jena/QueryParseExceptionMapper.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2014 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.atomgraph.server.mapper.jena;
-
-import com.atomgraph.core.MediaTypes;
-import org.apache.jena.query.QueryParseException;
-import org.apache.jena.rdf.model.ResourceFactory;
-import jakarta.ws.rs.core.Response;
-import jakarta.ws.rs.ext.ExceptionMapper;
-import jakarta.ws.rs.ext.Provider;
-import com.atomgraph.server.mapper.ExceptionMapperBase;
-import jakarta.inject.Inject;
-
-/**
- *
- * @author Martynas Jusevičius {@literal }
- */
-@Provider
-public class QueryParseExceptionMapper extends ExceptionMapperBase implements ExceptionMapper
-{
-
- @Inject
- public QueryParseExceptionMapper(MediaTypes mediaTypes)
- {
- super(mediaTypes);
- }
-
- @Override
- public Response toResponse(QueryParseException ex)
- {
- return getResponseBuilder(toResource(ex, Response.Status.INTERNAL_SERVER_ERROR,
- ResourceFactory.createResource("http://www.w3.org/2011/http-statusCodes#InternalServerError")).
- getModel()).
- status(Response.Status.INTERNAL_SERVER_ERROR).
- build();
- }
-
-}
diff --git a/src/main/java/com/atomgraph/server/mapper/jena/RiotExceptionMapper.java b/src/main/java/com/atomgraph/server/mapper/jena/RiotExceptionMapper.java
deleted file mode 100644
index 1b1c8f9e..00000000
--- a/src/main/java/com/atomgraph/server/mapper/jena/RiotExceptionMapper.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2016 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.atomgraph.server.mapper.jena;
-
-import com.atomgraph.core.MediaTypes;
-import jakarta.ws.rs.core.Response;
-import jakarta.ws.rs.ext.ExceptionMapper;
-import org.apache.jena.rdf.model.ResourceFactory;
-import org.apache.jena.riot.RiotException;
-import com.atomgraph.server.mapper.ExceptionMapperBase;
-import jakarta.inject.Inject;
-
-/**
- *
- * @author Martynas Jusevičius {@literal }
- */
-public class RiotExceptionMapper extends ExceptionMapperBase implements ExceptionMapper
-{
-
- @Inject
- public RiotExceptionMapper(MediaTypes mediaTypes)
- {
- super(mediaTypes);
- }
-
- @Override
- public Response toResponse(RiotException ex)
- {
- return getResponseBuilder(toResource(ex, Response.Status.BAD_REQUEST,
- ResourceFactory.createResource("http://www.w3.org/2011/http-statusCodes#BadRequest")).
- getModel()).
- status(Response.Status.BAD_REQUEST).
- build();
- }
-
-}
diff --git a/src/main/java/com/atomgraph/server/vocabulary/HTTP.java b/src/main/java/com/atomgraph/server/vocabulary/HTTP.java
deleted file mode 100644
index e9316e1e..00000000
--- a/src/main/java/com/atomgraph/server/vocabulary/HTTP.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2014 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.atomgraph.server.vocabulary;
-
-import org.apache.jena.ontology.DatatypeProperty;
-import org.apache.jena.ontology.ObjectProperty;
-import org.apache.jena.ontology.OntClass;
-import org.apache.jena.ontology.OntModel;
-import org.apache.jena.ontology.OntModelSpec;
-import org.apache.jena.rdf.model.ModelFactory;
-import org.apache.jena.rdf.model.Resource;
-
-/**
- * HTTP Vocabulary in RDF
- *
- * @author Martynas Jusevičius {@literal }
- * @see HTTP Vocabulary in RDF 1.0
- */
-public class HTTP
-{
-
- /** The RDF model that holds the vocabulary terms
*/
- private static OntModel m_model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, null);
-
- /** The namespace of the vocabulary as a string
*/
- public static final String NS = "http://www.w3.org/2011/http#";
-
- /** The namespace of the vocabulary as a string
- * @see #NS */
- public static String getURI()
- {
- return NS;
- }
-
- /** The namespace of the vocabulary as a resource
*/
- public static final Resource NAMESPACE = m_model.createResource( NS );
-
- public static final OntClass Response = m_model.createClass( NS + "Response" );
-
- public static final ObjectProperty sc = m_model.createObjectProperty( NS + "sc" );
-
- public static final DatatypeProperty statusCodeValue = m_model.createDatatypeProperty( NS + "statusCodeValue" );
-
- public static final DatatypeProperty reasonPhrase = m_model.createDatatypeProperty( NS + "reasonPhrase" );
-
- public static final DatatypeProperty absoluteURI = m_model.createDatatypeProperty( NS + "absoluteURI" );
-
- public static final DatatypeProperty absolutePath = m_model.createDatatypeProperty( NS + "absolutePath" );
-
-}
diff --git a/src/main/java/com/atomgraph/server/vocabulary/XHV.java b/src/main/java/com/atomgraph/server/vocabulary/XHV.java
deleted file mode 100644
index 38361fed..00000000
--- a/src/main/java/com/atomgraph/server/vocabulary/XHV.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- See lda-top/LICENCE (or http://elda.googlecode.com/hg/LICENCE)
- for the licence for this software.
-
- (c) Copyright 2011 Epimorphics Limited
- $Id$
-*/
-
-/*
- (c) Copyright 2010 Epimorphics Limited
- [see end of file]
- $Id$
-*/
-
-package com.atomgraph.server.vocabulary;
-
-import org.apache.jena.rdf.model.*;
-
-public class XHV
- {
- public static final String ns = "http://www.w3.org/1999/xhtml/vocab#";
-
- public static final Property first = property( "first" );
-
- public static final Property next = property( "next" );
-
- public static final Property prev = property( "prev" );
-
- public static String getURI()
- { return ns; }
-
- private static Property property( String localName )
- { return ResourceFactory.createProperty( ns + localName ); }
-
- }
-
-
-/*
- (c) Copyright 2010 Epimorphics Limited
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
\ No newline at end of file
diff --git a/src/test/java/com/atomgraph/processor/model/impl/TemplateTest.java b/src/test/java/com/atomgraph/processor/model/impl/TemplateTest.java
index b017bf38..b34d91ef 100644
--- a/src/test/java/com/atomgraph/processor/model/impl/TemplateTest.java
+++ b/src/test/java/com/atomgraph/processor/model/impl/TemplateTest.java
@@ -15,7 +15,7 @@
*/
package com.atomgraph.processor.model.impl;
-import com.atomgraph.processor.exception.OntologyException;
+import com.atomgraph.server.exception.OntologyException;
import com.atomgraph.processor.model.Parameter;
import com.atomgraph.processor.model.Template;
import com.atomgraph.processor.vocabulary.LDT;
diff --git a/src/test/java/com/atomgraph/processor/util/SkolemizerTest.java b/src/test/java/com/atomgraph/processor/util/SkolemizerTest.java
index de51674b..930a4e1c 100644
--- a/src/test/java/com/atomgraph/processor/util/SkolemizerTest.java
+++ b/src/test/java/com/atomgraph/processor/util/SkolemizerTest.java
@@ -15,10 +15,9 @@
*/
package com.atomgraph.processor.util;
-import com.atomgraph.processor.exception.OntologyException;
+import com.atomgraph.server.exception.OntologyException;
import com.atomgraph.processor.vocabulary.LDT;
import com.atomgraph.processor.vocabulary.SIOC;
-import com.atomgraph.server.util.OntologyLoader;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
diff --git a/src/test/java/com/atomgraph/processor/util/TemplateMatcherTest.java b/src/test/java/com/atomgraph/processor/util/TemplateMatcherTest.java
index 854d7086..7b4e5da0 100644
--- a/src/test/java/com/atomgraph/processor/util/TemplateMatcherTest.java
+++ b/src/test/java/com/atomgraph/processor/util/TemplateMatcherTest.java
@@ -15,11 +15,10 @@
*/
package com.atomgraph.processor.util;
-import com.atomgraph.processor.exception.OntologyException;
+import com.atomgraph.server.exception.OntologyException;
import com.atomgraph.processor.model.Template;
import com.atomgraph.processor.model.impl.TemplateImpl;
import com.atomgraph.processor.vocabulary.LDT;
-import com.atomgraph.server.util.OntologyLoader;
import static junit.framework.Assert.assertEquals;
import org.apache.jena.enhanced.BuiltinPersonalities;
import org.apache.jena.ontology.OntDocumentManager;