Search in sources :

Example 1 with GSP

use of org.apache.jena.sparql.exec.http.GSP in project jena by apache.

the class ExModification01 method exampleMod.

private static void exampleMod() {
    AtomicLong counter = new AtomicLong(0);
    HttpRequestModifier modifier = (params, headers) -> {
        long x = counter.incrementAndGet();
        headers.put("X-Tracker", "Call=" + x);
    };
    RegistryRequestModifier.get().addPrefix(serverURL, modifier);
    // RegistryRequestModifier.get().add(dataURL, modifier);
    // GSP : NO MODIFICATION no call to modifyByService
    // GSP : calls HttpRDF
    // Pass in request or at least request type.
    /*
org.apache.jena.http.sys.RegistryRequestModifier.get()
auth.examples.ExModification01.exampleMod()

org.apache.jena.http.HttpLib.modifyByService(String, Context, Params, Map<String, String>)
  org.apache.jena.sparql.exec.http.UpdateExecHTTP.execute()
  org.apache.jena.sparql.exec.http.QueryExecHTTP.query(String)
  ==> SERVICE via QueryExecHTTP
  ==> GSP ?

org.apache.jena.sparql.exec.http.TestService.runWithModifier(String, HttpRequestModifier, Runnable)

         */
    GSP.service(dataURL).defaultGraph().GET();
    try (RDFLink link = RDFLinkHTTP.service(dataURL).build()) {
        boolean b = link.queryAsk("ASK{}");
    }
}
Also used : GSP(org.apache.jena.sparql.exec.http.GSP) AtomicLong(java.util.concurrent.atomic.AtomicLong) DatasetGraphFactory(org.apache.jena.sparql.core.DatasetGraphFactory) RDFLinkHTTP(org.apache.jena.rdflink.RDFLinkHTTP) HttpRequestModifier(org.apache.jena.http.sys.HttpRequestModifier) DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) FusekiLogging(org.apache.jena.fuseki.system.FusekiLogging) FusekiServer(org.apache.jena.fuseki.main.FusekiServer) RDFLink(org.apache.jena.rdflink.RDFLink) RegistryRequestModifier(org.apache.jena.http.sys.RegistryRequestModifier) AtomicLong(java.util.concurrent.atomic.AtomicLong) RDFLink(org.apache.jena.rdflink.RDFLink) HttpRequestModifier(org.apache.jena.http.sys.HttpRequestModifier)

Aggregations

AtomicLong (java.util.concurrent.atomic.AtomicLong)1 FusekiServer (org.apache.jena.fuseki.main.FusekiServer)1 FusekiLogging (org.apache.jena.fuseki.system.FusekiLogging)1 HttpRequestModifier (org.apache.jena.http.sys.HttpRequestModifier)1 RegistryRequestModifier (org.apache.jena.http.sys.RegistryRequestModifier)1 RDFLink (org.apache.jena.rdflink.RDFLink)1 RDFLinkHTTP (org.apache.jena.rdflink.RDFLinkHTTP)1 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)1 DatasetGraphFactory (org.apache.jena.sparql.core.DatasetGraphFactory)1 GSP (org.apache.jena.sparql.exec.http.GSP)1