本文整理匯總了Java中org.apache.jena.rdf.model.RDFNode.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java RDFNode.equals方法的具體用法?Java RDFNode.equals怎麽用?Java RDFNode.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.jena.rdf.model.RDFNode
的用法示例。
在下文中一共展示了RDFNode.equals方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: objectsOfProperty
import org.apache.jena.rdf.model.RDFNode; //導入方法依賴的package包/類
public static List<RDFNode> objectsOfProperty(Model model, Property property, Resource subject,
RDFNode objectToIgnore) {
List<RDFNode> objects = new ArrayList<>();
NodeIterator iterator = model.listObjectsOfProperty(subject, property);
while (iterator.hasNext()) {
RDFNode node = iterator.next();
if (!node.equals(objectToIgnore)) {
objects.add(node);
}
}
return objects;
}
示例2: isNodeInTarget
import org.apache.jena.rdf.model.RDFNode; //導入方法依賴的package包/類
@Override
public boolean isNodeInTarget(RDFNode focusNode, Dataset dataset, Resource executable, SHParameterizableTarget parameterizableTarget) {
for(RDFNode target : executeTarget(dataset, executable, parameterizableTarget)) {
if(focusNode.equals(target)) {
return true;
}
}
return false;
}
示例3: exportPropertyDefinition
import org.apache.jena.rdf.model.RDFNode; //導入方法依賴的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;
}
}
}
}
示例4: convertPropertyRestrictions
import org.apache.jena.rdf.model.RDFNode; //導入方法依賴的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;
}
}
}
}
示例5: toXML
import org.apache.jena.rdf.model.RDFNode; //導入方法依賴的package包/類
public boolean toXML(Node xml, RDFNode rdf, Context ctx) {
populate();
Element e;
Model m = ctx.getModel();
Document doc = (Document) ((xml instanceof Document)?xml:xml.getOwnerDocument());
// the element may be defined locally or globally
element def = getDefinition(ctx.getModel(),ctx);
schema xs = (schema) def.get_owner();
if (isQualified()) {
e = doc.createElementNS(xs.getTargetNamespace(), def.getName());
// if the default ns is undefined use this tns (unprefixed)
// (this element may already be in the default namespace)
String dns = expandPrefix("", xml,null,ctx.getModel());
// use prefixes where there may be unqualified elements and this is qualified
if ((dns==null && (xs.getElementFormDefault().equals("unqualified")))
|| (dns!=null && !xs.getTargetNamespace().equals(dns)) // if dns defined and this isn't in it
|| (xs.getElementFormDefault().equals("unqualified")))
e.setPrefix(lookupPrefix(xs.getTargetNamespace(),m,ctx));
xml.appendChild(e);
} else {
// don't define the element in the (target) namespace
e = doc.createElement(getElementName());
xml.appendChild(e);
}
// nil
if (def.is_nillable()) {
if (rdf instanceof Resource
&& (rdf.equals(RDF.nil) || ((Resource)rdf).hasProperty(RDF.value,RDF.nil))) {
e.setAttributeNS(schema.XSI, "xsi:nil", "true");
}
}
String type = expandQName(ctx.getDefaultNS(),def.getType(),m);
XMLBean t = def.get_type(ctx);
if (type!=null && type.startsWith(schema.XSD_URI)) {
try {
if (type.endsWith("#ID") ||
type.endsWith("#IDREF") ||
type.endsWith("#IDREFS") ||
type.endsWith("#NMTOKENS") ||
type.endsWith("#ENTITY") ||
type.endsWith("#QName")) {
e.appendChild(doc.createTextNode(xs.toXMLValue(e, rdf, type, ctx)));
}
else if (type.endsWith("#duration") && !rdf.isLiteral()) {
// sum of all durations
Duration duration = null;
Resource r = (Resource) rdf;
for (StmtIterator si = r.listProperties(RDF.value); si.hasNext(); ) {
Duration d = schema.getDuration(si.nextStatement().getString());
duration = duration==null?d:duration.add(d);
}
if (duration!=null)
e.appendChild(doc.createTextNode(duration.toString()));
}
else addXMLValue(rdf, e, doc);
} catch (Exception e1) {
Gloze.logger.warn("missing value for: " + getElementName());
}
}
else if (t instanceof complexType) {
Set<Statement> pending = unsequenced((Resource) rdf);
int index = ((complexType) t).toXML(e, (Resource) rdf, 0, pending, ctx);
// search for matching extensions
produceMixed(ctx.getModel().getSeq((Resource) rdf),index,e);
}
else if (t instanceof simpleType) {
((simpleType) t).toXML(e, rdf,ctx);
}
else { // untyped
xs.toXMLText(e,rdf,null,null,ctx);
}
return true;
}