Package org.ontoware.rdf2go.model.node

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


    if(propertyURI == null)
      throw new IllegalArgumentException("propertyURI may not be null");
    if(returnType == null)
      throw new IllegalArgumentException("returnType may not be null");
    assertOpen(model);
    Node node = RDFReactorRuntime.java2node(model, value);
    return new ReactorResult<T>(model, new TriplePatternImpl(Variable.ANY, propertyURI, node,
            TriplePatternImpl.SPO.SUBJECT), returnType);
  }
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 valueNode = RDFReactorRuntime.java2node(model, value);
    ClosableIterator<Statement> it = model.findStatements(Variable.ANY, propertyURI, valueNode);
    Resource result = null;
    if(it.hasNext()) {
      result = it.next().getSubject();
    }
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);
    return model.contains(rdfResource, propertyURI, node);
  }
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.removeStatement(rdfResource, propertyURI, node);
  }
View Full Code Here

    assertOpen(model);
    synchronized(model) {
      Resource rdfResource = RDFReactorRuntime.genericResource2RDF2Goresource(model,
              resourceSubject);
      removeAll_unsynchronized(model, rdfResource, propertyURI);
      Node node = RDFReactorRuntime.java2node(model, value);
      model.addStatement(rdfResource, propertyURI, node);
    }
  }
View Full Code Here

  public static Node toObject(String object) {
    if(object == null) {
      throw new NullPointerException("object cannot be null");
    }
   
    Node myObject = null;
   
    if(object.equals("_:")) {
      myObject = LazyInitializer.instance.createBlankNode();
    } else if(object.startsWith("_:")) {
      myObject = LazyInitializer.instance.createBlankNode(object.replaceFirst("_:", ""));
View Full Code Here

    return super.get(varname);
  }
 
  @Override
    public String getLiteralValue(String varname) throws ModelRuntimeException {
    Node n = super.get(varname);
    if(n instanceof Literal)
      return ((Literal)n).getValue();
    // else
    throw new ModelRuntimeException("Node is not a literal");
  }
View Full Code Here

    String queryString = "SELECT ?x WHERE { <" + konrad + "> <" + kennt + "> ?x}";
    QueryResultTable table = this.model.sparqlSelect(queryString);
    ClosableIterator<QueryRow> it = table.iterator();
    QueryRow row = it.next();
    assertFalse("iterator should have only one result", it.hasNext());
    Node n = row.getValue("x");
    assertEquals(n, max);
  }
View Full Code Here

    Iterator<QueryRow> iterator = table.iterator();
   
    while(iterator.hasNext()) {
      QueryRow row = iterator.next();
      for(String varname : table.getVariables()) {
        @SuppressWarnings("unused")
        Node x = row.getValue(varname);
      }
    }
   
  }
View Full Code Here

    // add statements
   
    // the cleanest way
    Resource s = model.createURI("urn:test:a");
    URI p = model.createURI("http://www.w3.org/2000/01/rdf-schema#label");
    Node o = model.createPlainLiteral("Hello World A");
    model.addStatement(s, p, o);
   
    // a shortcut: built-in URIs for RDF and RDFS
    model.addStatement("urn:test:b", RDFS.label, "Hello World B");
   
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.