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


Java ModelFactory.createModelForGraph方法代碼示例

本文整理匯總了Java中com.hp.hpl.jena.rdf.model.ModelFactory.createModelForGraph方法的典型用法代碼示例。如果您正苦於以下問題:Java ModelFactory.createModelForGraph方法的具體用法?Java ModelFactory.createModelForGraph怎麽用?Java ModelFactory.createModelForGraph使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.hp.hpl.jena.rdf.model.ModelFactory的用法示例。


在下文中一共展示了ModelFactory.createModelForGraph方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: reload

import com.hp.hpl.jena.rdf.model.ModelFactory; //導入方法依賴的package包/類
private void reload() {
	loader.getMapping().connect();
	GraphD2RQ graph = loader.getGraphD2RQ();
	
	datasetGraph = DatasetGraphFactory.createOneGraph(graph);
	defaultModel = ModelFactory.createModelForGraph(datasetGraph.getDefaultGraph());		

	hasTruncatedResults = false;
	for (Database db: loader.getMapping().databases()) {
		if (db.getResultSizeLimit() != Database.NO_LIMIT) {
			hasTruncatedResults = true;
		}
	}

	if (autoReload) {
		lastModified = watchedFile.lastModified();
		lastReload = System.currentTimeMillis();
	}
}
 
開發者ID:aitoralmeida,項目名稱:c4a_data_repository,代碼行數:20,代碼來源:AutoReloadableDataset.java

示例2: LimayeGroundtruthAnnotationParser

import com.hp.hpl.jena.rdf.model.ModelFactory; //導入方法依賴的package包/類
public LimayeGroundtruthAnnotationParser(Table table) {
		this.table = table;
		this.cellAnnotation = false;
		this.columnAnnotation = false;
		this.columnNr = 0;
		this.column = -1;
		this.row = -1;
		this.currentValue = new StringBuilder();
		HDT hdt = null;
		HDT hdt_l = null;
//		HDT hdt_d = null;
		try {
			hdt = HDTManager.mapIndexedHDT(REDIRECTS, null);
			hdt_l = HDTManager.mapIndexedHDT(LABELS, null);
//			hdt_d = HDTManager.mapIndexedHDT(TYPES, null);
		} catch (IOException e) {
			e.printStackTrace();
		}
		HDTGraph graph = new HDTGraph(hdt);
		m = ModelFactory.createModelForGraph(graph);
//		graph = new HDTGraph(hdt_d);
//		m_d = ModelFactory.createModelForGraph(graph);
		graph = new HDTGraph(hdt_l);
		m_l = ModelFactory.createModelForGraph(graph);

	}
 
開發者ID:quhfus,項目名稱:DoSeR,代碼行數:27,代碼來源:LimayeGroundtruthAnnotationParser.java

示例3: main

import com.hp.hpl.jena.rdf.model.ModelFactory; //導入方法依賴的package包/類
public static void main(String[] args) {
	HDT hdt = null;
	try {
		hdt = HDTManager.mapIndexedHDT(TYPES, null);
	} catch (IOException e) {
		e.printStackTrace();
	}
	
	HDTGraph graph = new HDTGraph(hdt);
	Model m = ModelFactory.createModelForGraph(graph);
	StmtIterator iter = m.listStatements();
	HashMap<String, Integer> hash = new HashMap<String, Integer>();
	int number = 0;
	while (iter.hasNext()) {
		if (number % 50000 == 0) {
			System.out.println("Processed Entries: " + number);
		}
		Statement stmt = iter.next();
		RDFNode object = stmt.getObject();
		String s = null;
		s = object.asResource().getURI();
		hash.put(s, 0);
		number++;
	}
	System.out.println("Anzahl an Typen: " +hash.size());
}
 
開發者ID:quhfus,項目名稱:DoSeR,代碼行數:27,代碼來源:CountYago2sTypes.java

示例4: MainEvaluation

import com.hp.hpl.jena.rdf.model.ModelFactory; //導入方法依賴的package包/類
public MainEvaluation(String maindir) {
	File maind = new File(maindir);
	HDT redirectsHDT;
	try {
		redirectsHDT = HDTManager.mapIndexedHDT("/home/quh/dbpedia_redirects.hdt", null);
		final HDTGraph redirectsHDTgraph = new HDTGraph(redirectsHDT);
		this.redirects = ModelFactory.createModelForGraph(redirectsHDTgraph);
	} catch (IOException e) {
		e.printStackTrace();
	}
	evaluate(maind);
}
 
開發者ID:quhfus,項目名稱:DoSeR,代碼行數:13,代碼來源:MainEvaluation.java

示例5: CreateDBPediaIndex

