当前位置: 首页>>代码示例>>Java>>正文


Java TDBFactory.createModel方法代码示例

本文整理汇总了Java中com.hp.hpl.jena.tdb.TDBFactory.createModel方法的典型用法代码示例。如果您正苦于以下问题:Java TDBFactory.createModel方法的具体用法?Java TDBFactory.createModel怎么用?Java TDBFactory.createModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.hp.hpl.jena.tdb.TDBFactory的用法示例。


在下文中一共展示了TDBFactory.createModel方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test_generateRdfs_clinical_trials

import com.hp.hpl.jena.tdb.TDBFactory; //导入方法依赖的package包/类
/**
 * Run the RDF generator pipeline for clinical trial data Before running
 * this, run the Mapping Discovery Test first to generate the mapping file
 * for clinical trials.
 *
 * @throws SAXException
 * @throws IOException
 * @throws ParserConfigurationException
 */
@Test
public void test_generateRdfs_clinical_trials() throws SAXException, IOException, ParserConfigurationException {
    // Setup deserializer
    mappingDeserialization = new XmlBasedMappingDeserialization(
            new FileInputStream("output/clinicaltrials-mapping.xml"), parser);

    Document dataDocument = parser.parse(RdfGeneratorTest2.class.getResourceAsStream(
            "/clinicaltrials/data/content.xml"), 10);
    rdfGenerator = new RdfGenerator(new DataDocument(dataDocument), new XmlBasedMapping());

    // Add steps
    rdfGenerator.addStep(mappingDeserialization);
    rdfGenerator.addStep(rdfGeneration);

    // Generate
    rdfGenerator.generateRdfs();

    // Verify
    Model model = TDBFactory.createModel(testTdbDir);
    Assert.assertFalse("No RDF was generated. TDB directory: " + testTdbDir, model.isEmpty());

    ResIterator iter = model.listResourcesWithProperty(RDF.type);
    while (iter.hasNext()) {
        Resource resource = iter.nextResource();
        System.out.println(resource.getLocalName());
        StmtIterator iterStm = resource.listProperties();
        while (iterStm.hasNext()) {
            System.out.println(iterStm.nextStatement().toString());
        }
    }
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:41,代码来源:RdfGeneratorTest2.java

示例2: test_generateRdfs_fb_XBRL

import com.hp.hpl.jena.tdb.TDBFactory; //导入方法依赖的package包/类
@Test
    // Run test_discoverMapping_fb_XBRL to generate the mapping file before running
    // this test.
    public void test_generateRdfs_fb_XBRL() throws SAXException, IOException, ParserConfigurationException {
        // Setup deserializer
        mappingDeserialization = new XmlBasedMappingDeserialization(
                new FileInputStream("output/fb-20121231-mapping.xml"), parser);

        Document dataDocument = parser.parse(RdfGeneratorTest2.class.getResourceAsStream(
                "/secxbrls/data/fb-20121231.xml"), -1);
        rdfGenerator = new RdfGenerator(new DataDocument(dataDocument), new XmlBasedMapping());

        // Add steps
        rdfGenerator.addStep(mappingDeserialization);
        rdfGenerator.addStep(rdfGeneration);

        // Generate
        rdfGenerator.generateRdfs();

        // Verify
        Model model = TDBFactory.createModel(testTdbDir);
        Assert.assertFalse("No RDF was generated. TDB directory: " + testTdbDir, model.isEmpty());

        Resource r = model.getResource("http://example.org/resource/class/unitNumerator");
        // Failing, investigate
        Assert.assertTrue(r.hasProperty(model.getProperty("http://example.org/resource/property/measure")));

//    ResIterator iter = model.listResourcesWithProperty(RDF.type);
//    while (iter.hasNext()) {
//      Resource resource = iter.nextResource();
//      System.out.println(resource.getLocalName());
//      StmtIterator iterStm = resource.listProperties();
//      while (iterStm.hasNext()) {
//        System.out.println(iterStm.nextStatement().toString());
//      }
//    }
    }
 
开发者ID:xcurator,项目名称:xcurator,代码行数:38,代码来源:RdfGeneratorTest2.java

示例3: test_generateRdfs_msft_XBRL

import com.hp.hpl.jena.tdb.TDBFactory; //导入方法依赖的package包/类
@Test
    // Run test_discoverMapping_XBRL_msft to generate the mapping file before running
    // this test.
    public void test_generateRdfs_msft_XBRL() throws SAXException, IOException, ParserConfigurationException {
        // Setup deserializer
        mappingDeserialization = new XmlBasedMappingDeserialization(
                new FileInputStream("output/msft-20130630-mapping.xml"), parser);

        Document dataDocument = parser.parse(RdfGeneratorTest2.class.getResourceAsStream(
                "/secxbrls/data/msft-20130630.xml"), -1);
        rdfGenerator = new RdfGenerator(new DataDocument(dataDocument), new XmlBasedMapping());

        // Add steps
        rdfGenerator.addStep(mappingDeserialization);
        rdfGenerator.addStep(rdfGeneration);

        // Generate
        rdfGenerator.generateRdfs();

        // Verify
        Model model = TDBFactory.createModel(testTdbDir);
        Assert.assertFalse("No RDF was generated. TDB directory: " + testTdbDir, model.isEmpty());

        Resource r = model.getResource("http://example.org/resource/class/unitNumerator");
        // Failing, investigate
        Assert.assertTrue(r.hasProperty(model.getProperty("http://example.org/resource/property/measure")));

//    ResIterator iter = model.listResourcesWithProperty(RDF.type);
//    while (iter.hasNext()) {
//      Resource resource = iter.nextResource();
//      System.out.println(resource.getLocalName());
//      StmtIterator iterStm = resource.listProperties();
//      while (iterStm.hasNext()) {
//        System.out.println(iterStm.nextStatement().toString());
//      }
//    }
    }
 
开发者ID:xcurator,项目名称:xcurator,代码行数:38,代码来源:RdfGeneratorTest2.java

示例4: test_generateRdfs_clinical_trials

import com.hp.hpl.jena.tdb.TDBFactory; //导入方法依赖的package包/类
/**
 * Run the RDF generator pipeline for clinical trial data Before running
 * this, run the Mapping Discovery Test first to generate the mapping file
 * for clinical trials.
 *
 * @throws SAXException
 * @throws IOException
 * @throws ParserConfigurationException
 */
@Test
public void test_generateRdfs_clinical_trials() throws SAXException, IOException, ParserConfigurationException {
    // Setup deserializer
    mappingDeserialization = new XmlBasedMappingDeserialization(
            new FileInputStream("output/clinicaltrials-mapping.xml"), parser);

    Document dataDocument = parser.parse(RdfGeneratorTest.class.getResourceAsStream(
            "/clinicaltrials/data/content.xml"), 10);
    rdfGenerator = new RdfGenerator(new DataDocument(dataDocument), new XmlBasedMapping());

    // Add steps
    rdfGenerator.addStep(mappingDeserialization);
    rdfGenerator.addStep(rdfGeneration);

    // Generate
    rdfGenerator.generateRdfs();

    // Verify
    Model model = TDBFactory.createModel(testTdbDir);
    Assert.assertFalse("No RDF was generated. TDB directory: " + testTdbDir, model.isEmpty());

    ResIterator iter = model.listResourcesWithProperty(RDF.type);
    while (iter.hasNext()) {
        Resource resource = iter.nextResource();
        System.out.println(resource.getLocalName());
        StmtIterator iterStm = resource.listProperties();
        while (iterStm.hasNext()) {
            System.out.println(iterStm.nextStatement().toString());
        }
    }
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:41,代码来源:RdfGeneratorTest.java

示例5: test_generateRdfs_fb_XBRL

import com.hp.hpl.jena.tdb.TDBFactory; //导入方法依赖的package包/类
@Test
    // Run test_discoverMapping_fb_XBRL to generate the mapping file before running
    // this test.
    public void test_generateRdfs_fb_XBRL() throws SAXException, IOException, ParserConfigurationException {
        // Setup deserializer
        mappingDeserialization = new XmlBasedMappingDeserialization(
                new FileInputStream("output/fb-20121231-mapping.xml"), parser);

        Document dataDocument = parser.parse(RdfGeneratorTest.class.getResourceAsStream(
                "/secxbrls/data/fb-20121231.xml"), -1);
        rdfGenerator = new RdfGenerator(new DataDocument(dataDocument), new XmlBasedMapping());

        // Add steps
        rdfGenerator.addStep(mappingDeserialization);
        rdfGenerator.addStep(rdfGeneration);

        // Generate
        rdfGenerator.generateRdfs();

        // Verify
        Model model = TDBFactory.createModel(testTdbDir);
        Assert.assertFalse("No RDF was generated. TDB directory: " + testTdbDir, model.isEmpty());

        Resource r = model.getResource("http://example.org/resource/class/unitNumerator");
        // Failing, investigate
        Assert.assertTrue(r.hasProperty(model.getProperty("http://example.org/resource/property/measure")));

//    ResIterator iter = model.listResourcesWithProperty(RDF.type);
//    while (iter.hasNext()) {
//      Resource resource = iter.nextResource();
//      System.out.println(resource.getLocalName());
//      StmtIterator iterStm = resource.listProperties();
//      while (iterStm.hasNext()) {
//        System.out.println(iterStm.nextStatement().toString());
//      }
//    }
    }
 
开发者ID:xcurator,项目名称:xcurator,代码行数:38,代码来源:RdfGeneratorTest.java

示例6: test_generateRdfs_msft_XBRL

import com.hp.hpl.jena.tdb.TDBFactory; //导入方法依赖的package包/类
@Test
    // Run test_discoverMapping_XBRL_msft to generate the mapping file before running
    // this test.
    public void test_generateRdfs_msft_XBRL() throws SAXException, IOException, ParserConfigurationException {
        // Setup deserializer
        mappingDeserialization = new XmlBasedMappingDeserialization(
                new FileInputStream("output/msft-20130630-mapping.xml"), parser);

        Document dataDocument = parser.parse(RdfGeneratorTest.class.getResourceAsStream(
                "/secxbrls/data/msft-20130630.xml"), -1);
        rdfGenerator = new RdfGenerator(new DataDocument(dataDocument), new XmlBasedMapping());

        // Add steps
        rdfGenerator.addStep(mappingDeserialization);
        rdfGenerator.addStep(rdfGeneration);

        // Generate
        rdfGenerator.generateRdfs();

        // Verify
        Model model = TDBFactory.createModel(testTdbDir);
        Assert.assertFalse("No RDF was generated. TDB directory: " + testTdbDir, model.isEmpty());

        Resource r = model.getResource("http://example.org/resource/class/unitNumerator");
        // Failing, investigate
        Assert.assertTrue(r.hasProperty(model.getProperty("http://example.org/resource/property/measure")));

//    ResIterator iter = model.listResourcesWithProperty(RDF.type);
//    while (iter.hasNext()) {
//      Resource resource = iter.nextResource();
//      System.out.println(resource.getLocalName());
//      StmtIterator iterStm = resource.listProperties();
//      while (iterStm.hasNext()) {
//        System.out.println(iterStm.nextStatement().toString());
//      }
//    }
    }
 
开发者ID:xcurator,项目名称:xcurator,代码行数:38,代码来源:RdfGeneratorTest.java

示例7: RdbToRdf

import com.hp.hpl.jena.tdb.TDBFactory; //导入方法依赖的package包/类
public RdbToRdf(String dir) throws ClassNotFoundException {

    if (!dir.endsWith("/")) {
      dir = dir + "/";
    }

    File f = new File(dir);

    if (!f.isDirectory()) {
      f.mkdir();
    }

    dir = dir + "TDB/";

    f = new File(dir);

    if (f.isDirectory()) {
      if (f.exists()) {
        String[] myfiles = f.list();
        if (myfiles.length > 0) {
          for (int i = 0; i < myfiles.length; i++) {
            File auxFile = new File(dir + myfiles[i]);
            auxFile.delete();
          }
        }
        f.delete();
      }
    }

    f.mkdir();

    model = TDBFactory.createModel(dir);
    model.setNsPrefix("geo", Constants.NSGEO);
    model.setNsPrefix("xsd", Constants.NSXSD);
  }
 
开发者ID:GeoKnow,项目名称:TripleGeo,代码行数:36,代码来源:RdbToRdf.java

示例8: getTDBModel

import com.hp.hpl.jena.tdb.TDBFactory; //导入方法依赖的package包/类
public static Model getTDBModel(String path) {
    Model m = TDBFactory.createModel(path);
    return m;
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:5,代码来源:JenaUtils.java

示例9: test_generateRdfs_multiple_XBRLs

import com.hp.hpl.jena.tdb.TDBFactory; //导入方法依赖的package包/类
@Test
// Run test_discoverMapping_multiple_XBRLs to generate the mapping file before running
// this test.
public void test_generateRdfs_multiple_XBRLs() throws SAXException, IOException, ParserConfigurationException {
    // Setup deserializer
    mappingDeserialization = new XmlBasedMappingDeserialization(
            new FileInputStream("output/xbrl-mapping.xml"), parser);

    Document fb2013 = parser.parse(BasicEntityDiscoveryTest.class.getResourceAsStream(
            "/secxbrls/data/fb-20131231.xml"), -1);

    Document msft2013 = parser.parse(BasicEntityDiscoveryTest.class.getResourceAsStream(
            "/secxbrls/data/msft-20130630.xml"), -1);

    Document goog2013 = parser.parse(BasicEntityDiscoveryTest.class.getResourceAsStream(
            "/secxbrls/data/goog-20131231.xml"), -1);

    rdfGenerator = new RdfGenerator(new XmlBasedMapping());

    // Add document and steps
    rdfGenerator.addDataDocument(new DataDocument(fb2013, "http://example.org/resource/fb-20131231"))
            .addDataDocument(new DataDocument(msft2013, "http://example.org/resource/msft-20130630"))
            .addDataDocument(new DataDocument(goog2013, "http://example.org/resource/goog-20131231"))
            .addStep(mappingDeserialization)
            .addStep(rdfGeneration);

    // Generate
    rdfGenerator.generateRdfs();

    // Verify
    Model model = TDBFactory.createModel(testTdbDir);
    Assert.assertFalse("No RDF was generated. TDB directory: " + testTdbDir, model.isEmpty());

    ResIterator iter = model.listResourcesWithProperty(RDF.type);
    while (iter.hasNext()) {
        Resource resource = iter.nextResource();
        System.out.println(resource.getLocalName());
        StmtIterator iterStm = resource.listProperties();
        while (iterStm.hasNext()) {
            System.out.println(iterStm.nextStatement().toString());
        }
    }

}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:45,代码来源:RdfGeneratorTest2.java


注:本文中的com.hp.hpl.jena.tdb.TDBFactory.createModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。