Class RDFServiceSparql

    • Field Detail

      • readEndpointURI

        protected String readEndpointURI
      • updateEndpointURI

        protected String updateEndpointURI
      • httpClient

        protected org.apache.http.client.HttpClient httpClient
    • Constructor Detail

      • RDFServiceSparql

        public RDFServiceSparql​(String readEndpointURI,
                                String updateEndpointURI,
                                String defaultWriteGraphURI)
        Returns an RDFService for a remote repository
        Parameters:
        readEndpointURI - - URI of the read SPARQL endpoint for the knowledge base
        updateEndpointURI - - URI of the update SPARQL endpoint for the knowledge base
        defaultWriteGraphURI - - URI of the default write graph within the knowledge base. this is the graph that will be written to when a graph is not explicitly specified. The default read graph is the union of all graphs in the knowledge base
      • RDFServiceSparql

        public RDFServiceSparql​(String readEndpointURI,
                                String updateEndpointURI)
        Returns an RDFService for a remote repository
        Parameters:
        readEndpointURI - - URI of the read SPARQL endpoint for the knowledge base
        updateEndpointURI - - URI of the update SPARQL endpoint for the knowledge base The default read graph is the union of all graphs in the knowledge base
      • RDFServiceSparql

        public RDFServiceSparql​(String endpointURI)
        Returns an RDFService for a remote repository
        Parameters:
        endpointURI - - URI of the read and update SPARQL endpoint for the knowledge base The default read graph is the union of all graphs in the knowledge base
    • Method Detail

      • testConnection

        protected void testConnection()
      • close

        public void close()
        Description copied from interface: RDFService
        Frees any resources held by this RDFService object The implementation of this method should be idempotent so that multiple invocations do not cause an error.
        Specified by:
        close in interface RDFService
      • changeSetUpdate

        public boolean changeSetUpdate​(ChangeSet changeSet)
                                throws RDFServiceException
        Perform a series of additions to and or removals from specified graphs in the RDF store. preConditionSparql will be executed against the union of all the graphs in the knowledge base before any updates are made. If the precondition query returns a non-empty result no updates will be made.
        Specified by:
        changeSetUpdate in interface RDFService
        Parameters:
        changeSet - - a set of changes to be performed on the RDF store.
        Returns:
        boolean - indicates whether the precondition was satisfied
        Throws:
        RDFServiceException
      • sparqlConstructQuery

        public void sparqlConstructQuery​(String queryStr,
                                         org.apache.jena.rdf.model.Model model)
                                  throws RDFServiceException
        Description copied from interface: RDFService
        Performs a SPARQL construct query against the knowledge base. The query may have an embedded graph identifier. If the query does not contain a graph identifier the query is executed against the union of all named and unnamed graphs in the store.
        Specified by:
        sparqlConstructQuery in interface RDFService
        Parameters:
        queryStr - - the SPARQL query to be executed against the RDF store
        model - - the Model to add the statements to
        Throws:
        RDFServiceException
      • sparqlSelectQuery

        public void sparqlSelectQuery​(String queryStr,
                                      ResultSetConsumer consumer)
                               throws RDFServiceException
        Description copied from interface: RDFService
        Performs a SPARQL select query against the knowledge base. The query may have an embedded graph identifier. If the query does not contain a graph identifier the query is executed against the union of all named and unnamed graphs in the store.
        Specified by:
        sparqlSelectQuery in interface RDFService
        Parameters:
        queryStr - - the SPARQL query to be executed against the RDF store
        consumer - - the class to consume the results of the query
        Throws:
        RDFServiceException
      • sparqlAskQuery

        public boolean sparqlAskQuery​(String queryStr)
                               throws RDFServiceException
        Performs a SPARQL ASK query against the knowledge base. The query may have an embedded graph identifier.
        Specified by:
        sparqlAskQuery in interface RDFService
        Parameters:
        queryStr - - the SPARQL query to be executed against the RDF store
        Returns:
        boolean - the result of the SPARQL query
        Throws:
        RDFServiceException
      • getReadEndpointURI

        protected String getReadEndpointURI()
      • getUpdateEndpointURI

        protected String getUpdateEndpointURI()
      • serializeAll

        public void serializeAll​(OutputStream outputStream)
                          throws RDFServiceException
        Description copied from interface: RDFService
        Serializes the union of all named and unnamed graphs in the store to the supplied OutputStream, in N-Quads format. This method is designed for exporting data from VIVO, so any filters should be bypassed. If possible, this should be done without buffering in memory, so arbitrarily large graphs can be exported.
        Specified by:
        serializeAll in interface RDFService
        Parameters:
        outputStream - - receives the serialized result.
        Throws:
        RDFServiceException
      • serializeGraph

        public void serializeGraph​(String graphURI,
                                   OutputStream outputStream)
                            throws RDFServiceException
        Description copied from interface: RDFService
        Serializes the contents of the named graph to the supplied OutputStream, in N-Triples format. This method is designed for exporting data from VIVO, so any filters should be bypassed. If possible, this should be done without buffering in memory, so arbitrarily large graphs can be exported.
        Specified by:
        serializeGraph in interface RDFService
        Parameters:
        graphURI - - the URI of the desired graph. May not be null.
        outputStream - - receives the serialized result.
        Throws:
        RDFServiceException
      • isEquivalentGraph

        public boolean isEquivalentGraph​(String graphURI,
                                         InputStream serializedGraph,
                                         RDFService.ModelSerializationFormat serializationFormat)
                                  throws RDFServiceException
        The basic version. Parse the model from the file, read the model from the tripleStore, and ask whether they are isomorphic.
        Specified by:
        isEquivalentGraph in interface RDFService
        Parameters:
        graphURI - - the URI of the graph to test against. May not be null.
        serializedGraph - - the contents to be compared with the existing graph. May not be null.
        serializationFormat - - May not be null.
        Throws:
        RDFServiceException
      • isEquivalentGraph

        public boolean isEquivalentGraph​(String graphURI,
                                         org.apache.jena.rdf.model.Model graph)
                                  throws RDFServiceException
        The basic version. Parse the model from the file, read the model from the tripleStore, and ask whether they are isomorphic.
        Specified by:
        isEquivalentGraph in interface RDFService
        Parameters:
        graphURI - - the URI of the graph to test against. May not be null.
        graph - - the contents to be compared with the existing graph. May not be null.
        Throws:
        RDFServiceException
      • getContext

        protected org.apache.http.protocol.HttpContext getContext​(org.apache.http.client.methods.HttpRequestBase request)
      • getCredentials

        protected org.apache.http.auth.UsernamePasswordCredentials getCredentials()