Package com.hp.hpl.jena.rdf.model

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


        String BASE = "http://example/" ;
        Model model = ModelFactory.createDefaultModel() ;
        model.setNsPrefix("", BASE) ;
        Resource r1 = model.createResource(BASE+"r1") ;
        Resource r2 = model.createResource(BASE+"r2") ;
        Property p1 = model.createProperty(BASE+"p") ;
        Property p2 = model.createProperty(BASE+"p2") ;
        RDFNode v1 = model.createTypedLiteral("1", XSDDatatype.XSDinteger) ;
        RDFNode v2 = model.createTypedLiteral("2", XSDDatatype.XSDinteger) ;
       
        r1.addProperty(p1, v1).addProperty(p1, v2) ;
        r1.addProperty(p2, v1).addProperty(p2, v2) ;
View Full Code Here


        }
    }
   
    protected final void unwrappedReadRDF() {
        Resource subject;
        Property predicate = null;
        RDFNode object;

        while (!in.eof()) {
            while (!in.eof()) {
                inErr = false;
View Full Code Here

   
    private static Model makeData()
    {
        Model model = ModelFactory.createDefaultModel() ;
        Resource r = model.createResource(NS+"r") ;
        Property p1 = model.createProperty(NS+"p1") ;
        Property p2 = model.createProperty(NS+"p2") ;
        model.add(r, p1, "xyz") ;
        model.add(r, p2, "abc") ;
        return model ;
    }
View Full Code Here

    populate();
    Model m = ctx.getModel();
    String value = getValue(elem);
    if (value==null && _default != null) value = _default;
    String uri = createURI(m,ctx);
    Property prop = null;
    if (uri != null) prop = m.createProperty(uri);
    Statement stmt=null;
    // the element may be defined locally or globally (follow ref)
    element def = getDefinition(ctx.getModel(),ctx);
   
View Full Code Here

    GlozeURL.logger.warn("drop: no schema mapping for resource: "+resource);
    StmtIterator si = resource.listProperties();
    if (!si.hasNext())
      GlozeURL.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;
      GlozeURL.logger.warn("because no matching property: "+p.getURI());
    }
    // try no-schema mapping
    GlozeURL.logger.info("using no-schema mapping");
    XMLBean.noSchemaToXML(doc,resource,ctx);
    return doc;
View Full Code Here

    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
    Gloze.logger.info("using no-schema mapping");
    XMLBean.noSchemaToXML(doc,resource,ctx);
    return doc;
View Full Code Here

  throws Exception {
    Model m = subject.getModel();
    Statement stmt = null;
   
    String uri = expandQName(elem, ctx.getModel(), ctx);
    Property prop = m.createProperty(uri);

    // anything with no attributes and a single (or no) value is simple
    // anything with attributes is complex
    // anything with children is complex
   
View Full Code Here

    }
    Literal l = ctx.getModel().createLiteral(attr.getValue());
    String u = XMLBean.expandQName(attr, ctx);
    if (!u.startsWith(schema.XSI) && !u.startsWith(XMLBean.XML)) {
      // not a schema instance or XML property
      Property p = ctx.getModel().createProperty(u);
      subject.addProperty(p,l);
    }
    XMLBean.addPrefixes(attr.getPrefix(), attr.getNamespaceURI(), ctx.getModel());
  }
View Full Code Here

    boolean qualify = ctx.getDefaultNS()!=null;
    if (rdf instanceof Resource) {
      Resource r = (Resource) rdf;
      for (StmtIterator i = r.listProperties(); i.hasNext(); ) {
        Statement stmt = i.nextStatement();
        Property p = stmt.getPredicate();
        // ignore RDF properties eg. RDF:type
        // take the first (non-rdf) property we find as document element
        if (!p.getURI().startsWith(RDF.getURI())) {
          Element e = noSchemaToElement(doc,p,ctx);
          doc.appendChild(e);
          noSchemaToXML(e,stmt.getObject(),qualify,ctx);
          return true;
        }
View Full Code Here

  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

TOP

Related Classes of com.hp.hpl.jena.rdf.model.Property

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.