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

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


    if (type!=null && type.startsWith(schema.XSD_URI)) {
      if (is_nillable() && elem.hasAttributeNS(schema.XSI,"nil") && elem.getAttributeNS(schema.XSI,"nil").equals("true"))
        stmt = m.createStatement(subject,prop,RDF.nil);
      else {
        if (type.equals(schema.XSD_URI+"#ID") && value!=null && !value.trim().equals("")) {
          Resource o = m.createResource(addFragment(ctx.getBaseMap(), value.trim()).toString());
          stmt = m.createStatement(subject,prop,o);
        }
        else stmt = schema.toRDFStatement(subject, elem, prop, value, type, ctx);
      }
    }
View Full Code Here


      }
    }
    else if (t instanceof complexType) {
      // look for a global ID
      String id = ((complexType) t).getID(elem,ctx);
      Resource o = id==null?m.createResource():m.createResource(addFragment(ctx.getBaseMap(), id).toString());
      stmt = m.createStatement(subject,prop,o);
      // the new resource, o, becomes the subject
      if (is_nillable() && elem.hasAttributeNS(schema.XSI,"nil") && elem.getAttributeNS(schema.XSI,"nil").equals("true"))
        o.addProperty(RDF.value,RDF.nil);
View Full Code Here

      }
    }
    else if (t instanceof complexType) {
      // look for a global ID
      String id = ((complexType) t).getID(elem,ctx);
      Resource o = id==null?m.createResource():m.createResource(addFragment(ctx.getBaseMap(), id).toString());
      stmt = m.createStatement(subject,prop,o);
      // the new resource, o, becomes the subject
      if (is_nillable() && elem.hasAttributeNS(schema.XSI,"nil") && elem.getAttributeNS(schema.XSI,"nil").equals("true"))
        o.addProperty(RDF.value,RDF.nil);
View Full Code Here

    }
    else if (type==null){ // empty
      if (is_nillable() && elem.hasAttributeNS(schema.XSI,"nil") && elem.getAttributeNS(schema.XSI,"nil").equals("true"))
        stmt = m.createStatement(subject,prop,RDF.nil);
      // link to anonymous resource
      else stmt = m.createStatement(subject,prop,m.createResource());
    }

    // if the statement was boxed, only add the link to the box
    if (stmt !=null) {
      m.add(stmt);
View Full Code Here

 
  public void testExtractConfig() throws SQLException, ClassNotFoundException
  {
    Model config = ExtractConfig.process("jdbc:hsqldb:mem:test", "org.hsqldb.jdbcDriver", "urn:ex:", "sa", "", new String[]{"TABLE1", "TABLE2"}, conn.getMetaData());
   
    Resource table1 = config.createResource("urn:ex:TABLE1");
    Resource table2 = config.createResource("urn:ex:TABLE2");
    Resource map = config.createResource("urn:ex:map");
    assertTrue("Found table1", config.contains(table1, RDF.type, RDFS.Class));
    assertTrue("Found table2", config.contains(table2, RDF.type, RDFS.Class));
    assertTrue("Map maps table1", config.contains(map, DbMap.mapsClass, table1));
View Full Code Here

  public void testExtractConfig() throws SQLException, ClassNotFoundException
  {
    Model config = ExtractConfig.process("jdbc:hsqldb:mem:test", "org.hsqldb.jdbcDriver", "urn:ex:", "sa", "", new String[]{"TABLE1", "TABLE2"}, conn.getMetaData());
   
    Resource table1 = config.createResource("urn:ex:TABLE1");
    Resource table2 = config.createResource("urn:ex:TABLE2");
    Resource map = config.createResource("urn:ex:map");
    assertTrue("Found table1", config.contains(table1, RDF.type, RDFS.Class));
    assertTrue("Found table2", config.contains(table2, RDF.type, RDFS.Class));
    assertTrue("Map maps table1", config.contains(map, DbMap.mapsClass, table1));
   
View Full Code Here

  {
    Model config = ExtractConfig.process("jdbc:hsqldb:mem:test", "org.hsqldb.jdbcDriver", "urn:ex:", "sa", "", new String[]{"TABLE1", "TABLE2"}, conn.getMetaData());
   
    Resource table1 = config.createResource("urn:ex:TABLE1");
    Resource table2 = config.createResource("urn:ex:TABLE2");
    Resource map = config.createResource("urn:ex:map");
    assertTrue("Found table1", config.contains(table1, RDF.type, RDFS.Class));
    assertTrue("Found table2", config.contains(table2, RDF.type, RDFS.Class));
    assertTrue("Map maps table1", config.contains(map, DbMap.mapsClass, table1));
   
    config.write(System.out, "RDF/XML-ABBREV");
View Full Code Here

 
  public static void noSchemaToRDF(Element elem, URI uri, Context ctx) throws Exception {
    Model m = ctx.getModel();
    // create a root resource with optional uri
    Resource rez;
    if (uri != null) rez = m.createResource(uri.toString());
    //  anonymous resource
    else rez = m.createResource();
    // the document element is unsequenced
    noSchemaToRDF(rez, elem, null, ctx);
  }
View Full Code Here

    Model m = ctx.getModel();
    // create a root resource with optional uri
    Resource rez;
    if (uri != null) rez = m.createResource(uri.toString());
    //  anonymous resource
    else rez = m.createResource();
    // the document element is unsequenced
    noSchemaToRDF(rez, elem, null, ctx);
  }

  public static boolean noSchemaToRDF(Resource subject, Element elem, Seq seq, Context ctx)
View Full Code Here

      // looks like a complex type
     
      Resource obj = null;
      if (elem.hasAttributeNS(XML,"id")) {
        String id = elem.getAttributeNS(XML,"id");
        obj = m.createResource(addFragment(ctx.getBaseMap(), id).toString());
      }
      else obj = m.createResource();
     
      // explicit xsi:type
      if (elem.hasAttributeNS(schema.XSI,"type")) {
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.