当前位置: 首页>>代码示例>>Java>>正文


Java OntResource.isClass方法代码示例

本文整理汇总了Java中com.hp.hpl.jena.ontology.OntResource.isClass方法的典型用法代码示例。如果您正苦于以下问题:Java OntResource.isClass方法的具体用法?Java OntResource.isClass怎么用?Java OntResource.isClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.hp.hpl.jena.ontology.OntResource的用法示例。


在下文中一共展示了OntResource.isClass方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addSinglePropertyFromTypeRemembrance

import com.hp.hpl.jena.ontology.OntResource; //导入方法依赖的package包/类
private void addSinglePropertyFromTypeRemembrance(Resource r, OntProperty p, String literalString, TypeVO typeremembrance,IFCVO ivo) throws IOException, IfcDataFormatException {
      OntResource range = ontModel.getOntResource(getOntNS() + typeremembrance.getName());

      if (range.isClass()) {
          if (range.asClass().hasSuperClass(expressModel.getOntClass(getExpressns() + "ENUMERATION"))) {
              // Check for ENUM
              addEnumProperty(r, p, range, literalString,ivo);
          } else if (range.asClass().hasSuperClass(expressModel.getOntClass(getExpressns() + "SELECT"))) {
              // Check for SELECT
 //             if (logToFile)
//                  bw.write("*OK 24*: found subClass of SELECT Class, now doing nothing with it: " + p + " - " + range.getLocalName() + " - " + literalString + "\r\n");
              createLiteralProperty(r, p, range, literalString,ivo);
          } else if (range.asClass().hasSuperClass(listModel.getOntClass(getListns() + "OWLList"))) {
              // Check for LIST
          	throw IfcDataFormatException.valueOutOfRange("#"+ivo.getLineNum(),literalString,range.getLocalName());
          } else {
              createLiteralProperty(r, p, range, literalString,ivo);
          }
      } else {

              LOGGER.log(Level.WARNING ,"found other kind of property: " + p + " - " + range.getLocalName() + "\r\n");
      }
  }
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:24,代码来源:RDFWriter.java

示例2: addRegularListProperty

import com.hp.hpl.jena.ontology.OntResource; //导入方法依赖的package包/类
private void addRegularListProperty(Resource r, OntProperty p, List<String> el, TypeVO typeRemembranceOverride,IFCVO ivo) throws IOException, IfcDataFormatException {
        OntResource range = p.getRange();
        if (range.isClass()) {
            OntResource listrange = getListContentType(range.asClass());
            if (typeRemembranceOverride != null) {
                OntClass cla = ontModel.getOntClass(getOntNS() + typeRemembranceOverride.getName());
                listrange = cla;
            }

            if (listrange == null) {

                    LOGGER.log(Level.WARNING ,"We could not find what kind of content is expected in the LIST." + "\r\n");
            } else {
                if (listrange.asClass().hasSuperClass(listModel.getOntClass(getListns() + "OWLList"))) {
                	throw IfcDataFormatException.valueOutOfRange("#"+ivo.getLineNum(),el.toString(),range.getLocalName());
                } else {
                    List<Resource> reslist = new ArrayList<Resource>();
                    // createrequirednumberofresources
                    for (int ii = 0; ii < el.size(); ii++) {
                    	Resource r1 = getResource(getBaseURI() + createLocalName(range.getLocalName() + "_" + IDcounter), range);
//                        Resource r1 = getResource(getBaseURI() + range.getLocalName() + "_" + IDcounter, range);
                        reslist.add(r1);
                        IDcounter++;
                        if (ii == 0) {
                            getRdfWriter().triple(new Triple(r.asNode(), p.asNode(), r1.asNode()));
  //                          if (logToFile)
 //                               bw.write("*OK 7*: added property: " + r.getLocalName() + " - " + p.getLocalName() + " - " + r1.getLocalName() + "\r\n");
                        }
                    }
                    // bindtheproperties
                    addListInstanceProperties(reslist, el, listrange,ivo);
                }
            }
        }
    }
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:36,代码来源:RDFWriter.java

