本文整理汇总了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"));
}
示例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;
}