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


Java RDFNode.equals方法代碼示例

本文整理匯總了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;
}
 
開發者ID:semiotproject,項目名稱:semiot-platform,代碼行數:15,代碼來源:ModelUtils.java

示例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;
}
 
開發者ID:TopQuadrant,項目名稱:shacl,代碼行數:10,代碼來源:JSTargetPlugin.java

示例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;
				}
			}
		}		
	}
 
開發者ID:Web-of-Building-Data,項目名稱:drumbeat-ifc2ld,代碼行數:60,代碼來源:Ifc2RdfExporterBase.java

示例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;
				}
			}
		}		
	}
 
開發者ID:Web-of-Building-Data,項目名稱:drumbeat-ifc2ld,代碼行數:59,代碼來源:Ifc2RdfConverter.java

示例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;
}
 
開發者ID:stevebattle,項目名稱:Gloze,代碼行數:76,代碼來源:element.java


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