Package org.ontoware.rdf2go.model.node

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


  public static Map<URI, Object> asMap(Object obj) {
    return new ReactorMap(o2m.get(obj), o2r.get(obj));
  }

  public static boolean removeAll(Object obj, URI p) {
    Resource r = o2r.get(obj);
    Model m = o2m.get(r);

    try {
      return Bridge.removeAllValues(m, r, p);
    } catch (Exception e) {
View Full Code Here


    // get all persons
   
    ClosableIterator<? extends Statement> it = model.findStatements(Variable.ANY, RDF.type,
            foafPerson);
    while(it.hasNext()) {
      Resource person = it.next().getSubject();
      System.out.println(person + " is a person");
     
      // get foaf:name
      ClosableIterator<? extends Statement> it2 = model.findStatements(person, foafName,
              Variable.ANY);
View Full Code Here

    ClosableIterator<? extends Statement> queryC = this.model.findStatements(Variable.ANY,
            RDF.type, type);
    try {
      while(queryC.hasNext()) {
        Statement answer = queryC.next();
        Resource rx = answer.getSubject();
        // we do not create constants for blank nodes
        if(!(rx instanceof URI))
          continue;
        URI vx = (URI)rx;
        String uri = vx.toString();
View Full Code Here

    remove.open();
   
    ClosableIterator<Statement> it = model.iterator();
    while(it.hasNext()) {
      Statement stmt = it.next();
      Resource s = stmt.getSubject();
      URI p = stmt.getPredicate();
      Node o = stmt.getObject();
     
      boolean match = false;
      if(s instanceof URI && s.asURI().toString().startsWith(searchURIPrefix)) {
        match = true;
        String sURI = s.asURI().toString().replace(searchURIPrefix, replaceURIPrefix);
        s = new URIImpl(sURI);
      }
      if(p.toString().startsWith(searchURIPrefix)) {
        match = true;
        String pURI = p.toString().replace(searchURIPrefix, replaceURIPrefix);
View Full Code Here

        + 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

   */
  public static Resource genericResource2RDF2Goresource(Model model, Resource o) {
    if(o instanceof ReactorRuntimeEntity) {
      log.debug("object is an instanceof ReactorBase, so will add as single resource");
      // add as resource
      Resource objectID = ((ReactorRuntimeEntity)o).getResource();
      return objectID;
    } else {
      return o;
    }
  }
View Full Code Here

    // convert value to rdfnode
    log.debug("value is instance of " + reactorValue.getClass().getName());
    if(reactorValue instanceof ReactorRuntimeEntity) {
      log.debug("object is an instanceof ReactorBase, so will add as single resource");
      // add as resource
      Resource objectID = ((ReactorRuntimeEntity)reactorValue).getResource();
      return objectID;
    } else {
      for(Class<?> clazz : converterMap.keySet()) {
        log.debug("Can a " + reactorValue.getClass() + " be converted as " + clazz + " ?");
        if(clazz.isInstance(reactorValue)) {
View Full Code Here

    try {

      ClosableIterator<? extends Statement> it = model.findStatements(
          Variable.ANY, RDF.type, getClassURI(javaClass));
      while (it.hasNext()) {
        Resource o = it.next().getSubject();
        // log.debug("found instance " + o + " of class "
        // + javaClass.getName());
        result.add(RDFReactorRuntime.node2javatype(model, o, javaClass));
      }
      it.close();
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);
    Resource rdfResource = RDFReactorRuntime.genericResource2RDF2Goresource(model,
            resourceSubject);
    Node node = RDFReactorRuntime.java2node(model, value);
    model.addStatement(rdfResource, propertyURI, node);
  }
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);
    Resource rdfResource = RDFReactorRuntime.genericResource2RDF2Goresource(model,
            resourceSubject);
   
    Node node = RDFReactorRuntime.java2node(model, value);
    if(model.contains(rdfResource, propertyURI, node)) {
      return;
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.