Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/main/java/com/atomgraph/core/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@
import com.atomgraph.core.mapper.BadGatewayExceptionMapper;
import com.atomgraph.core.mapper.RiotExceptionMapper;
import com.atomgraph.core.model.Service;
import com.atomgraph.core.model.impl.GraphStoreImpl;
import com.atomgraph.core.model.impl.QueriedResourceBase;
import com.atomgraph.core.model.impl.SPARQLEndpointImpl;
import com.atomgraph.core.riot.RDFLanguages;
import com.atomgraph.core.riot.lang.RDFPostReaderFactory;
import com.atomgraph.core.server.Dispatcher;
import com.atomgraph.core.util.jena.DataManager;
import com.atomgraph.core.util.jena.DataManagerImpl;
import com.atomgraph.core.vocabulary.A;
Expand Down Expand Up @@ -153,9 +151,7 @@ public Application(final Dataset dataset,
@PostConstruct
public void init()
{
register(QueriedResourceBase.class); // handles all
register(SPARQLEndpointImpl.class); // handles /sparql queries
register(GraphStoreImpl.class); // handles /service requests
register(Dispatcher.class); // handles all

register(new ModelProvider());
register(new DatasetProvider());
Expand Down
68 changes: 68 additions & 0 deletions src/main/java/com/atomgraph/core/model/DirectGraphStore.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright 2026 martynas.
*
* 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.core.model;

import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.PUT;
import jakarta.ws.rs.core.Response;
import org.apache.jena.rdf.model.Model;

/**
* Directly-identified SPARQL 1.1 Graph Store HTTP Protocol interface (aka Linked Data)
*
* @author Martynas Jusevičius {@literal <[email protected]>}
* @see <a href="https://www.w3.org/TR/sparql11-http-rdf-update/#direct-graph-identification">SPARQL 1.1 Graph Store HTTP Protocol</a>
* @see <a href="https://en.wikipedia.org/wiki/Linked_data">Linked Data</a>
*/
public interface DirectGraphStore
{
/**
* Handles GET query request and returns result as response
*
* @return result response
* @see <a href="http://www.w3.org/TR/sparql11-http-rdf-update/#http-get">5.2 HTTP GET</a>
*/
@GET Response get();

/**
* Handles POST query request and returns result as response
*
* @param model RDF payload model
* @return result response
* @see <a href="http://www.w3.org/TR/sparql11-http-rdf-update/#http-post">5.5 HTTP POST</a>
*/
@POST Response post(Model model);

/**
* Handles PUT query request and returns result as response
*
* @param model RDF payload model
* @return result response
* @see <a href="http://www.w3.org/TR/sparql11-http-rdf-update/#http-put">5.3 HTTP PUT</a>
*/
@PUT Response put(Model model);

/**
* Handles DELETE query request and returns result as response
*
* @return result response
* @see <a href="http://www.w3.org/TR/sparql11-http-rdf-update/#http-delete">5.4 HTTP DELETE</a>
*/
@DELETE Response delete();

}
4 changes: 2 additions & 2 deletions src/main/java/com/atomgraph/core/model/GraphStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
import jakarta.ws.rs.core.Response;

/**
* Generic SPARQL 1.1 Graph Store HTTP Protocol interface
* Indirectly-identified SPARQL 1.1 Graph Store HTTP Protocol interface
*
* @author Martynas Jusevičius {@literal <[email protected]>}
* @see <a href="http://www.w3.org/TR/sparql11-http-rdf-update/">SPARQL 1.1 Graph Store HTTP Protocol</a>
* @see <a href="https://www.w3.org/TR/sparql11-http-rdf-update/#indirect-graph-identification">SPARQL 1.1 Graph Store HTTP Protocol</a>
*/
public interface GraphStore
{
Expand Down
46 changes: 0 additions & 46 deletions src/main/java/com/atomgraph/core/model/QueriedResource.java

This file was deleted.

76 changes: 0 additions & 76 deletions src/main/java/com/atomgraph/core/model/Resource.java

This file was deleted.

144 changes: 144 additions & 0 deletions src/main/java/com/atomgraph/core/model/impl/DirectGraphStoreImpl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
/*
* Copyright 2026 martynas.
*
* 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.core.model.impl;

import com.atomgraph.core.MediaTypes;
import com.atomgraph.core.model.DatasetAccessor;
import com.atomgraph.core.model.DirectGraphStore;
import com.atomgraph.core.model.Service;
import jakarta.inject.Inject;
import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.PUT;
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 java.net.URI;
import org.apache.jena.rdf.model.Model;

/**
* Directly-identified SPARQL Graph Stores implementation.
*
* @author Martynas Jusevičius {@literal <[email protected]>}
* @see <a href="https://www.w3.org/TR/sparql11-http-rdf-update/#indirect-graph-identification">SPARQL 1.1 Graph Store HTTP Protocol</a>
* @see com.atomgraph.core.model.GraphStore
*/
public class DirectGraphStoreImpl extends GraphStoreBase implements DirectGraphStore
{

private final UriInfo uriInfo;

/**
* Constructs Graph Store from request metadata.
*
* @param request request
* @param service SPARQL service
* @param mediaTypes supported media types
* @param uriInfo URI information
*/
@Inject
public DirectGraphStoreImpl(@Context Request request, Service service, MediaTypes mediaTypes, @Context UriInfo uriInfo)
{
this(request, service.getDatasetAccessor(), mediaTypes, uriInfo);
}

/**
* Constructs Graph Store from request metadata and dataset accessor.
*
* @param request request
* @param accessor dataset accessor
* @param mediaTypes supported media types
* @param uriInfo URI information
*/
public DirectGraphStoreImpl(Request request, DatasetAccessor accessor, MediaTypes mediaTypes, @Context UriInfo uriInfo)
{
super(request, accessor, mediaTypes);
this.uriInfo = uriInfo;
}

/**
* Implements <code>GET</code> method of SPARQL Graph Store Protocol.
*
* @return response
*/
@GET
@Override
public Response get()
{
return super.get(false, getURI());
}

/**
* Implements <code>POST</code> method of SPARQL Graph Store Protocol.
*
* @param model RDF request body
* @return response
*/
@POST
@Override
public Response post(Model model)
{
return super.post(model, false, getURI());
}

/**
* Implements <code>PUT</code> method of SPARQL Graph Store Protocol.
*
* @param model RDF request body
* @return response
*/
@PUT
@Override
public Response put(Model model)
{
return super.put(model, false, getURI());
}

/**
* Implements <code>DELETE</code> method of SPARQL Graph Store Protocol.
*
* @return response
*/
@DELETE
@Override
public Response delete()
{
return super.delete(false, getURI());
}

/**
* Returns the graph URI.
*
* @return the graph URI
*/
public final URI getURI()
{
return getUriInfo().getAbsolutePath();
}

/**
* Returns the URI information.
*
* @return URI information
*/
public final UriInfo getUriInfo()
{
return uriInfo;
}

}
Loading