示例3: addListPropertyToGivenEntities

import com.hp.hpl.jena.ontology.OntResource; //导入方法依赖的package包/类
private void addListPropertyToGivenEntities(Resource r, OntProperty p, List<Resource> el) throws IOException {
        OntResource range = p.getRange();
        if (range.isClass()) {
            OntResource listrange = getListContentType(range.asClass());

            if (listrange.asClass().hasSuperClass(listModel.getOntClass(getListns() + "OWLList"))) {
//                if (logToFile)
 //                   bw.write("*OK 20*: Handling list of list" + "\r\n");
                listrange = range;
            }
            for (int i = 0; i < el.size(); i++) {
                Resource r1 = el.get(i);
                Resource r2 = ResourceFactory.createResource(getBaseURI() + createLocalName(range.getLocalName() + "_" + IDcounter));
//                Resource r2 = ResourceFactory.createResource(getBaseURI() + range.getLocalName() + "_" + IDcounter); // was
                                                                                                                // listrange
                getRdfWriter().triple(new Triple(r2.asNode(), RDF.type.asNode(), range.asNode()));
 //               if (logToFile)
 //                   bw.write("*OK 14*: added property: " + r2.getLocalName() + " - rdf:type - " + range.getLocalName() + "\r\n");
                IDcounter++;
                Resource r3 = ResourceFactory.createResource(getBaseURI() + createLocalName(range.getLocalName() + "_" + IDcounter));
 //               Resource r3 = ResourceFactory.createResource(getBaseURI() + range.getLocalName() + "_" + IDcounter);

                if (i == 0) {
                    getRdfWriter().triple(new Triple(r.asNode(), p.asNode(), r2.asNode()));
//                    if (logToFile)
//                        bw.write("*OK 15*: added property: " + r.getLocalName() + " - " + p.getLocalName() + " - " + r2.getLocalName() + "\r\n");
                }
                getRdfWriter().triple(new Triple(r2.asNode(), listModel.getOntProperty(getListns() + "hasContents").asNode(), r1.asNode()));
 //               if (logToFile)
//                    bw.write("*OK 16*: added property: " + r2.getLocalName() + " - " + "-hasContents-" + " - " + r1.getLocalName() + "\r\n");

                if (i < el.size() - 1) {
                    getRdfWriter().triple(new Triple(r2.asNode(), listModel.getOntProperty(getListns() + "hasNext").asNode(), r3.asNode()));
//                    if (logToFile)
//                        bw.write("*OK 17*: added property: " + r2.getLocalName() + " - " + "-hasNext-" + " - " + r3.getLocalName() + "\r\n");
                }
            }
        }
    }
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:40,代码来源:RDFWriter.java

示例4: generateClassPropertiesWithRange

