Package org.openrdf.model.impl

Examples of org.openrdf.model.impl.URIImpl


    private final URI graph;

    public Collector(Model statements, String graph) {
      super(statements);
      this.graph = new URIImpl(graph);
    }
View Full Code Here


      for (ASTDatasetClause dc : datasetClauses) {
        ASTIRI astIri = dc.jjtGetChild(ASTIRI.class);

        try {
          URI uri = new URIImpl(astIri.getValue());
          if (dc.isNamed()) {
            dataset.addNamedGraph(uri);
          }
          else {
            dataset.addDefaultGraph(uri);
View Full Code Here

  protected void insertTestStatement(SailConnection connection, int i)
    throws StoreException
  {
    // System.out.print("+");
    connection.addStatement(new URIImpl("http://test#s" + i), new URIImpl("http://test#p" + i),
        new URIImpl("http://test#o" + i), new URIImpl("http://test#context_" + i));
  }
View Full Code Here

  protected void removeTestStatement(SailConnection connection, int i)
    throws StoreException
  {
    // System.out.print("-");
    connection.removeStatements(new URIImpl("http://test#s" + i), new URIImpl("http://test#p" + i),
        new URIImpl("http://test#o" + i), new URIImpl("http://test#context_" + i));
  }
View Full Code Here

        // Add unnamed graph
        con.add(url(dataFile), base(dataFile), RDFFormat.forFileName(dataFile));

        // add named graphs
        for (String graphName : graphNames) {
          con.add(url(graphName), base(graphName), RDFFormat.forFileName(graphName), new URIImpl(
              graphName));
        }

        // Evaluate the query on the query data
        GraphResult result = con.prepareGraphQuery(getQueryLanguage(), query).evaluate();
View Full Code Here

  private TupleResult createQueryResult() {
    List<String> bindingNames = Arrays.asList("a", "b", "c");

    MapBindingSet solution1 = new MapBindingSet(bindingNames.size());
    solution1.addBinding("a", new URIImpl("foo:bar"));
    solution1.addBinding("b", new BNodeImpl("bnode"));
    solution1.addBinding("c", new LiteralImpl("baz"));

    MapBindingSet solution2 = new MapBindingSet(bindingNames.size());
    solution2.addBinding("a", new LiteralImpl("1", XMLSchema.INTEGER));
View Full Code Here

    mboxAlice = vf.createLiteral("alice@example.org");
    mboxBob = vf.createLiteral("bob@example.org");

    Александър = vf.createLiteral("Александър");

    unknownContext = new URIImpl("urn:unknownContext");

    context1 = vf.createURI("urn:x-local:graph1");
    context2 = vf.createURI("urn:x-local:graph2");
  }
View Full Code Here

  }

  public void testTransactionIsolation()
    throws Exception
  {
    URI bob = new URIImpl("urn:test:bob");
    testCon.begin();
    testCon.add(bob, name, nameBob);

    assertTrue(testCon.hasMatch(bob, name, nameBob, false));
    assertFalse(testCon2.hasMatch(bob, name, nameBob, false));
View Full Code Here

    URI guernica = vf.createURI(EXAMPLE_NS, GUERNICA);

    context1 = vf.createURI(EXAMPLE_NS, CONTEXT_1);
    context2 = vf.createURI(EXAMPLE_NS, CONTEXT_2);

    URI unknownContext = new URIImpl(EXAMPLE_NS + "unknown");

    Thread.sleep(2000); // increase modified age
    assertEquals(0, testCon.sizeMatch(null, null, null, false));
    for (Resource subj : Arrays.asList(null, picasso)) {
      for (URI pred : Arrays.asList(null, paints, RDF.TYPE)) {
        for (Value obj : Arrays.asList(null, guernica)) {
          for (Resource[] ctx : Arrays.asList(new Resource[0], new Resource[] { context1 },
              new Resource[] { unknownContext }))
          {
            assertEquals(0, testCon.sizeMatch(subj, pred, obj, false, ctx));
          }
        }
      }
    }

    // Add some data to the repository
    testCon.begin();
    testCon.add(painter, RDF.TYPE, RDFS.CLASS);
    testCon.add(painting, RDF.TYPE, RDFS.CLASS);
    testCon.add(picasso, RDF.TYPE, painter, context1);
    testCon.add(guernica, RDF.TYPE, painting, context1);
    testCon.add(picasso, paints, guernica, context1);
    testCon.commit();

    Thread.sleep(1000); // increase modified age
    assertEquals(5, testCon.sizeMatch(null, null, null, false));
    assertEquals(5, testCon.sizeMatch(null, null, null, false));
    assertEquals(3, testCon.sizeMatch(null, null, null, false, context1));
    assertEquals(4, testCon.sizeMatch(null, RDF.TYPE, null, false));
    assertEquals(1, testCon.sizeMatch(null, paints, null, false));
    assertEquals(2, testCon.sizeMatch(picasso, null, null, false));
    assertEquals(2, testCon.sizeMatch(picasso, null, null, false));

    assertEquals(0, testCon.sizeMatch(null, null, null, false, unknownContext));
    assertEquals(0, testCon.sizeMatch(null, picasso, null, false));

    URIImpl uriImplContext1 = new URIImpl(context1.toString());

    assertEquals(3, testCon.sizeMatch(null, null, null, false, uriImplContext1));
  }
View Full Code Here

    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < 512; i++) {
      sb.append(Character.toChars('A' + (i % 26)));
    }
    String EXAMPLE_NS = "urn:test:";
    URI subj = new URIImpl(EXAMPLE_NS + "PICASSO");
    URI pred = new URIImpl(EXAMPLE_NS + "PAINTS");
    URI obj = new URIImpl(EXAMPLE_NS + "GUERNICA" + sb.toString());

    testValueRoundTrip(subj, pred, obj);
  }
View Full Code Here

TOP

Related Classes of org.openrdf.model.impl.URIImpl

Copyright © 2018 www.massapicom. 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.