Package com.hp.gloze

Examples of com.hp.gloze.XMLBean


          if (mixed) schema.textToRDF(subject, seq, n, ctx);
        case Node.COMMENT_NODE:
          index++;
          break;
        case Node.ELEMENT_NODE:
          XMLBean b = (XMLBean) _any.elementAt(x);
          int i = index;
          if (b instanceof element) {
            element e = (element) b;
            i = e.toRDF(subject, node, index, seq, mixed,ctx);
            // stop if failure isn't optional
View Full Code Here


    int max = maxOccurs.equals("unbounded")? Integer.MAX_VALUE : Integer.parseInt(maxOccurs);
    int start = index, occurs=0;
    while (occurs<max) {
      // run through the schema sequence component
      for (int i = 0; _any != null && i < _any.size(); i++) {
        XMLBean bean = (XMLBean) _any.elementAt(i)
        // subcomponents may consume both ordinal and non-ordinal statements
        if (bean instanceof element)
          index = ((element) bean).toXML(element, rdf, index, pending, ctx);
        else if (bean instanceof any) // any remaining
          index = ((any) bean).toXML(element, rdf, index, pending, ctx);
View Full Code Here

    }
    return id;
  }

  private XMLBean get_baseType(Model model, Context ctx) {
    XMLBean b = ctx.getBase(this);
    if (b!=null) return b;
    if (base!=null) {
      String uri = expandQName(ctx.getDefaultNS(),base,model);
      if (!uri.startsWith(schema.XSD_URI)) {
        b = ctx.getComplexType(uri);
View Full Code Here

    // add a restriction set when we pass through a restriction element
    if (restrictions==null) restrictions = new HashSet<restriction>();
    restrictions.add(this);

    // inherit attributes and simple content from the base
    XMLBean b = get_baseType(ctx.getModel(),ctx);
    if (b!=null && b instanceof simpleType)
      return ((simpleType)b).toRDF(subject,prop,node,value,seq,restrictions,ctx);
   
    else if (b!=null && b instanceof complexType)
      // complex types are OK as long as they also have simple content
View Full Code Here

    // add a restriction set when we pass through a restriction element
    if (restrictions==null) restrictions = new HashSet<restriction>();
    restrictions.add(this);

    // inherit attributes and simple content from the base
    XMLBean b = get_baseType(ctx.getModel(),ctx);
    if (b!=null && b instanceof simpleType)
      Gloze.logger.error("simpleType in restriction of complex type");
   
    else if (b!=null && b instanceof complexType)
      // complex types are OK as long as they also have simple content
View Full Code Here

  /** restriction of simple type (element) **/

  public boolean toXML(Element e, RDFNode rdf, String pack, Context ctx) {
    schema xs = (schema) this.get_owner();
    XMLBean b = get_baseType(ctx.getModel(),ctx);
    if (b!=null && b instanceof simpleType)
      return ((simpleType)b).toXML(e,rdf,pack,ctx);
    else return xs.toXMLText(e,rdf,expandQName(ctx.getDefaultNS(),base, ctx.getModel()),pack,ctx);
  }
View Full Code Here

    schema xs = (schema) this.get_owner();
   
    // attributes and attribute groups appearing in the restriction must also appear in the base
    // assume anyAttribute is not inherited in the same way

    XMLBean b = get_baseType(ctx.getModel(),ctx);
    if (b!=null && b instanceof simpleType)
      return ((simpleType)b).toXML(e,rdf,ctx);
    else if (b!=null && b instanceof complexType)
      return ((complexType)b).toXML(e,rdf,pending,ctx);     
    else return xs.toXMLText(e,rdf,expandQName(ctx.getDefaultNS(),base, ctx.getModel()),null,ctx);
View Full Code Here

  /* restriction of complex content */

  public void toOWLComplexContent(OntModel ont, Resource cls, Restrictions rest, Context ctx) {
    schema xs = (schema) this.get_owner();
    // inherit attributes and simple content from the base
    XMLBean b = get_baseType(ont,ctx);
    if (b!=null && b instanceof simpleType)
      Gloze.logger.error("simpleType in restriction of complex type");

    if (b!=null && b instanceof complexType) ;
    else {
View Full Code Here

  /* restriction of simple content */

  public void toOWLSimpleContent(Resource cls, Restrictions rest, Context ctx) {
    schema xs = (schema) this.get_owner();
    // inherit attributes and simple content from the base
    XMLBean b = get_baseType(xs.ont,ctx);
    if (b==null) {
      // xsd type
      String type = expandQName(ctx.getDefaultNS(),base, xs.ont);
      if (rest!=null && type!=null && schema.isValidDatatype(type)){
        rest.addRange(xs.ont,RDF.value.getURI(),type);
View Full Code Here

    }
  }

  private XMLBean get_type(Context ctx) {
    if (simpleType != null) return simpleType;
    XMLBean b = ctx.getType(this);
    if (b!=null) return b;
    if (type!=null) {
      String uri = expandQName(ctx.getDefaultNS(),type,ctx.getModel());
      if (!uri.startsWith(schema.XSD_URI)) {
        b = ctx.getComplexType(uri);
View Full Code Here

TOP

Related Classes of com.hp.gloze.XMLBean

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.