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


Java Property.addProperty方法代碼示例

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


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

示例1: exportPropertyDefinition

import org.apache.jena.rdf.model.Property; //導入方法依賴的package包/類
/*****************************************/
	
	private void exportPropertyDefinition(
			Property property,
			Resource domain,
			Resource range,
			boolean isObjectProperty,
			Integer min,
			Integer max) {
		
		property.addProperty(RDF.type, isObjectProperty ? OWL.ObjectProperty : OWL.DatatypeProperty);
		
		// TODO: double check if domains and ranges are really needed
		property.addProperty(RDFS.domain, domain);
		property.addProperty(RDFS.range, range);		

		if (max != null && max == 1 && owlProfileList.supportsStatement(RDF.type, OWL.FunctionalProperty)) {			
			// TODO: detect when FunctionalDataProperty is supported
			property.addProperty(RDF.type, isObjectProperty ? OWL.FunctionalProperty : RdfVocabulary.OWL.FunctionalDataProperty);
		}

		
//		jenaModel.add(attributeResource, RDF.type, Ifc2RdfVocabulary.EXPRESS.EntityProperty);						

		if (owlProfileList.supportsStatement(RDF.type, OWL.Restriction)) {

			//
			// write constraint about property type
			//
			if (owlProfileList.supportsStatement(OWL.allValuesFrom, null)) {
				exportPropertyRestriction(domain, property, OWL.allValuesFrom, range);
			}
			
			RDFNode minNode = min != null ? jenaModel.createTypedLiteral(min) : null;
			RDFNode maxNode = max != null ? jenaModel.createTypedLiteral(max) : null;
			
			if (minNode != null) {
				if (minNode.equals(maxNode)) {
					if (owlProfileList.supportsStatement(OWL.cardinality, minNode)) {
						exportPropertyRestriction(domain, property, OWL.cardinality, minNode);
						minNode = null;
						maxNode = null;
					}
				} else {
					if (owlProfileList.supportsStatement(OWL.minCardinality, minNode)) {
						exportPropertyRestriction(domain, property, OWL.minCardinality, minNode);
						minNode = null;
					}					
				}
			}
			
			if (maxNode != null) {
				if (owlProfileList.supportsStatement(OWL.maxCardinality, maxNode)) {
					exportPropertyRestriction(domain, property, OWL.maxCardinality, maxNode);
					minNode = null;
				}
			}
		}		
	}
 
開發者ID:Web-of-Building-Data,項目名稱:drumbeat-ifc2ld,代碼行數:60,代碼來源:Ifc2RdfExporterBase.java

示例2: convertPropertyRestrictions

import org.apache.jena.rdf.model.Property; //導入方法依賴的package包/類
private void convertPropertyRestrictions(
			Property property,
			Resource domain,
			Resource range,
			boolean isObjectProperty,
			Integer min,
			Integer max,
			Model jenaModel) {
		
		property.addProperty(RDF.type, isObjectProperty ? OWL.ObjectProperty : OWL.DatatypeProperty);
		
		// TODO: double check if domains and ranges are really needed
		property.addProperty(RDFS.domain, domain);
		property.addProperty(RDFS.range, range);		

		if (max != null && max == 1 && owlProfileList.supportsStatement(RDF.type, OWL.FunctionalProperty)) {			
			// TODO: detect when FunctionalDataProperty is supported
			property.addProperty(RDF.type, isObjectProperty ? OWL.FunctionalProperty : RdfVocabulary.OWL.FunctionalDataProperty);
		}

		
//		jenaModel.add(attributeResource, RDF.type, Ifc2RdfVocabulary.EXPRESS.EntityProperty);						

		if (owlProfileList.supportsStatement(RDF.type, OWL.Restriction)) {

			//
			// write constraint about property type
			//
			if (owlProfileList.supportsStatement(OWL.allValuesFrom, null)) {
				exportPropertyRestriction(domain, property, OWL.allValuesFrom, range, jenaModel);
			}
			
			RDFNode minNode = min != null ? jenaModel.createTypedLiteral(min) : null;
			RDFNode maxNode = max != null && max != Integer.MAX_VALUE ? jenaModel.createTypedLiteral(max) : null;
			
			if (minNode != null) {
				if (minNode.equals(maxNode)) {
					if (owlProfileList.supportsStatement(OWL.cardinality, minNode)) {
						exportPropertyRestriction(domain, property, OWL.cardinality, minNode, jenaModel);
						minNode = null;
						maxNode = null;
					}
				} else {
					if (owlProfileList.supportsStatement(OWL.minCardinality, minNode)) {
						exportPropertyRestriction(domain, property, OWL.minCardinality, minNode, jenaModel);
						minNode = null;
					}					
				}
			}
			
			if (maxNode != null) {
				if (owlProfileList.supportsStatement(OWL.maxCardinality, maxNode)) {
					exportPropertyRestriction(domain, property, OWL.maxCardinality, maxNode, jenaModel);
					minNode = null;
				}
			}
		}		
	}
 
開發者ID:Web-of-Building-Data,項目名稱:drumbeat-ifc2ld,代碼行數:59,代碼來源:Ifc2RdfConverter.java

示例3: defineType

import org.apache.jena.rdf.model.Property; //導入方法依賴的package包/類
public void defineType(Property prop, Context ctx) {
	prop.addProperty(RDF.type,OWL.ObjectProperty);
}
 
開發者ID:stevebattle,項目名稱:Gloze,代碼行數:4,代碼來源:list.java

示例4: defineType

import org.apache.jena.rdf.model.Property; //導入方法依賴的package包/類
public static void defineType(Property prop, String type) {
	if (type==null || type.equals(schema.ID) || !type.startsWith(schema.XSD_URI) || prop==null) return;
	if (isValidDatatype(type)) prop.addProperty(RDF.type,OWL.DatatypeProperty);
	else if (!schema.anyType.equals(type)) prop.addProperty(RDF.type,OWL.ObjectProperty);
}
 
開發者ID:stevebattle,項目名稱:Gloze,代碼行數:6,代碼來源:schema.java


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