Examples of RDFNode


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

      if (t==null) type = expandQName(ctx.getDefaultNS(),itemType, ctx.getModel());

      RDFList list = (RDFList) rdf.as(RDFList.class);
      String pack = null;
      for (ExtendedIterator i = list.iterator(); ok && i.hasNext(); ) {
        RDFNode n = (RDFNode) i.next()
        if (t!=null) ok=t.toXML(e,n,pack,ctx);
        else ok=xsd.toXMLText(e,n,type,pack,ctx);
        pack = " "; // whitespace separator
      }
    } catch (Exception ex) { // non-fatal
View Full Code Here

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

      String type = null;
      if (simple==null) type = expandQName(ctx.getDefaultNS(),itemType, m);

      RDFList list = (RDFList) rdf.as(RDFList.class);
      for (ExtendedIterator i = list.iterator(); ok && i.hasNext(); ) {
        RDFNode n = (RDFNode) i.next();
        if (simple!=null) ok=simple.toXML(attr,n,ctx);
        else ok=xsd.toXML(attr,n,type,ctx);
      }
    } catch (Exception e) { // non-fatal
      Gloze.logger.warn("failed to list value");
View Full Code Here

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

   
    assertTrue("I have results", res.hasNext());
   
    QuerySolution soln = res.nextSolution();
   
    RDFNode subj = soln.get("subj");
       
    assertEquals("Result is correct", "urn:ex:TABLE1;FIELD1=2;FIELD3=3", ((Resource) subj).getURI());
   
    qe = prepareQuery("ASK WHERE {  <urn:ex:TABLE1;FIELD1=2;FIELD3=3> <urn:ex:TABLE1_FIELD2> 'C' } ");
   
View Full Code Here

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

      NodeIterator ni = ctx.getModel().getSeq(r).iterator();
      while (ni.hasNext()) {
        Statement stmt = element.asStatement((Resource) ni.nextNode());
        if (stmt.getPredicate().equals(RDF.value)) {
          // add literal value
          RDFNode value = stmt.getObject();
          if (value.isLiteral())
            elem.appendChild(doc.createTextNode(value.toString()))
        }
        else {
          Element e = noSchemaToElement(elem,stmt.getPredicate(),ctx);
          if (e!=null) {
            elem.appendChild(e);
            noSchemaToXML(e,stmt.getObject(),qualify,ctx);
         
        }
      }

      // add (unsequenced) properties
      Set pending = element.unsequenced((Resource) rdf);
      for (Iterator ui = pending.iterator(); ui.hasNext(); ) {
        Statement stmt = (Statement) ui.next();
        if (stmt.getPredicate().equals(RDF.value)) {
          RDFNode n = stmt.getObject();
          if (n.isLiteral()) {
            Literal l = (Literal) n;
            elem.appendChild(doc.createTextNode(l.getString()))
            if (l.getLanguage()!=null) elem.setAttributeNS(XML,"lang",l.getLanguage());
          }
        }
View Full Code Here

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

 
  private void mergeDescription(Resource ir, Resource r, boolean flagOK, Map<RDFNode,RDFNode> visited) {
    for (StmtIterator si = r.listProperties(); si.hasNext(); ) {
      Statement stmt = si.nextStatement();
      Property p = stmt.getPredicate();
      RDFNode o = stmt.getObject();
     
      if (flagOK && r.hasProperty(RDF.type, OWL.Class))
        ir.addProperty(RDF.type, infModel.getResource(Gloze.OK));
     
      if (o.isLiteral())
        ir.addProperty(p,o);
     
      else if (!o.isAnon())
        ir.addProperty(p,infModel.createResource(((Resource)o).getURI()));
     
      else if (o.isAnon() && visited.containsKey(o))
        ir.addProperty(p,visited.get(o));

      else { // recursively merge anonymous objects
        Resource a = infModel.createResource();
        visited.put(o,a);
View Full Code Here

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

 
  public void cleanup(Resource rez, Set<Resource> visited) {
    visited.add(rez);
    Set<Resource> clean = new HashSet<Resource>();
    for (StmtIterator i = rez.listProperties(); i.hasNext(); ) {
      RDFNode obj = i.nextStatement().getObject();
      if (obj.isAnon() && obj instanceof Resource && !visited.contains(obj))
        clean.add((Resource) obj);
    }
    for (Resource r: clean) cleanup(r,visited);
    rez.removeProperties();
  }
View Full Code Here

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

    || type instanceof UnionClassImpl);
  }
 
  static boolean subClassOther(Resource cls) {
    for (StmtIterator si = cls.listProperties(RDFS.subClassOf); si.hasNext(); ) {
      RDFNode c = si.nextStatement().getObject();
      if (cls!=c) return true;
    }
    return false;
  }
View Full Code Here

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

      if (r.isAnon()) continue;
      result.add(r);
    }
    NodeIterator objects = model.listObjects();
    while (objects.hasNext() && result.size() < DataSource.MAX_INDEX_SIZE) {
      RDFNode o = objects.next();
      if (!o.isURIResource()) continue;
      result.add(o.asResource());
    }
    return result;
  }
View Full Code Here

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

      if (s.isURIResource()) {
        s = result.createResource(rewrite(s.getURI()));
      }
      Property p = result.createProperty(
          rewrite(stmt.getPredicate().getURI()));
      RDFNode o = stmt.getObject();
      if (o.isURIResource()) {
        o = result.createResource(rewrite(o.asResource().getURI()));
      }
      result.add(s, p, o);
    }
    return result;
  }
View Full Code Here

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

    }
    private Set<RDFNode> getInverseValues(Resource r) {
      Set<RDFNode> nodes = new HashSet<RDFNode>();
      StmtIterator it = r.listProperties(OWL.inverseOf);
      while (it.hasNext()) {
        RDFNode object = it.next().getObject();
        if (!object.isResource()) continue;
        StmtIterator it2 = object.asResource().listProperties(property);
        while (it2.hasNext()) {
          nodes.add(it2.next().getObject());
        }
      }
      return nodes;
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.