本文整理汇总了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());
}
}
}
示例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());
// }
// }
}
示例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());
// }
// }
}
示例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());
}
}
}
示例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());
// }
// }
}
示例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());
// }
// }
}
示例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);
}
示例8: getTDBModel
import com.hp.hpl.jena.tdb.TDBFactory; //导入方法依赖的package包/类
public static Model getTDBModel(String path) {
Model m = TDBFactory.createModel(path);
return m;
}
示例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());
}
}
}