import com.hp.hpl.jena.rdf.model.ModelFactory; //導入方法依賴的package包/類
CreateDBPediaIndex() {
	super();
	this.LABELS = new HashMap<String, HashSet<String>>();
	this.UNIQUELABELSTRINGS = new HashMap<String, HashSet<String>>();
	this.OCCURRENCES = new HashMap<String, HashMap<String, Integer>>();
	this.relationmap = new HashMap<String, LinkedList<String>>();
	this.pattymap = new HashMap<String, LinkedList<String>>();
	this.pattyfreebasemap = new HashMap<String, LinkedList<String>>();
	this.evidencemap = new HashMap<String, HashSet<String>>();
	HDT labelhdt;
	HDT shortdeschdt;
	HDT longdeschdt;
	try {
		labelhdt = HDTManager.mapIndexedHDT(LABELHDT, null);
		shortdeschdt = HDTManager.mapIndexedHDT(SHORTDESCHDT, null);
		longdeschdt = HDTManager.mapIndexedHDT(LONGDESCHDT, null);
		final HDTGraph labelhdtgraph = new HDTGraph(labelhdt);
		final HDTGraph shortdeschdtgraph = new HDTGraph(shortdeschdt);
		final HDTGraph longdeschdtgraph = new HDTGraph(longdeschdt);
		this.labelmodel = ModelFactory.createModelForGraph(labelhdtgraph);
		this.shortdescmodel = ModelFactory
				.createModelForGraph(shortdeschdtgraph);
		this.longdescmodel = ModelFactory
				.createModelForGraph(longdeschdtgraph);
	} catch (IOException e) {
		e.printStackTrace();
	}
	this.counter = 0;
}
 
開發者ID:quhfus,項目名稱:DoSeR,代碼行數:30,代碼來源:CreateDBPediaIndex.java

示例6: Test1

