Examples of StmtIterator


Examples of com.hp.hpl.jena.rdf.model.StmtIterator

    Context ctx = new Context(new URI(resource.getURI()), xmlns, resource.getModel(),schemaMap,this);
   
    if (ctx.toXML(doc, resource)) return doc;

    Gloze.logger.warn("drop: no schema mapping for resource: "+resource);
    StmtIterator si = resource.listProperties();
    if (!si.hasNext())
      Gloze.logger.warn("because no properties, is gloze.uri correctly defined?");
    else while (si.hasNext()) {
      Property p = si.nextStatement().getPredicate();
      // skip eg. RDF:type
      if (p.getNameSpace().equals(RDF.getURI())) continue;
      Gloze.logger.warn("because no matching property: "+p.getURI());
    }
    // try no-schema mapping
View Full Code Here

Examples of com.hp.hpl.jena.rdf.model.StmtIterator

    setSilent(ctx.isSilent());
    setOverwrite(ctx.isOverwrite());
  }

  public boolean toXML(Document doc, Resource rez) throws Exception {
    StmtIterator i = rez.listProperties();
    while (i.hasNext()) {
      Statement s = i.nextStatement();
      Property p = s.getPredicate();
      element e = getElement(p.getURI());
      if (e!=null && e.toXML(doc, s.getObject(),this)) return true;   
    }
    return false;
View Full Code Here

Examples of com.hp.hpl.jena.rdf.model.StmtIterator

  /* properties of the rdf node that are not in sequence */
  /* this includes type information */
 
  protected static Set<Statement> unsequenced(Resource rdf) {
    Set<Statement> s = new HashSet<Statement>();
    StmtIterator si = rdf.listProperties();
    while (si.hasNext()) {
      Statement stmt = si.nextStatement();
      // don't add ordinals
      if (stmt.getPredicate().getOrdinal()==0) s.add(stmt);
    }
    NodeIterator ni = rdf.getModel().getSeq(rdf).iterator();
    while (ni.hasNext()) {
View Full Code Here

Examples of com.hp.hpl.jena.rdf.model.StmtIterator

    if (r==null) return null;
    try {   
      stmt = ((ReifiedStatement) r.as(ReifiedStatement.class)).getStatement();
    } catch (Exception e1) {
      Gloze.logger.warn("ill-formed reification");
      StmtIterator si = r.listProperties();
      while (si.hasNext()) Gloze.logger.warn(si.next());
      stmt = null;
    }
    return stmt;
  }
View Full Code Here

Examples of com.hp.hpl.jena.rdf.model.StmtIterator

 
  private void addHighDegreePropertyLinks(Model model, HypermediaControls controller) {
    // TODO: This should re-use the logic from ResourceDescription and ResourceProperty to decide where to create these links
    // Add links to RDF documents with descriptions of the blank nodes
    Resource r = model.getResource(controller.getAbsoluteIRI());
    StmtIterator it = r.listProperties();
    while (it.hasNext()) {
      Statement stmt = it.nextStatement();
      if (!stmt.getObject().isAnon()) continue;
      String pathDataURL = controller.getValuesDataURL(stmt.getPredicate());
      if (pathDataURL == null) continue;
      ((Resource) stmt.getResource()).addProperty(RDFS.seeAlso,
          model.createResource(pathDataURL));
    }
    it = model.listStatements(null, null, r);
    while (it.hasNext()) {
      Statement stmt = it.nextStatement();
      if (!stmt.getSubject().isAnon()) continue;
      String pathDataURL = controller.getInverseValuesDataURL(stmt.getPredicate());
      if (pathDataURL == null) continue;
      ((Resource) stmt.getSubject().as(Resource.class)).addProperty(RDFS.seeAlso,
          model.createResource(pathDataURL));
View Full Code Here

Examples of com.hp.hpl.jena.rdf.model.StmtIterator

* The server's configuration.
*/
public class Configuration extends ResourceReader {
 
  public static Configuration create(Model model) {
    StmtIterator it = model.listStatements(null, RDF.type, CONF.Configuration);
    if (!it.hasNext()) {
      throw new IllegalArgumentException(
          "No resource with type conf:Configuration found in configuration file");
    }
    return new Configuration(it.nextStatement().getSubject());
  }
View Full Code Here

Examples of com.hp.hpl.jena.rdf.model.StmtIterator

    if (!indexIRI.equals(resourceIRI)) {
      return wrapped.listPropertyValues(resourceIRI, property, isInverse);
    }
    Model all = describeResource(resourceIRI);
    Resource r = all.getResource(resourceIRI);
    StmtIterator it = isInverse
        ? all.listStatements(null, property, r)
        : all.listStatements(r, property, (RDFNode) null);
    Model result = ModelFactory.createDefaultModel();
    while (it.hasNext()) {
      result.add(it.next());
    }
    return result;
  }
View Full Code Here

Examples of com.hp.hpl.jena.rdf.model.StmtIterator

    return resource.getProperty(p).getResource();   
  }
 
  public Set<Resource> getResources(Property p) {
    Set<Resource> result = new HashSet<Resource>();
    StmtIterator it = resource.listProperties(p);
    while (it.hasNext()) {
      Statement stmt = it.next();
      assertResourceValue(stmt);
      result.add(stmt.getResource());
    }
    return result;
  }
View Full Code Here

Examples of com.hp.hpl.jena.rdf.model.StmtIterator

    return getIRI(p);
  }
 
  public Set<String> getIRIs(Property p) {
    Set<String> result = new HashSet<String>();
    StmtIterator it = resource.listProperties(p);
    while (it.hasNext()) {
      Statement stmt = it.next();
      assertIRIValue(stmt);
      result.add(stmt.getResource().getURI());
    }
    return result;
  }
View Full Code Here

Examples of com.hp.hpl.jena.rdf.model.StmtIterator

    return resource.getProperty(p).getString();
  }
 
  public Set<String> getStrings(Property p) {
    Set<String> result = new HashSet<String>();
    StmtIterator it = resource.listProperties(p);
    while (it.hasNext()) {
      Statement stmt = it.next();
      assertString(stmt);
      result.add(stmt.getString());
    }
    return result;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.