Package org.openrdf.query.impl

Examples of org.openrdf.query.impl.DatasetImpl.addDefaultGraph()


          URI uri = new URIImpl(astIri.getValue());
          if (dc.isNamed()) {
            dataset.addNamedGraph(uri);
          }
          else {
            dataset.addDefaultGraph(uri);
          }
        }
        catch (IllegalArgumentException e) {
          throw new MalformedQueryException(e.getMessage(), e);
        }
View Full Code Here


  private <Q extends Query> Q initQuery(Q query) {
    if (readContexts.length > 0) {
      DatasetImpl ds = new DatasetImpl();
      for (URI graph : readContexts) {
        ds.addDefaultGraph(graph);
        ds.addNamedGraph(graph);
      }
      query.setDataset(ds);
    }
View Full Code Here

      if (defaultGraphURI != null || namedGraphs.hasNext()) {
        dataset = new DatasetImpl();

        if (defaultGraphURI != null) {
          dataset.addDefaultGraph(defaultGraphURI);
        }

        while (namedGraphs.hasNext()) {
          BindingSet graphBindings = namedGraphs.next();
          URI namedGraphURI = (URI)graphBindings.getValue("graph");
View Full Code Here

    assertTrue(query.ask());

    DatasetImpl dataset = new DatasetImpl();

    // default graph: {context1}
    dataset.addDefaultGraph(context1);
    query.setDataset(dataset);
    assertTrue(query.ask());

    // default graph: {context1, context2}
    dataset.addDefaultGraph(context2);
View Full Code Here

    dataset.addDefaultGraph(context1);
    query.setDataset(dataset);
    assertTrue(query.ask());

    // default graph: {context1, context2}
    dataset.addDefaultGraph(context2);
    query.setDataset(dataset);
    assertTrue(query.ask());

    // default graph: {context2}
    dataset.removeDefaultGraph(context1);
View Full Code Here

    // default graph: {context2}; named graph: {}
    query.setDataset(dataset);
    assertFalse(query.ask());

    // default graph: {context1, context2}; named graph: {context2}
    dataset.addDefaultGraph(context1);
    dataset.addNamedGraph(context2);
    query.setDataset(dataset);
    assertFalse(query.ask());

    // default graph: {context1, context2}; named graph: {context1, context2}
View Full Code Here

      if (defaultGraphURIs != null) {
        for (String defaultGraphURI : defaultGraphURIs) {
          try {
            URI uri = vf.createURI(defaultGraphURI);
            dataset.addDefaultGraph(uri);
          }
          catch (IllegalArgumentException e) {
            throw new ResourceException(CLIENT_ERROR_BAD_REQUEST, "Illegal URI for default graph: "
                + defaultGraphURI);
          }
View Full Code Here

        //also init the dataset required for SPARQL queries
        if(contexts.length > 0){
            DatasetImpl dataset = new DatasetImpl();
            for(URI context : this.contexts){
                dataset.addNamedGraph(context);
                dataset.addDefaultGraph(context);
            }
            this.dataset = dataset;
        } else {
            this.dataset = null;
        }
View Full Code Here

                for( String defaultGraphURI : defaultGraphURIs )
                {
                    try
                    {
                        URI uri = repository.getValueFactory().createURI( defaultGraphURI );
                        dataset.addDefaultGraph( uri );
                    }
                    catch( IllegalArgumentException e )
                    {
                        throw new ResourceException( Status.CLIENT_ERROR_BAD_REQUEST, "Illegal URI for default graph: "
                                                                                      + defaultGraphURI );
View Full Code Here

          URI uri = new URIImpl(astIri.getValue());
          if (dc.isNamed()) {
            dataset.addNamedGraph(uri);
          }
          else {
            dataset.addDefaultGraph(uri);
          }
        }
        catch (IllegalArgumentException e) {
          throw new MalformedQueryException(e.getMessage(), e);
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.