Package org.ontoware.rdf2go.model.node.impl

Examples of org.ontoware.rdf2go.model.node.impl.URIImpl


    Model a = getModelFactory().createModel();
    a.open();
    Model b = getModelFactory().createModel();
    b.open();
   
    a.addStatement(new URIImpl("urn:test:a", false), new URIImpl("urn:test:b", false),
            new URIImpl("urn:test:c", false));
    Statement aStmt = a.iterator().next();
   
    assertEquals(0, aStmt.compareTo(aStmt));
   
    b.addStatement(new URIImpl("urn:test:x", false), new URIImpl("urn:test:y", false),
            new URIImpl("urn:test:z", false));
    Statement bStmt = b.iterator().next();
   
    // one should be positive, one negative, both not 0
    assertTrue(aStmt.compareTo(bStmt) * bStmt.compareTo(aStmt) < 0);
    a.close();
View Full Code Here


    Model modelRDFS = getModelFactory().createModel(Reasoning.rdfs);
    modelRDFS.open();
   
    modelRDFS.removeAll();
   
    URI hasContent = new URIImpl("prop://hasContent");
    URI hasTag = new URIImpl("prop://hasTag");
    URI tagSemweb = new URIImpl("tag://semweb");
    URI tagPaper = new URIImpl("tag://paper");
    URI fileA = new URIImpl("file://a");
    URI fileB = new URIImpl("file://b");
    URI assignment1 = new URIImpl("ass://1");
    URI assignment2 = new URIImpl("ass://2");
    URI assignment3 = new URIImpl("ass://1");
   
    // a = 'paper'
    modelRDFS.addStatement(assignment1, hasTag, tagPaper);
    modelRDFS.addStatement(assignment1, hasContent, fileA);
    // a = 'semweb'
View Full Code Here

 
  @Test
  public void testSparqlAsk() throws Exception {
    Model modelRDFS = getModelFactory().createModel(Reasoning.rdfs);
    modelRDFS.open();
    URI hasTag = new URIImpl("prop://hasTag");
    URI tagSemweb = new URIImpl("tag://semweb");
    URI fileA = new URIImpl("file://a");
    modelRDFS.addStatement(fileA, hasTag, tagSemweb);
    Assert.assertTrue(modelRDFS.sparqlAsk("ASK WHERE { " + fileA.toSPARQL() + " "
            + hasTag.toSPARQL() + " ?tag . }"));
    Assert.assertTrue(modelRDFS.sparqlAsk("ASK WHERE { " + fileA.toSPARQL() + " " + " ?prop "
            + tagSemweb.toSPARQL() + " . }"));
    Assert.assertFalse(modelRDFS.sparqlAsk("ASK WHERE { " + fileA.toSPARQL() + " "
            + "<prop://bogus>" + " ?tag . }"));
    Assert.assertTrue(modelRDFS.sparqlAsk("ASK WHERE { ?s ?p ?o . }"));
    modelRDFS.close();
  }
View Full Code Here

  @Test
  public void testSparqlSelectWithStrings() throws Exception {
    Model modelRDFS = getModelFactory().createModel(Reasoning.rdfs);
    modelRDFS.open();
   
    URI hasContent = new URIImpl("prop://hasContent");
    URI hasTag = new URIImpl("prop://hasTag");
    String tagSemweb = "semweb";
    String tagPaper = "paper";
    URI fileA = new URIImpl("file://a");
    URI fileB = new URIImpl("file://b");
    URI assignment1 = new URIImpl("ass://1");
    URI assignment2 = new URIImpl("ass://2");
    URI assignment3 = new URIImpl("ass://1");
   
    // a = 'paper'
    modelRDFS.addStatement(assignment1, hasTag, tagPaper);
    modelRDFS.addStatement(assignment1, hasContent, fileA);
    // a = 'semweb'
View Full Code Here

    modelRDFS.close();
  }
 
  @Test
  public void testAsk() throws ModelRuntimeException {
    URI a = new URIImpl("urn:test:a");
    URI b = new URIImpl("urn:test:b");
    URI c = new URIImpl("urn:test:c");
    this.model.addStatement(a, b, c);
   
    assertTrue(this.model.sparqlAsk("ASK { ?s ?p ?x . }"));
    assertTrue(this.model.sparqlAsk("ASK { <urn:test:a> <urn:test:b> ?x . }"));
    assertTrue(this.model.sparqlAsk("ASK { <urn:test:a> <urn:test:b> <urn:test:c> . }"));
View Full Code Here

   * @throws ModelRuntimeException if URI syntax is wrong
   *
   * [Generated from RDFReactor template rule #c7]
   */
  public Class ( Model model, String uriString, boolean write) throws ModelRuntimeException {
    super(model, RDFS_CLASS, new URIImpl(uriString,false), write);
  }
View Full Code Here

    return new TriplePatternImpl(subject, predicate, object);
  }
 
  @Override
  public URI createURI(String uriString) throws ModelRuntimeException {
    return new URIImpl(uriString);
  }
View Full Code Here

  @SuppressWarnings("unused")
  private static final Logger log = LoggerFactory.getLogger(URIGenerator.class);

  public static URI createNewRandomUniqueURI() {
    return new URIImpl("urn:rnd:" + new UID().toString());
  }
View Full Code Here

  /**
   * @param uriPrefix - must include schema information
   * @return a new, random unique URI starting with uriPrefix
   */
  public static URI createNewRandomUniqueURI(String uriPrefix) {
    return new URIImpl(uriPrefix + new UID().toString());
  }
View Full Code Here

   * @param model RDF2GO Model implementation, see http://rdf2go.ontoware.org
   * @param uriString A URI of this instance, represented as a String
   * @throws ModelRuntimeException if URI syntax is wrong
   */
  public Tag ( Model model, String uriString ) throws ModelRuntimeException {
    this(model, new URIImpl(uriString), true);
  }
View Full Code Here

TOP

Related Classes of org.ontoware.rdf2go.model.node.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.