Package org.ontoware.rdf2go.model.node

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


   * @return true if value could be removed
   * @throws Exception
   */
  static boolean removeValue(Model model, Resource resource, URI propertyURI,
      Object value) throws ModelRuntimeException {
    Node objectNode = RDFReactorRuntime.java2node(model, value);
    boolean found = model.contains(resource, propertyURI, objectNode);

    if (found) {
      model.removeStatement(resource, propertyURI, objectNode);
    }
View Full Code Here


          .findStatements(triplePattern);
      // eliminates duplicates
      while (it.hasNext()) {
        log.debug("got a result");
        Statement statement = it.next();
        Node rdfnode = triplePattern.getExtract(statement);
        result.add(RDFReactorRuntime.node2javatype(model, rdfnode,
            returnType));
      }
      it.close();
    }
View Full Code Here

   */
  public static Node getSingleValue(Model model, Resource subject,
      URI propertyURI) {
    log.debug("looking for ( <" + subject + "> <" + propertyURI + "> *)");

    Node result = null;
    synchronized (model) {
      // get value
      ClosableIterator<? extends Statement> it;
      it = model.findStatements(subject, propertyURI, Variable.ANY);
      if (it.hasNext()) {
View Full Code Here

    return this.it.hasNext();
  }
 
  @SuppressWarnings(value = "unchecked")
  public T next() {
    Node node = this.it.next();
    Object typedObject = RDFReactorRuntime.node2javatype(this.model, node, this.returnType);
    return (T)typedObject;
  }
View Full Code Here

    this.it.close();
  }
 
  @SuppressWarnings("unchecked")
  public T next() {
    Node node = this.it.next();
    Object typedObject = RDFReactorRuntime.node2javatype(this.model, node, this.returnType);
    return (T)typedObject;
  }
View Full Code Here

    if(value == null)
      throw new IllegalArgumentException("value may not be null");
    assertOpen(model);
    Resource rdfResource = RDFReactorRuntime.genericResource2RDF2Goresource(model,
            resourceSubject);
    Node node = RDFReactorRuntime.java2node(model, value);
    model.addStatement(rdfResource, propertyURI, node);
  }
View Full Code Here

      throw new IllegalArgumentException("value may not be null");
    assertOpen(model);
    Resource rdfResource = RDFReactorRuntime.genericResource2RDF2Goresource(model,
            resourceSubject);
   
    Node node = RDFReactorRuntime.java2node(model, value);
    if(model.contains(rdfResource, propertyURI, node)) {
      return;
    }
   
    long count = countPropertyValues(model, rdfResource, propertyURI);
View Full Code Here

    if(returnType == null)
      throw new IllegalArgumentException("returnType may not be null");
    assertOpen(model);
    Resource rdfResource = RDFReactorRuntime.genericResource2RDF2Goresource(model,
            resourceSubject);
    Node node = ResourceUtils.getSingleValue(model, rdfResource, propertyURI);
    return RDFReactorRuntime.node2javatype(model, node, returnType);
  }
View Full Code Here

    assertOpen(model);
    Resource rdfResource = RDFReactorRuntime.genericResource2RDF2Goresource(model,
            instanceResource);
    ClosableIterator<Node> it = getAll(model, rdfResource, propertyURI, Node.class);
    if(it.hasNext()) {
      Node result = it.next();
      return result;
    } else {
      return null;
    }
  }
View Full Code Here

    if(propertyURI == null)
      throw new IllegalArgumentException("propertyURI may not be null");
    if(value == null)
      throw new IllegalArgumentException("value may not be null");
    assertOpen(model);
    Node node = RDFReactorRuntime.java2node(model, value);
    ClosableIterator<Statement> it = model.findStatements(Variable.ANY, propertyURI, node);
    return new ProjectingIterator<Resource>(it, ProjectingIterator.projection.Subject);
  }
View Full Code Here

TOP

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

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.