當前位置: 首頁>>代碼示例>>Java>>正文


Java Dataset.listNames方法代碼示例

本文整理匯總了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;
}
 
開發者ID:newsreader,項目名稱:StreamEventCoreference,代碼行數:23,代碼來源:TrigUtil.java

示例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);
		}
	}
}
 
開發者ID:EIS-Bonn,項目名稱:Luzzu,代碼行數:21,代碼來源:Facets.java

示例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;
}
 
開發者ID:cltl,項目名稱:coreference-evaluation,代碼行數:26,代碼來源:SemCoref.java

示例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;
}
 
開發者ID:newsreader,項目名稱:StreamEventCoreference,代碼行數:29,代碼來源:GetEventStats.java

示例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);
		}
	}
}
 
開發者ID:EIS-Bonn,項目名稱:Luzzu,代碼行數:28,代碼來源:DatasetLoader.java


注:本文中的com.hp.hpl.jena.query.Dataset.listNames方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。