本文整理匯總了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;
}
}
}
}
示例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;
}
}
}
}
示例3: defineType
import org.apache.jena.rdf.model.Property; //導入方法依賴的package包/類
public void defineType(Property prop, Context ctx) {
prop.addProperty(RDF.type,OWL.ObjectProperty);
}
示例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);
}