Package org.ontoware.rdf2go.model.node

Examples of org.ontoware.rdf2go.model.node.Resource


    assertTrue(this.model.contains(blankNode, RDF.type, RDF.Statement));
   
    // test also the method where the resource is passed
    stmt = this.model.createStatement(a, b, a);
    URI u = this.model.newRandomUniqueURI();
    Resource reified = this.model.addReificationOf(stmt, u);
    assertEquals(u, reified);
    assertTrue(this.model.contains(u, RDF.subject, a));
    assertTrue(this.model.contains(u, RDF.predicate, b));
    assertTrue(this.model.contains(u, RDF.object, a));
    assertTrue(this.model.contains(u, RDF.type, RDF.Statement));
View Full Code Here


    assertFalse(this.model.contains(blankNode, RDF.type, RDF.Statement));
   
    // test also the method where the resource is passed
    stmt = this.model.createStatement(a, b, a);
    URI u = this.model.newRandomUniqueURI();
    Resource reified = this.model.addReificationOf(stmt, u);
    assertEquals(u, reified);
    assertTrue(this.model.contains(u, RDF.subject, a));
    assertTrue(this.model.contains(u, RDF.predicate, b));
    assertTrue(this.model.contains(u, RDF.object, a));
    assertTrue(this.model.contains(u, RDF.type, RDF.Statement));
View Full Code Here

  }
 
  public void testHasReifications() {
    Statement stmt = this.model.createStatement(a, b, c);
    assertFalse(this.model.hasReifications(stmt));
    Resource r = this.model.addReificationOf(stmt);
    // we already verified in testAddReification() that the reification is
    // in the store!
    assertTrue(this.model.hasReifications(stmt));
    // remove an essential part
    this.model.removeStatement(r, RDF.subject, a);
View Full Code Here

            + " ." + " ?res " + RDF.object.toSPARQL() + " " + statement.getObject().toSPARQL()
            + " ." + " }");
    LinkedList<Resource> result = new LinkedList<Resource>();
    ClosableIterator<QueryRow> it = table.iterator();
    while(it.hasNext()) {
      Resource res = it.next().getValue("res").asResource();
      result.add(res);
    }
    it.close();
    return result;
  }
View Full Code Here

    assertFalse(this.modelset.containsStatements(a, blankNode, RDF.type, RDF.Statement));
   
    // test also the method where the resource is passed
    stmt = this.modelset.createStatement(a, subject, predicate, object);
    URI u = this.modelset.newRandomUniqueURI();
    Resource reified = this.modelset.addReificationOf(stmt, u);
    assertEquals(u, reified);
    assertTrue(this.modelset.containsStatements(a, u, RDF.subject, subject));
    assertTrue(this.modelset.containsStatements(a, u, RDF.predicate, predicate));
    assertTrue(this.modelset.containsStatements(a, u, RDF.object, object));
    assertTrue(this.modelset.containsStatements(a, u, RDF.type, RDF.Statement));
View Full Code Here

 
  @Test
  public void testHasReifications() {
    Statement stmt = this.modelset.createStatement(a, b, c);
    assertFalse(this.modelset.hasReifications(stmt));
    Resource r = this.modelset.addReificationOf(stmt);
    // we already verified in testAddReification() that the reification is
    // in the store!
    assertTrue(this.modelset.hasReifications(stmt));
    // remove an essential part
    this.modelset.removeStatement(this.modelset.createStatement(r, RDF.subject, a));
View Full Code Here

        Statement stmt = it.next();
        boolean blankSubject = stmt.getSubject() instanceof BlankNode;
        boolean blankObject = stmt.getObject() instanceof BlankNode;
       
        if(blankSubject || blankObject) {
          Resource s;
          if(blankSubject) {
            s = transform(stmt.getSubject().asBlankNode(), bnodeSourceId2bnodeTarget,
                    target);
          } else {
            s = stmt.getSubject();
View Full Code Here

        add.open();

        Model remove = RDF2Go.getModelFactory().createModel();
        remove.open();
        for (Statement stmt : model) {
            Resource subj = stmt.getSubject();
            URI pred = stmt.getPredicate();
            Node obj = stmt.getObject();
            boolean match = false;
            if (subj instanceof BlankNode) {
                match = true;
                URI newSubj = nodeMap.get(subj);
                if (newSubj == null) {
                    newSubj = URIGenerator.createNewRandomUniqueURI();
                    nodeMap.put(subj.asBlankNode(), newSubj);
                }
                subj = newSubj;
            }
            if (obj instanceof BlankNode) {
                match = true;
View Full Code Here

    }
  }
 
  protected void addSimpleContact(URI property, String fullname, RDFContainer container) {
    Model model = container.getModel();
    Resource resource = ModelUtil.generateRandomResource(model);
    model.addStatement(resource, RDF.type, NCO.Contact);
    model.addStatement(resource, NCO.fullname, fullname);
    model.addStatement(container.getDescribedUri(), property, resource);
}
View Full Code Here

    WebBookmarkResource x = null;
    synchronized (MAP_RESOURCES) {
      x = MAP_RESOURCES.get(_uri);
      // try to unmap
      if (x == null && _uri != null) {
        Resource res;
        try
        {
          res = new URIImpl(_uri);
        }
        catch (Exception e)
View Full Code Here

TOP

Related Classes of org.ontoware.rdf2go.model.node.Resource

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.