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


Java Property类代码示例

本文整理汇总了Java中com.hp.hpl.jena.rdf.model.Property的典型用法代码示例。如果您正苦于以下问题:Java Property类的具体用法?Java Property怎么用?Java Property使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Property类属于com.hp.hpl.jena.rdf.model包,在下文中一共展示了Property类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Message

import com.hp.hpl.jena.rdf.model.Property; //导入依赖的package包/类
/**
 * @param problem
 * @param subject May be null
 * @param predicates May be null
 * @param objects May be null
 */
public Message(Problem problem, Resource subject,
		Property[] predicates, RDFNode[] objects) {
	this.problem = problem;
	this.subject = subject;
	this.predicates = 
		predicates == null 
				? Collections.<Property>emptyList() 
				: Arrays.asList(predicates);
	Collections.sort(this.predicates, RDFComparator.getRDFNodeComparator());
	this.objects = 
		objects == null 
				? Collections.<RDFNode>emptyList() 
				: Arrays.asList(objects);
	Collections.sort(this.objects, RDFComparator.getRDFNodeComparator());
	this.detailCode = null;
	this.details = null;
	this.cause = null;
}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:25,代码来源:Message.java

示例2: validate

import com.hp.hpl.jena.rdf.model.Property; //导入依赖的package包/类
public void validate() throws D2RQException {
	assertHasBeenDefined(this.database, D2RQ.dataStorage, D2RQException.CLASSMAP_NO_DATABASE);
	assertHasPrimarySpec(new Property[]{
			D2RQ.uriColumn, D2RQ.uriPattern, D2RQ.uriSqlExpression, D2RQ.bNodeIdColumns, D2RQ.constantValue
	});
	if (this.constantValue != null && this.constantValue.isLiteral()) {
		throw new D2RQException(
				"d2rq:constantValue for class map " + toString() + " must be a URI or blank node", 
				D2RQException.CLASSMAP_INVALID_CONSTANTVALUE);
	}
	if (this.uriPattern != null && new Pattern(uriPattern).attributes().size() == 0) {
		this.log.warn(toString() + " has an uriPattern without any column specifications. This usually happens when no primary keys are defined for a table. If the configuration is left as is, all table rows will be mapped to a single instance. " +
				"If this is not what you want, please define the keys in the database and re-run the mapping generator, or edit the mapping to provide the relevant keys.");
	}
	for (PropertyBridge bridge: propertyBridges) {
		bridge.validate();
	}
	// TODO
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:20,代码来源:ClassMap.java

示例3: getForeignKeyProperty

import com.hp.hpl.jena.rdf.model.Property; //导入依赖的package包/类
public Property getForeignKeyProperty(TableName tableName, ForeignKey foreignKey) {
	StringBuffer result = new StringBuffer(baseIRI);
	result.append(encodeTableName(tableName));
	int i = 1;
	for (Identifier column: foreignKey.getLocalColumns().getColumns()) {
		String encoded = encodeColumnName(column);
		if (i == 1) {
			result.append("#ref-");
			result.append(encoded);
		} else {
			result.append(";" + encoded);
		}
		i++;
	}
	return model.createProperty(result.toString());
}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:17,代码来源:DirectMappingStyle.java

示例4: assertNoUndefinedTerms

import com.hp.hpl.jena.rdf.model.Property; //导入依赖的package包/类
public void assertNoUndefinedTerms(Model model, 
		int undefinedPropertyErrorCode, int undefinedClassErrorCode) {
	Collection<Property> unknownProperties = getUndefinedProperties(model);
	if (!unknownProperties.isEmpty()) {
		throw new D2RQException(
				"Unknown property " + PrettyPrinter.toString(
						unknownProperties.iterator().next()) + ", maybe a typo?",
				undefinedPropertyErrorCode);
	}
	Collection<Resource> unknownClasses = getUndefinedClasses(model);
	if (!unknownClasses.isEmpty()) {
		throw new D2RQException(
				"Unknown class " + PrettyPrinter.toString(
						unknownClasses.iterator().next()) + ", maybe a typo?",
				undefinedClassErrorCode);
	}
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:18,代码来源:VocabularySummarizer.java

示例5: printTranslationTable

import com.hp.hpl.jena.rdf.model.Property; //导入依赖的package包/类
private void printTranslationTable(TranslationTable table) {
	printMapObject(table, D2RQ.TranslationTable);
	out.printURIProperty(D2RQ.href, table.getHref());
	out.printProperty(D2RQ.javaClass, table.getJavaClass());
	Iterator<Translation> it = table.getTranslations().iterator();
	List<Map<Property,RDFNode>> values = new ArrayList<Map<Property,RDFNode>>();
	while (it.hasNext()) {
		Translation translation = it.next();
		Map<Property,RDFNode> r = new LinkedHashMap<Property,RDFNode>();
		r.put(D2RQ.databaseValue, 
				ResourceFactory.createPlainLiteral(translation.dbValue()));
		r.put(D2RQ.rdfValue, 
				ResourceFactory.createPlainLiteral(translation.rdfValue()));
		values.add(r);
	}
	out.printCompactBlankNodeProperties(D2RQ.translation, values);
}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:18,代码来源:D2RQWriter.java

示例6: visit

import com.hp.hpl.jena.rdf.model.Property; //导入依赖的package包/类
public void visit(DownloadMap downloadMap) {
	visitResourceMap(downloadMap);
	assertHasPrimarySpec(downloadMap, new Property[]{
			D2RQ.uriColumn, D2RQ.uriPattern, D2RQ.uriSqlExpression, D2RQ.constantValue
	});
	if (downloadMap.getDatabase() == null && downloadMap.getBelongsToClassMap() == null) {
		error("Download map " + downloadMap + " needs a d2rq:dataStorage (or d2rq:belongsToClassMap)", 
				D2RQException.DOWNLOADMAP_NO_DATASTORAGE);
	}
	assertNotNull(downloadMap.getContentDownloadColumn(), D2RQ.contentDownloadColumn, 
			D2RQException.DOWNLOADMAP_NO_CONTENTCOLUMN);
	if (downloadMap.getConstantValue() != null && !downloadMap.getConstantValue().isURIResource()) {
		error("d2rq:constantValue for download map " + downloadMap + " must be a URI", 
				D2RQException.RESOURCEMAP_INVALID_CONSTANTVALUE);
	}
	// Validate media type?
}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:18,代码来源:D2RQValidator.java

示例7: assertHasPrimarySpec

import com.hp.hpl.jena.rdf.model.Property; //导入依赖的package包/类
protected void assertHasPrimarySpec(ResourceMap resourceMap, Property[] allowedSpecs) {
	List<Property> definedSpecs = new ArrayList<Property>();
	for (Property allowedProperty: Arrays.asList(allowedSpecs)) {
		if (hasPrimarySpec(resourceMap, allowedProperty)) {
			definedSpecs.add(allowedProperty);
		}
	}
	if (definedSpecs.isEmpty()) {
		StringBuffer error = new StringBuffer(resourceMap.toString());
		error.append(" needs one of ");
		for (int i = 0; i < allowedSpecs.length; i++) {
			if (i > 0) {
				error.append(", ");
			}
			error.append(PrettyPrinter.toString(allowedSpecs[i]));
		}
		error(error.toString(), D2RQException.RESOURCEMAP_MISSING_PRIMARYSPEC);
	}
	if (definedSpecs.size() > 1) {
		error(resourceMap + " can't have both " +
				PrettyPrinter.toString((Property) definedSpecs.get(0)) +
				" and " +
				PrettyPrinter.toString((Property) definedSpecs.get(1)),
				D2RQException.RESOURCEMAP_DUPLICATE_PRIMARYSPEC);
	}
}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:27,代码来源:D2RQValidator.java

示例8: validate

import com.hp.hpl.jena.rdf.model.Property; //导入依赖的package包/类
@Override
public void validate() throws D2RQException {
	assertHasPrimarySpec(new Property[]{
			D2RQ.uriColumn, D2RQ.uriPattern, D2RQ.constantValue
	});
	if (database == null && belongsToClassMap == null) {
		throw new D2RQException(
				"Download map " + toString() + " needs a d2rq:dataStorage (or d2rq:belongsToClassMap)", 
				D2RQException.DOWNLOADMAP_NO_DATASTORAGE);
	}
	assertHasBeenDefined(contentDownloadColumn, D2RQ.contentDownloadColumn, 
			D2RQException.DOWNLOADMAP_NO_CONTENTCOLUMN);
	if (this.constantValue != null && !this.constantValue.isURIResource()) {
		throw new D2RQException(
				"d2rq:constantValue for download map " + toString() + " must be a URI", 
				D2RQException.DOWNLOADMAP_INVALID_CONSTANTVALUE);
	}
	if (this.uriPattern != null && new Pattern(uriPattern).attributes().size() == 0) {
		log.warn(toString() + " has an uriPattern without any column specifications. This usually happens when no primary keys are defined for a table. If the configuration is left as is, all table rows will be mapped to a single instance. " +
				"If this is not what you want, please define the keys in the database and re-run the mapping generator, or edit the mapping to provide the relevant keys.");
	}
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:23,代码来源:DownloadMap.java

示例9: generateRefProperty

import com.hp.hpl.jena.rdf.model.Property; //导入依赖的package包/类
public void generateRefProperty(Property property, 
		TableName table, ForeignKey foreignKey) {
	IdentifierList localColumns = foreignKey.getLocalColumns();
	TableName referencedTable = foreignKey.getReferencedTable();
	PropertyBridge bridge = new PropertyBridge(
			getPropertyBridgeResource(table, localColumns));
	bridge.setBelongsToClassMap(getClassMap(table));
	bridge.addProperty(property);
	bridge.setRefersToClassMap(getClassMap(referencedTable));
	TableName target = referencedTable;
	if (referencedTable.equals(table)) {
		// Same-table join? Then we need to set up an alias for the table and join to that
		target = TableName.create(null, null, 
				Identifier.createDelimited( 
						Microsyntax.toString(referencedTable).replace('.', '_') + "__alias"));
		bridge.addAlias(new AliasDeclaration(referencedTable, target));
		foreignKey = new ForeignKey(foreignKey.getLocalColumns(), foreignKey.getReferencedColumns(), target);
	}
	for (Join join: Join.createFrom(table, foreignKey)) {
		bridge.addJoin(join);
	}
}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:23,代码来源:D2RQTarget.java

示例10: getUsage

import com.hp.hpl.jena.rdf.model.Property; //导入依赖的package包/类
private List<Statement> getUsage(Property property, Model model){
	
	List<Statement> stmts = new ArrayList<Statement>();
	String sparql = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> "
			+ "PREFIX owl: <http://www.w3.org/2002/07/owl#> "
			+ "SELECT DISTINCT ?concept "
			+ "WHERE{"
			+ "  {<" + property.getURI() + "> rdfs:domain ?concept} "
			+ "  UNION "
			+ "  { "
			+ "    ?concept rdfs:subClassOf|owl:equivalentClass ?restriction . "
			+ "    ?restriction a owl:Restriction; "
			+ "      owl:onProperty <" + property.getURI() + "> "
			+ "  } "
			+ "}";
	Query query = QueryFactory.create(sparql, Syntax.syntaxARQ);
	QueryExecution queryExecution = QueryExecutionFactory.create(query, model);
	
	ResultSet resultSet = queryExecution.execSelect();
	while(resultSet.hasNext()){
		QuerySolution querySolution = resultSet.next();
		Resource concept = querySolution.getResource("concept");
		
		stmts.add(new StatementImpl(property, usage, concept));
	}
	
	return stmts;
	
}
 
开发者ID:teamdigitale,项目名称:ontonethub,代码行数:30,代码来源:IndexingJob.java

示例11: getUndefinedProperties

import com.hp.hpl.jena.rdf.model.Property; //导入依赖的package包/类
public Collection<Property> getUndefinedProperties(Model model) {
	Set<Property> result = new HashSet<Property>();
	StmtIterator it = model.listStatements();
	while (it.hasNext()) {
		Statement stmt = it.nextStatement();
		if (stmt.getPredicate().getURI().startsWith(namespace)
				&& !properties.contains(stmt.getPredicate())) {
			result.add(stmt.getPredicate());
		}
	}
	return result;
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:13,代码来源:VocabularySummarizer.java

示例12: testOsloHasMainLanguageNorwegian

import com.hp.hpl.jena.rdf.model.Property; //导入依赖的package包/类
@Test
public void testOsloHasMainLanguageNorwegian() {
  Individual oslo = exercise31.getIndividual("Oslo");
  Property mainLanguage = ResourceFactory.createProperty(Exercise3.NS, "hasMainLanguage");
  RDFNode norwegian = ResourceFactory.createResource(Exercise3.NS + "Norwegian");
  Assert.assertTrue(oslo.hasProperty(mainLanguage, norwegian));
}
 
开发者ID:mehmandarov,项目名称:zebra-puzzle-workshop,代码行数:8,代码来源:Exercise31Test.java

示例13: printProperty

import com.hp.hpl.jena.rdf.model.Property; //导入依赖的package包/类
public void printProperty(Property property, RDFNode term) {
	if (term == null) return;
	if (term.isResource()) {
		printPropertyTurtle(term != null, property, toTurtle(term.asResource()));
	} else {
		printPropertyTurtle(term != null, property, toTurtle(term.asLiteral()));
	}
}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:9,代码来源:PrettyTurtleWriter.java

示例14: validate

import com.hp.hpl.jena.rdf.model.Property; //导入依赖的package包/类
public void validate() throws D2RQException {
	if (this.refersToClassMap != null) {
		if (!this.refersToClassMap.database().equals(this.belongsToClassMap.database())) {
			throw new D2RQException(toString() + 
					" links two d2rq:ClassMaps with different d2rq:dataStorages",
					D2RQException.PROPERTYBRIDGE_CONFLICTING_DATABASES);
		}
		// TODO refersToClassMap cannot be combined w/ value constraints or translation tables
	}
	if (properties.isEmpty() && dynamicPropertyPatterns.isEmpty()) {
		throw new D2RQException(toString() + " needs a d2rq:property or d2rq:dynamicProperty",
				D2RQException.PROPERTYBRIDGE_MISSING_PREDICATESPEC);
	}
	assertHasPrimarySpec(new Property[]{
			D2RQ.uriColumn, D2RQ.uriPattern, D2RQ.bNodeIdColumns,
			D2RQ.column, D2RQ.pattern, D2RQ.sqlExpression, D2RQ.uriSqlExpression, D2RQ.constantValue,
			D2RQ.refersToClassMap
	});
	if (this.datatype != null && this.lang != null) {
		throw new D2RQException(toString() + " has both d2rq:datatype and d2rq:lang",
				D2RQException.PROPERTYBRIDGE_LANG_AND_DATATYPE);
	}
	if (this.datatype != null && this.column == null && this.pattern == null
			&& this.sqlExpression == null) {
		throw new D2RQException("d2rq:datatype can only be used with d2rq:column, d2rq:pattern " +
				"or d2rq:sqlExpression at " + this,
				D2RQException.PROPERTYBRIDGE_NONLITERAL_WITH_DATATYPE);
	}
	if (this.lang != null && this.column == null && this.pattern == null) {
		throw new D2RQException("d2rq:lang can only be used with d2rq:column, d2rq:pattern " +
				"or d2rq:sqlExpression at " + this,
				D2RQException.PROPERTYBRIDGE_NONLITERAL_WITH_LANG);
	}
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:35,代码来源:PropertyBridge.java

示例15: printPropertyTurtle

import com.hp.hpl.jena.rdf.model.Property; //导入依赖的package包/类
public void printPropertyTurtle(boolean writeIt, Property property, String turtleSnippet) {
	if (!writeIt) return;
	printIndent();
	out.print(toTurtle(property));
	out.print(" ");
	out.print(turtleSnippet);
	out.print(";");
}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:9,代码来源:PrettyTurtleWriter.java


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