当前位置: 首页>>代码示例>>Java>>正文


Java PrefixMappingImpl.setNsPrefixes方法代码示例

本文整理汇总了Java中com.hp.hpl.jena.shared.impl.PrefixMappingImpl.setNsPrefixes方法的典型用法代码示例。如果您正苦于以下问题:Java PrefixMappingImpl.setNsPrefixes方法的具体用法?Java PrefixMappingImpl.setNsPrefixes怎么用?Java PrefixMappingImpl.setNsPrefixes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.hp.hpl.jena.shared.impl.PrefixMappingImpl的用法示例。


在下文中一共展示了PrefixMappingImpl.setNsPrefixes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testTriplePrettyPrintingWithPrefixMapping

import com.hp.hpl.jena.shared.impl.PrefixMappingImpl; //导入方法依赖的package包/类
@Test
public void testTriplePrettyPrintingWithPrefixMapping() {
	PrefixMappingImpl prefixes = new PrefixMappingImpl();
	prefixes.setNsPrefixes(PrefixMapping.Standard);
	prefixes.setNsPrefix("ex", "http://example.org/");
	assertEquals("ex:a rdfs:label \"Example\".",
			PrettyPrinter.toString(new Triple(
					Node.createURI("http://example.org/a"),
					RDFS.label.asNode(),
					Node.createLiteral("Example", null, null)), prefixes));
}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:12,代码来源:PrettyPrinterTest.java

示例2: testTriplePrettyPrintingWithPrefixMapping

import com.hp.hpl.jena.shared.impl.PrefixMappingImpl; //导入方法依赖的package包/类
public void testTriplePrettyPrintingWithPrefixMapping() {
	PrefixMappingImpl prefixes = new PrefixMappingImpl();
	prefixes.setNsPrefixes(PrefixMapping.Standard);
	prefixes.setNsPrefix("ex", "http://example.org/");
	assertEquals("ex:a rdfs:label \"Example\" .",
			PrettyPrinter.toString(new Triple(
					Node.createURI("http://example.org/a"),
					RDFS.label.asNode(),
					Node.createLiteral("Example", null, null)), prefixes));
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:11,代码来源:PrettyPrinterTest.java

示例3: Configuration

import com.hp.hpl.jena.shared.impl.PrefixMappingImpl; //导入方法依赖的package包/类
public Configuration(Model configurationModel) {
	model = configurationModel;
	StmtIterator it = model.listStatements(null, RDF.type, CONF.Configuration);
	if (!it.hasNext()) {
		throw new IllegalArgumentException(
				"No conf:Configuration found in configuration model");
	}
	config = it.nextStatement().getSubject();

	datasets = new ArrayList();
	it = model.listStatements(config, CONF.dataset, (RDFNode) null);
	while (it.hasNext()) {
		datasets.add(new Dataset(it.nextStatement().getResource()));
	}
	labelProperties = new ArrayList();
	it = model.listStatements(config, CONF.labelProperty, (RDFNode) null);
	while (it.hasNext()) {
		labelProperties.add(it.nextStatement().getObject().as(Property.class));
	}
	if (labelProperties.isEmpty()) {
		labelProperties.add(RDFS.label);
		labelProperties.add(DC.title);
		labelProperties.add(model.createProperty("http://xmlns.com/foaf/0.1/name"));
	}
	commentProperties = new ArrayList();
	it = model.listStatements(config, CONF.commentProperty, (RDFNode) null);
	while (it.hasNext()) {
		commentProperties.add(it.nextStatement().getObject().as(Property.class));
	}
	if (commentProperties.isEmpty()) {
		commentProperties.add(RDFS.comment);
		commentProperties.add(DC.description);
	}
	imageProperties = new ArrayList();
	it = model.listStatements(config, CONF.imageProperty, (RDFNode) null);
	while (it.hasNext()) {
		imageProperties.add(it.nextStatement().getObject().as(Property.class));
	}
	if (imageProperties.isEmpty()) {
		imageProperties.add(model.createProperty("http://xmlns.com/foaf/0.1/depiction"));
	}
	
	prefixes = new PrefixMappingImpl();		
	if (config.hasProperty(CONF.usePrefixesFrom)) {
		it = config.listProperties(CONF.usePrefixesFrom);
		while (it.hasNext()) {
			Statement stmt = it.nextStatement();
			prefixes.setNsPrefixes(FileManager.get().loadModel(
					stmt.getResource().getURI()));
		}
	} else {
		prefixes.setNsPrefixes(model);
	}
	if (prefixes.getNsURIPrefix(CONF.NS) != null) {
		prefixes.removeNsPrefix(prefixes.getNsURIPrefix(CONF.NS));
	}
}
 
开发者ID:health-and-care-developer-network,项目名称:health-and-care-developer-network,代码行数:58,代码来源:Configuration.java


注:本文中的com.hp.hpl.jena.shared.impl.PrefixMappingImpl.setNsPrefixes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。