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

Examples of com.hp.hpl.jena.rdf.model.Model.createStatement()


    String value = ((Text) n).getNodeValue();
    value = processWhitespace(n,value,null,ctx);
    if (!value.equals("")) {
      Model m = ctx.getModel();
      Literal lit = m.createLiteral(value);
      Statement stmt = m.createStatement(subject, RDF.value, lit);
      m.add(stmt);
      if (seq!=null) seq.add(stmt.createReifiedStatement());
    }
  }
 
View Full Code Here


   
    if (object==null) return false;
    // if no property is supplied just add the value to the sequence/list
    if (prop==null && seq!=null) seq.add(object);
    else  {
      stmt = m.createStatement(subject, prop, object);
      m.add(stmt);
      // this can only be a sequence
      if (seq != null) seq.add(stmt.createReifiedStatement());     
    }   
    return true;   
View Full Code Here

  throws Exception {
    Model m = ctx.getModel();

    if (value==null) {
      if (prop==RDF.value || type.endsWith("#ID")) return null;
      return m.createStatement(subject,prop,"");
    }
   
    Statement stmt = null;
    if (type.endsWith("#ID")) ;
    // ID is used to name the owning element - don't generate RDF
View Full Code Here

    if (type.endsWith("#ID")) ;
    // ID is used to name the owning element - don't generate RDF
    // IDREF to globally named element
    else if (type.endsWith("#IDREF")) {
      Resource r = m.createResource(addFragment(ctx.getBaseMap(), value).toString());
      stmt = m.createStatement(subject,prop,r);
    }
    else if (type.endsWith("#IDREFS")) {
      Resource r = toRDFList(elem,value,XSD.IDREF.getURI(),null,ctx)
      stmt = m.createStatement(subject,prop,r);
    }
View Full Code Here

      Resource r = m.createResource(addFragment(ctx.getBaseMap(), value).toString());
      stmt = m.createStatement(subject,prop,r);
    }
    else if (type.endsWith("#IDREFS")) {
      Resource r = toRDFList(elem,value,XSD.IDREF.getURI(),null,ctx)
      stmt = m.createStatement(subject,prop,r);
    }
    else if (type.endsWith("#NMTOKENS")) {
      Resource r = toRDFList(elem,value,XSD.NMTOKEN.getURI(),null,ctx)
      stmt = m.createStatement(subject,prop,r);
    }
View Full Code Here

      Resource r = toRDFList(elem,value,XSD.IDREF.getURI(),null,ctx)
      stmt = m.createStatement(subject,prop,r);
    }
    else if (type.endsWith("#NMTOKENS")) {
      Resource r = toRDFList(elem,value,XSD.NMTOKEN.getURI(),null,ctx)
      stmt = m.createStatement(subject,prop,r);
    }
    else if (type.endsWith("#QName")) {
      RDFNode object = null;
      String name = XMLBean.expandQName(ctx.getDefaultNS(),null,value,elem,ctx.getModel());
      if (name!=null) {
View Full Code Here

    else if (type.endsWith("#QName")) {
      RDFNode object = null;
      String name = XMLBean.expandQName(ctx.getDefaultNS(),null,value,elem,ctx.getModel());
      if (name!=null) {
        object = m.createResource(name);
        stmt = m.createStatement(subject,prop,object);
      }
    }
    else if (type.endsWith("#duration")) {
      // map duration into separate xs:yearMonthDuration and xs:dayTimeDuration
      // introduce intermediate bnode
View Full Code Here

    }
    else if (type.endsWith("#duration")) {
      // map duration into separate xs:yearMonthDuration and xs:dayTimeDuration
      // introduce intermediate bnode
      Resource object = m.createResource();
      stmt = m.createStatement(subject,prop,object);
      RDFNode ym = schema.yearMonthDuration(m,value);
      RDFNode dt = schema.dayTimeDuration(m,value);
      if (ym!=null) object.addProperty(RDF.value, ym);
      if (dt!=null) object.addProperty(RDF.value, dt);
    }
View Full Code Here

      DocumentType doctype = elem.getOwnerDocument().getDoctype();
      Pattern entityPattern = Pattern.compile("<!ENTITY\\s+"+value+"\\s+'(.*)'>");
      Matcher match = entityPattern.matcher(doctype.getInternalSubset());
      if (match.find()) value = match.group(1);
      Literal l = m.createTypedLiteral(value,RDF.getURI()+"XMLLiteral");
      stmt = m.createStatement(subject,prop,l);
    }
    else { // schema datatype?
      RDFDatatype dt = getDatatype(type);
      if (dt != null) {
        Literal l = m.createTypedLiteral(processWhitespace(elem,value,type,ctx), dt);
View Full Code Here

    }
    else { // schema datatype?
      RDFDatatype dt = getDatatype(type);
      if (dt != null) {
        Literal l = m.createTypedLiteral(processWhitespace(elem,value,type,ctx), dt);
        stmt = m.createStatement(subject,prop,l);
      }
    }
    return stmt;
  }
 
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.