本文整理汇总了Java中org.apache.jena.riot.RDFDataMgr.loadDataset方法的典型用法代码示例。如果您正苦于以下问题:Java RDFDataMgr.loadDataset方法的具体用法?Java RDFDataMgr.loadDataset怎么用?Java RDFDataMgr.loadDataset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jena.riot.RDFDataMgr
的用法示例。
在下文中一共展示了RDFDataMgr.loadDataset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.apache.jena.riot.RDFDataMgr; //导入方法依赖的package包/类
@Before
public void setUp() throws IOException, RepositoryException {
tdb = RDFDataMgr.loadDataset( loadfile.toString() );
instance = new JenaEngine( tdb );
}
示例2: main
import org.apache.jena.riot.RDFDataMgr; //导入方法依赖的package包/类
static public void main (String[] args) {
String trigfolderPath = "";
trigfolderPath = "/Users/piek/Desktop/tweede-kamer/events";
String entity = "";
String date = "";
entity = "lippens";
for (int i = 0; i < args.length; i++) {
String arg = args[i];
if (arg.equals("--trig-folder") && args.length>(i+1)) {
trigfolderPath = args[i+1];
}
else if (arg.equals("--entity") && args.length>(i+1)) {
entity = args[i+1];
}
else if (arg.equals("--event-date") && args.length>(i+1)) {
date = args[i+1];
}
}
if (entity.isEmpty()) {
System.out.println("Entity is empty");
return;
}
File trigfolder = new File(trigfolderPath);
String trigEntityPath = trigfolder.getParent()+"/"+entity;
File entityTrigFolder = new File (trigEntityPath);
if (!entityTrigFolder.exists()) {
entityTrigFolder.mkdir();
}
if (!entityTrigFolder.exists()) {
System.out.println("Could not create entity trig folder");
return;
}
dataset = TDBFactory.createDataset();
ArrayList<File> trigFiles = Util.makeRecursiveFileList(trigfolder, ".trig");
System.out.println(trigfolder.getName() + " trigFiles.size() = " + trigFiles.size());
int cnt = 1;
for (int i = 0; i < trigFiles.size(); i++) {
File file = trigFiles.get(i);
if (!file.getParentFile().getName().startsWith(date)) {
continue;
}
if (i%500==0) {
System.out.println("i = " + i);
// if (i>1000) break;
}
ArrayList<String> events = new ArrayList<String>();
dataset = RDFDataMgr.loadDataset(file.getAbsolutePath());
Model namedModel = dataset.getNamedModel(TrigUtil.instanceGraph);
StmtIterator siter = namedModel.listStatements();
while (siter.hasNext()) {
Statement s = siter.nextStatement();
String subject = s.getSubject().getURI().toLowerCase();
if (subject.indexOf(entity.toLowerCase())>-1) {
String trigName = trigEntityPath+"/"+cnt+"_"+file.getName();
File trigCopy = new File(trigName);
copyFile(file, trigCopy);
cnt++;
break;
}
}
dataset = null;
}
}