本文整理匯總了Java中com.hp.hpl.jena.query.Dataset.listNames方法的典型用法代碼示例。如果您正苦於以下問題:Java Dataset.listNames方法的具體用法?Java Dataset.listNames怎麽用?Java Dataset.listNames使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.hp.hpl.jena.query.Dataset
的用法示例。
在下文中一共展示了Dataset.listNames方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getAllEntityEvents
import com.hp.hpl.jena.query.Dataset; //導入方法依賴的package包/類
static ArrayList<String> getAllEntityEvents (Dataset dataset, String entity) {
ArrayList<String> events = new ArrayList<String>();
Iterator<String> it = dataset.listNames();
while (it.hasNext()) {
String name = it.next();
if (!name.equals(instanceGraph) && (!name.equals(provenanceGraph))) {
Model namedModel = dataset.getNamedModel(name);
StmtIterator siter = namedModel.listStatements();
while (siter.hasNext()) {
Statement s = siter.nextStatement();
String object = getObjectValue(s).toLowerCase();
if (object.indexOf(entity.toLowerCase()) > -1) {
String subject = s.getSubject().getURI();
if (!events.contains(subject)) {
events.add(subject);
}
}
}
}
}
return events;
}
示例2: loadFile
import com.hp.hpl.jena.query.Dataset; //導入方法依賴的package包/類
private static void loadFile(File fileOrFolder){
if (fileOrFolder.isHidden()) return ;
if (fileOrFolder.getPath().endsWith(".trig")){
Dataset _ds = RDFDataMgr.loadDataset(fileOrFolder.getPath());
Iterator<String> iter = _ds.listNames();
while (iter.hasNext()){
String name = iter.next();
d.addNamedModel(name, _ds.getNamedModel(name));
}
d.getDefaultModel().add(_ds.getDefaultModel());
}
if (fileOrFolder.isDirectory()){
File[] listOfFiles = fileOrFolder.listFiles();
for(File file : listOfFiles){
loadFile(file);
}
}
}
示例3: readSemTrig
import com.hp.hpl.jena.query.Dataset; //導入方法依賴的package包/類
static public HashMap<String, String> readSemTrig (ArrayList<String> eventIdentifierArray,String trigFolder) {
HashMap<String, String> tokenIdMap = new HashMap<String, String>();
ArrayList<File> trigFiles = Util.makeRecursiveFileList(new File(trigFolder), ".trig");
// System.out.println("trigFiles.size() = " + trigFiles.size());
for (int i = 0; i < trigFiles.size(); i++) {
File file = trigFiles.get(i);
Dataset dataset = TDBFactory.createDataset();
dataset = RDFDataMgr.loadDataset(file.getAbsolutePath());
Iterator<String> it = dataset.listNames();
while (it.hasNext()) {
String name = it.next();
if (name.equals(instanceGraph)) {
Model namedModel = dataset.getNamedModel(name);
StmtIterator siter = namedModel.listStatements();
while (siter.hasNext()) {
Statement s = siter.nextStatement();
updateTokenMap(eventIdentifierArray, tokenIdMap, s);
}
}
}
dataset.close();
}
return tokenIdMap;
}
示例4: getAllEsoEvents
import com.hp.hpl.jena.query.Dataset; //導入方法依賴的package包/類
static ArrayList<String> getAllEsoEvents (Dataset dataset, ArrayList<String> esoTypes) {
ArrayList<String> events = new ArrayList<String>();
Iterator<String> it = dataset.listNames();
while (it.hasNext()) {
String name = it.next();
if (name.equals(instanceGraph)) {
Model namedModel = dataset.getNamedModel(name);
StmtIterator siter = namedModel.listStatements();
while (siter.hasNext()) {
Statement s = siter.nextStatement();
// System.out.println("s.toString() = " + s.toString());
if (s.getPredicate().toString().endsWith("#type")) {
for (int i = 0; i < esoTypes.size(); i++) {
String esoType = esoTypes.get(i);
if (s.getObject().toString().endsWith(esoType)) {
String subject = s.getSubject().getURI();
if (!events.contains(subject)) {
events.add(subject);
}
break;
}
}
}
}
}
}
return events;
}
示例5: loadFile
import com.hp.hpl.jena.query.Dataset; //導入方法依賴的package包/類
private void loadFile(File fileOrFolder){
if (fileOrFolder.isHidden()) return ;
if (fileOrFolder.getPath().contains("quality-meta-data.trig")){
Dataset _ds = RDFDataMgr.loadDataset(fileOrFolder.getPath());
String baseURI = fileOrFolder.getParent();
baseURI = baseURI.replace(metadataBaseDir, "");
Iterator<String> iter = _ds.listNames();
while (iter.hasNext()){
String name = iter.next();
d.addNamedModel(name, _ds.getNamedModel(name));
dsToQG.put(baseURI, name);
qualityGraphToDS.put(name, baseURI);
}
d.getDefaultModel().add(_ds.getDefaultModel());
}
if (fileOrFolder.isDirectory()){
File[] listOfFiles = fileOrFolder.listFiles();
for(File file : listOfFiles){
loadFile(file);
}
}
}