import com.hp.hpl.jena.ontology.OntResource; //导入方法依赖的package包/类
private List<GraphSegment> generateClassPropertiesWithRange(OntClass cls, int graphRadius,
		List<GraphSegment> data) {
	if (graphRadius <= 0) return data;
	StmtIterator sitr = getTheJenaModelWithImports().listStatements(null, RDFS.range, cls);
	while (sitr.hasNext()) {
		Statement stmt = sitr.nextStatement();
		Resource prop = stmt.getSubject();
		if (prop.canAs(OntProperty.class)) {
			OntProperty ontprop = prop.as(OntProperty.class);
			ExtendedIterator<? extends OntResource> eitr = ontprop.listDomain();
			while (eitr.hasNext()) {
				OntResource dmn = eitr.next();
				GraphSegment sg = new GraphSegment(getModelUri(), dmn, prop, cls, configMgr);
				if (dmn.isClass()) {
					annotateHeadAsClass(sg);
				}
				else if (dmn.isIndividual()) {
					annotateHeadAsIndividual(sg);
				}
				annotateEdge(sg, PROPERTY_GREEN, null, null);
				annotateTailAsClass(sg);
				if (!data.contains(sg)) {
					data.add(sg);
					data = generateClassPropertiesWithRange(dmn.as(OntClass.class), graphRadius - 1, data);
				}
			}
		}
	}
	return data;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:31,代码来源:GraphGenerator.java

示例5: valueInObjectTypePropertyRange

import com.hp.hpl.jena.ontology.OntResource; //导入方法依赖的package包/类
private boolean valueInObjectTypePropertyRange(OntProperty prop, Individual valInst, EObject cond)
		throws JenaProcessorException {
	ExtendedIterator<? extends OntResource> itr = prop.listRange();
	while (itr.hasNext()) {
		OntResource nxt = itr.next();
		if (nxt.isClass()) {
			if (instanceBelongsToClass(getTheJenaModel(), valInst, nxt)) {
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:14,代码来源:JenaBasedSadlModelProcessor.java

示例6: fillPropertiesHandleStringObject

import com.hp.hpl.jena.ontology.OntResource; //导入方法依赖的package包/类
private int fillPropertiesHandleStringObject(Resource r, EntityVO evo, String subject, int attributePointer, Object o,IFCVO ivo) throws IOException, IfcDataFormatException {
      if (!((String) o).equals("$") && !((String) o).equals("*")) {
          if (typ.get(ExpressReader.formatClassName((String) o)) == null) {
              if ((evo != null) && (evo.getDerivedAttributeList() != null)) {
                  if (evo.getDerivedAttributeList().size() <= attributePointer) {
                     throw IfcDataFormatException.attributeOutOfBounds("#"+ivo.getLineNum()+"="+ivo.getFullLineAfterNum());
                  }
                  final AttributeVO avo=evo.getDerivedAttributeList().get(attributePointer);
                  final String propURI = getOntNS() + avo.getLowerCaseName();
                  final String literalString = filterExtras((String) o);
                  if (avo.isSet()){
                  	throw IfcDataFormatException.valueOutOfRange("#"+ivo.getLineNum(),(String)o,"SET");
                  }
                  OntProperty p = ontModel.getOntProperty(propURI);
                  OntResource range = p.getRange();
                  if (range.isClass()) {
                      if (range.asClass().hasSuperClass(expressModel.getOntClass(getExpressns() + "ENUMERATION"))) {
                          // Check for ENUM
                          addEnumProperty(r, p, range, literalString,ivo);
                      } else if (range.asClass().hasSuperClass(expressModel.getOntClass(getExpressns() + "SELECT"))) {
                          // Check for SELECT
//                          if (logToFile)
//                              bw.write("*OK 25*: found subClass of SELECT Class, now doing nothing with it: " + p + " - " + range.getLocalName() + " - " + literalString + "\r\n");
                          createLiteralProperty(r, p, range, literalString,ivo);
                      } else if (range.asClass().hasSuperClass(listModel.getOntClass(getListns() + "OWLList"))) {
                          // Check for LIST
                          throw IfcDataFormatException.valueOutOfRange("#"+ivo.getLineNum(),(String)o,range.getLocalName());
                      } else {
                          createLiteralProperty(r, p, range, literalString,ivo);
                      }
                  } else {
                     
                          LOGGER.log(Level.WARNING,"found other kind of property: " + p + " - " + range.getLocalName() + "\r\n");
                  }
              } else {
              
                      LOGGER.log(Level.WARNING,"Nothing happened. Not sure if this is good or bad, possible or not." + "\r\n");
              }
              attributePointer++;
          } else {
              typeRemembrance = typ.get(ExpressReader.formatClassName((String) o));
              // if (typeRemembrance == null) {
              // if (logToFile)
              // bw.write("*ERROR 11*: The following TYPE is not found: "
              // + ExpressReader.formatClassName((String) o)
              // + "\r\nQuitting the application without output!\r\n ");
              // System.err.println(
              // "*ERROR 11*: The following TYPE is not found: " +
              // ExpressReader.formatClassName((String) o)
              // + "\r\nQuitting the application without output!\r\n ");
              // }
          }
      } else
          attributePointer++;
      return attributePointer;
  }
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:57,代码来源:RDFWriter.java


注:本文中的com.hp.hpl.jena.ontology.OntResource.isClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。