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


Java DataObjectFactory類代碼示例

本文整理匯總了Java中org.wikidata.wdtk.datamodel.interfaces.DataObjectFactory的典型用法代碼示例。如果您正苦於以下問題:Java DataObjectFactory類的具體用法?Java DataObjectFactory怎麽用?Java DataObjectFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DataObjectFactory類屬於org.wikidata.wdtk.datamodel.interfaces包,在下文中一共展示了DataObjectFactory類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getSiteInformation

import org.wikidata.wdtk.datamodel.interfaces.DataObjectFactory; //導入依賴的package包/類
@Test
public void getSiteInformation() throws IOException {
	Path dumpFilePath = this.dmPath.resolve("dumpfiles").resolve(
			"wikidatawiki");
	Path thisDumpPath = dumpFilePath.resolve(DumpContentType.SITES
			.toString().toLowerCase() + "-" + "20140420");
	dm.setDirectory(dumpFilePath);
	dm.setDirectory(thisDumpPath);

	URL resourceUrl = this.getClass().getResource(
			"/wikidatawiki-20140420-sites.sql");
	Path filePath = thisDumpPath.resolve("wikidatawiki-" + "20140420"
			+ WmfDumpFile.getDumpFilePostfix(DumpContentType.SITES));
	dm.setFileContents(filePath, MockStringContentFactory.getStringFromUrl(resourceUrl),
			WmfDumpFile.getDumpFileCompressionType(filePath.toString()));

	this.dpc.setOfflineMode(true);

	DataObjectFactory factory = new DataObjectFactoryImpl();
	SiteLink siteLink = factory.getSiteLink("Douglas Adams", "dewiki",
			Collections.<String> emptyList());

	Sites sites = this.dpc.getSitesInformation();

	assertEquals("en", sites.getLanguageCode("enwikivoyage"));
	// Test sites with protocol-relative URLs:
	assertEquals(SitesImpl.DEFAULT_PROTOCOL_PREFIX
			+ "//de.wikipedia.org/wiki/Douglas_Adams",
			sites.getSiteLinkUrl(siteLink));
	assertEquals(
			SitesImpl.DEFAULT_PROTOCOL_PREFIX
					+ "//ar.wikipedia.org/wiki/%D8%AF%D9%88%D8%BA%D9%84%D8%A7%D8%B3_%D8%A2%D8%AF%D9%85%D8%B2",
			sites.getPageUrl("arwiki", "دوغلاس_آدمز"));
	assertEquals(SitesImpl.DEFAULT_PROTOCOL_PREFIX
			+ "//en.wikipedia.org/w/api.php",
			sites.getFileUrl("enwiki", "api.php"));

	// Site with explicit http URL:
	assertEquals("http://aa.wikipedia.org/wiki/Test",
			sites.getPageUrl("aawiki", "Test"));

}
 
開發者ID:Wikidata,項目名稱:Wikidata-Toolkit,代碼行數:43,代碼來源:SitesTest.java

示例2: DatamodelConverter

import org.wikidata.wdtk.datamodel.interfaces.DataObjectFactory; //導入依賴的package包/類
/**
 * Constructor.
 *
 * @param dataObjectFactory
 *            the factory to use for creating new objects
 */
public DatamodelConverter(DataObjectFactory dataObjectFactory) {
	this.dataObjectFactory = dataObjectFactory;
}
 
開發者ID:Wikidata,項目名稱:Wikidata-Toolkit,代碼行數:10,代碼來源:DatamodelConverter.java


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