本文整理汇总了Java中com.hp.hpl.jena.ontology.OntClass.hasSuperClass方法的典型用法代码示例。如果您正苦于以下问题:Java OntClass.hasSuperClass方法的具体用法?Java OntClass.hasSuperClass怎么用?Java OntClass.hasSuperClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hp.hpl.jena.ontology.OntClass
的用法示例。
在下文中一共展示了OntClass.hasSuperClass方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: suggestLinguisticData
import com.hp.hpl.jena.ontology.OntClass; //导入方法依赖的package包/类
public List<SynSuggestion> suggestLinguisticData(Resource rdfResource) {
if (rdfResource.canAs(OntClass.class)) {
OntClass ontCls = rdfResource.as(OntClass.class);
OntModel om = OntoManager.getInstance().getModel();
if (ontCls.hasSuperClass(om.getOntClass(NS + "Product"))) { //if rdfResource is a product
return suggestForProduct(ontCls);
} else if (ontCls.hasSuperClass(om.getOntClass(NS + "Feature"))) { //if feature
return suggestForFeature(ontCls);
} else {
logger.error("unsupported class type");
}
}
return null;
}
示例2: ProductClass
import com.hp.hpl.jena.ontology.OntClass; //导入方法依赖的package包/类
ProductClass(OntClass ontClass) {
if (!ontClass.hasSuperClass(PO.PRODUCT)) {
throw new IllegalArgumentException("provided ontClass is not a product. uri=" + ontClass.getURI());
}
;
pCls = ontClass;
features = new HashSet<FeatureClass>();
top_level_features = new HashSet<FeatureClass>();
}
示例3: fillPropertiesHandleIfcObject
import com.hp.hpl.jena.ontology.OntClass; //导入方法依赖的package包/类
private int fillPropertiesHandleIfcObject(Resource r, EntityVO evo, int attributePointer, Object o,IFCVO ivo) throws IOException, IfcDataFormatException {
if ((evo != null) && (evo.getDerivedAttributeList() != null) && (evo.getDerivedAttributeList().size() > attributePointer)) {
final AttributeVO avo=evo.getDerivedAttributeList().get(attributePointer);
if (avo.isSet()){
throw IfcDataFormatException.valueOutOfRange("#"+ivo.getLineNum(),"#"+((IFCVO)o).getLineNum(),"SET");
}
final String propURI = getOntNS() + evo.getDerivedAttributeList().get(attributePointer).getLowerCaseName();
EntityVO evorange = ent.get(ExpressReader.formatClassName(((IFCVO) o).getName()));
OntProperty p = ontModel.getOntProperty(propURI);
OntClass range=p.getRange().asClass();
OntClass rclass = ontModel.getOntClass(getOntNS() + evorange.getName());
if (!rclass.hasSuperClass(range)){
throw IfcDataFormatException.valueOutOfRange("#"+ivo.getLineNum(),"#"+((IFCVO)o).getLineNum(),range.getLocalName());
}
else{
Resource r1=ResourceFactory.createResource(getBaseURI() + createLocalName(evorange.getName() + "_" + ((IFCVO) o).getLineNum()));
getRdfWriter().triple(new Triple(r.asNode(), p.asNode(), r1.asNode()));
// if (logToFile)
// bw.write("*OK 1*: added property: " + r.getLocalName() + " - " + p.getLocalName() + " - " + r1.getLocalName() + "\r\n");
}
} else {
throw IfcDataFormatException.attributeOutOfBounds("#"+ivo.getLineNum()+"="+ivo.getFullLineAfterNum());
}
attributePointer++;
return attributePointer;
}
示例4: lowestIndependentClassesOnly
import com.hp.hpl.jena.ontology.OntClass; //导入方法依赖的package包/类
private List<OntClass> lowestIndependentClassesOnly(List<OntClass> types) {
List<OntClass> removals = null;
for (int i = 0; i < types.size(); i++) {
for (int j = 0; j < types.size(); j++) {
if (j != i) {
OntClass clsi = types.get(i);
OntClass clsj = types.get(j);
if (clsi.isUnionClass()) {
if (unionClassContainsSuperclass(clsi.asUnionClass(), clsj)) {
if (removals == null) removals = new ArrayList<OntClass>();
removals.add(clsi);
}
}
else if (clsj.isUnionClass()) {
if (unionClassContainsSuperclass(clsj.asUnionClass(), clsi)) {
if (removals == null) removals = new ArrayList<OntClass>();
removals.add(clsj);
}
}
else if (clsi.hasSuperClass(clsj)) {
if (removals == null) removals = new ArrayList<OntClass>();
removals.add(clsj);
}
else if (clsj.hasSuperClass(clsi)) {
if (removals == null) removals = new ArrayList<OntClass>();
removals.add(clsi);
}
}
}
}
if (removals != null) {
for (int i = 0; i < removals.size(); i++) {
if (types.contains(removals.get(i))) {
types.remove(removals.get(i));
}
}
}
return types;
}
示例5: unionClassContainsSuperclass
import com.hp.hpl.jena.ontology.OntClass; //导入方法依赖的package包/类
private boolean unionClassContainsSuperclass(UnionClass unionCls, OntClass cls) {
ExtendedIterator<RDFNode> eitr = unionCls.getOperands().iterator();
while (eitr.hasNext()) {
RDFNode node = eitr.next();
if (node.equals(cls) || (node.canAs(OntClass.class) && cls.hasSuperClass((OntClass)node.as(OntClass.class)))) {
eitr.close();
return true;
}
}
return false;
}
示例6: isSadlTypedList
import com.hp.hpl.jena.ontology.OntClass; //导入方法依赖的package包/类
public boolean isSadlTypedList(RDFNode node) {
if (node instanceof Resource && ((Resource)node).canAs(OntClass.class)) {
OntClass cls = ((Resource)node).as(OntClass.class);
OntResource lstrsrc = theJenaModel.getOntResource(SadlConstants.SADL_LIST_MODEL_LIST_URI);
if (lstrsrc != null && cls.hasSuperClass(lstrsrc)) { // if the model doesn't have any lists the list model will not have been imported
return true;
}
}
return false;
}