import com.hp.hpl.jena.rdf.model.ModelFactory; //導入方法依賴的package包/類
public Test1() {
	HDT mappingbasedproperties;
	try {
		mappingbasedproperties = HDTManager.mapIndexedHDT(
				MAPPINGPROPERTIESHDT, null);
		final HDTGraph instancemappingtypesgraph = new HDTGraph(
				mappingbasedproperties);
		this.mappingbasedproperties = ModelFactory
				.createModelForGraph(instancemappingtypesgraph);
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
開發者ID:quhfus,項目名稱:DoSeR,代碼行數:14,代碼來源:Test1.java

示例7: DataRdfizer

import com.hp.hpl.jena.rdf.model.ModelFactory; //導入方法依賴的package包/類
public static void DataRdfizer(String arg[]) throws FileNotFoundException, JSONException, IOException {
    model = ModelFactory.createModelForGraph(graph) ;
    modelReadRDF();
}
 
開發者ID:YourDataStories,項目名稱:harvesters,代碼行數:5,代碼來源:DataRdfizer.java

示例8: getModelD2RQ

import com.hp.hpl.jena.rdf.model.ModelFactory; //導入方法依賴的package包/類
public Model getModelD2RQ() {
	if (dataModel == null) {
		dataModel = ModelFactory.createModelForGraph(getGraphD2RQ());
	}
	return dataModel;
}
 
開發者ID:d2rq,項目名稱:r2rml-kit,代碼行數:7,代碼來源:SystemLoader.java

示例9: init

import com.hp.hpl.jena.rdf.model.ModelFactory; //導入方法依賴的package包/類
protected void init() throws IOException
{
    JenaAdapter adapter = new JenaAdapter();

    context = new QueryContext();
    context.init();

    adapter.init(context);

    Model model = ModelFactory.createModelForGraph(adapter);

    dataset = DatasetFactory.create(model);

    JenaAdapter rAdapter = new JenaAdapter();

    rContext = new QueryReifiedContext();
    rContext.init();

    rAdapter.init(rContext);

    Model rModel = ModelFactory.createModelForGraph(rAdapter);

    rDataset = DatasetFactory.create(rModel);
}
 
開發者ID:daedafusion,項目名稱:knowledge,代碼行數:25,代碼來源:QueryEngine.java

示例10: action

import com.hp.hpl.jena.rdf.model.ModelFactory; //導入方法依賴的package包/類
public void action() {
	HDT hdt = null;
	HDT hdt_l = null;
	HDT hdt_d = null;
	Model m = null;
	Model m_l = null;
	Model m_d = null;
	try {
		hdt = HDTManager.mapIndexedHDT(REDIRECTS, null);
		hdt_l = HDTManager.mapIndexedHDT(LABELS, null);
		// hdt_d = HDTManager.mapIndexedHDT(TYPES, null);
	} catch (IOException e) {
		e.printStackTrace();
	}
	HDTGraph graph = new HDTGraph(hdt);
	m = ModelFactory.createModelForGraph(graph);
	graph = new HDTGraph(hdt_l);
	m_l = ModelFactory.createModelForGraph(graph);
	File file = new File("/home/quh/Arbeitsfläche/Table Disambiguation Data sets/LimayeAll/all_tables_raw(regen)/");
	File[] f = file.listFiles();
	int cellsOverall = 0;
	int cellsAnnotated = 0;

	for (int u = 0; u < f.length; u++) {
		// System.out.println(f[u].getAbsolutePath());
		StartEvaluationTableEntities eval = new StartEvaluationTableEntities();
		String sourcePath = f[u].getAbsolutePath();

		Table t = eval.readTable(f[u].getAbsolutePath(), m, m_l, m_d);
		if (t != null) {
			int cols = t.getNumberofColumns();
			for (int i = 0; i < cols; i++) {
				Column col = t.getColumn(i);
				List<Cell> cellL = col.getCellList();
				List<String> types = col.getMajorTypes();
				cellsOverall++;
				// if(types != null && types.size() > 0) {
				// cellsAnnotated++;
				// }
				for (Cell c : cellL) {
					cellsOverall++;
					if (c.getGt() != null && !c.getGt().equalsIgnoreCase("")) {
						cellsAnnotated++;
					}
				}
			}

			System.out.println("Zellen insgesamt: " + cellsOverall + " Zellen annotiert: " + cellsAnnotated);

			// Query each column separately
			for (int i = 0; i < t.getNumberofColumns(); i++) {
				Column column = t.getColumn(i);
				List<EntityDisambiguationDPO> request_dpo = eval.transformInRequestFormat(column);
				String topic = column.getHeader();
				List<Response> l = queryService(request_dpo, topic);
				setDisambiguatedColumn(t, i, l);
			}

			StartEvaluationTableEntities.evaluateResults(t);
		}
	}
	System.out.println("Insgesamt: " + sum + " davon richtig: " + correct);
}
 
開發者ID:quhfus,項目名稱:DoSeR,代碼行數:64,代碼來源:StartEvaluationTableEntities.java

示例11: CreateDBpediaIndexV2

import com.hp.hpl.jena.rdf.model.ModelFactory; //導入方法依賴的package包/類
public CreateDBpediaIndexV2() {
	super();
	this.relationmap = new HashMap<String, LinkedList<String>>();
	this.pattymap = new HashMap<String, LinkedList<String>>();
	this.pattyfreebasemap = new HashMap<String, LinkedList<String>>();

	this.OCCURRENCES = new HashMap<String, HashMap<String, Integer>>();

	this.LABELS = new HashMap<String, HashSet<String>>();
	this.UNIQUELABELSTRINGS = new HashMap<String, HashSet<String>>();
	this.DBPEDIAGRAPHINLINKS = new HashMap<String, Integer>();
	this.evidences = new HashMap<String, String>();
	this.teams = new HashSet<String>();

	this.urlentitymapping = new HashMap<String, String>();

	this.entities = new HashSet<String>();

	this.counter = 0;

	HDT labelhdt;
	HDT shortdeschdt;
	HDT longdeschdt;
	HDT mappingbasedproperties;
	HDT instancemappingtypeshdt;
	try {
		labelhdt = HDTManager.mapIndexedHDT(LABELHDT, null);
		shortdeschdt = HDTManager.mapIndexedHDT(SHORTDESCHDT, null);
		longdeschdt = HDTManager.mapIndexedHDT(LONGDESCHDT, null);
		mappingbasedproperties = HDTManager.mapIndexedHDT(PERSONDATAHDT, null);
		instancemappingtypeshdt = HDTManager.mapIndexedHDT(INSTANCEMAPPINGTYPES, null);
		final HDTGraph labelhdtgraph = new HDTGraph(labelhdt);
		final HDTGraph shortdeschdtgraph = new HDTGraph(shortdeschdt);
		final HDTGraph longdeschdtgraph = new HDTGraph(longdeschdt);
		final HDTGraph instancepersondata = new HDTGraph(mappingbasedproperties);
		final HDTGraph instancemappingtypesgraph = new HDTGraph(instancemappingtypeshdt);
		this.labelmodel = ModelFactory.createModelForGraph(labelhdtgraph);
		this.shortdescmodel = ModelFactory.createModelForGraph(shortdeschdtgraph);
		this.longdescmodel = ModelFactory.createModelForGraph(longdeschdtgraph);
		this.persondata = ModelFactory.createModelForGraph(instancepersondata);
		this.instancemappingtypes = ModelFactory.createModelForGraph(instancemappingtypesgraph);
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
開發者ID:quhfus,項目名稱:DoSeR,代碼行數:46,代碼來源:CreateDBpediaIndexV2.java


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