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


Java OntProperty.toString方法代码示例

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


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

示例1: createLiteralProperty

import com.hp.hpl.jena.ontology.OntProperty; //导入方法依赖的package包/类
private void createLiteralProperty(Resource r, OntResource p, OntResource range, String literalString,IFCVO ivo) throws IOException, IfcDataFormatException {
        String xsdType = getXSDTypeFromRange(range);
        if (xsdType == null) {
            xsdType = getXSDTypeFromRangeExpensiveMethod(range);
        }
        if (xsdType != null) {
            String xsdTypeCAP = Character.toUpperCase(xsdType.charAt(0)) + xsdType.substring(1);
            OntProperty valueProp = expressModel.getOntProperty(getExpressns() + "has" + xsdTypeCAP);
            String key = valueProp.toString() + ":" + xsdType + ":" + literalString;

 //           Resource r1 = propertyResourceMap.get(key);
 //           if (r1 == null) {
            Resource r1 = ResourceFactory.createResource(getBaseURI() + createLocalName(range.getLocalName() + "_" + IDcounter));
 //              Resource r1 = ResourceFactory.createResource(getBaseURI() + range.getLocalName() + "_" + IDcounter);
                getRdfWriter().triple(new Triple(r1.asNode(), RDF.type.asNode(), range.asNode()));
  //              if (logToFile)
 //                   bw.write("*OK 17*: created resource: " + r1.getLocalName() + "\r\n");
                IDcounter++;
                propertyResourceMap.put(key, r1);
                addLiteralToResource(r1, valueProp, xsdType, literalString,ivo);
 //           }
            getRdfWriter().triple(new Triple(r.asNode(), p.asNode(), r1.asNode()));
//            if (logToFile)
//                bw.write("*OK 3*: added property: " + r.getLocalName() + " - " + p.getLocalName() + " - " + r1.getLocalName() + "\r\n");
        } else {
  
                LOGGER.log(Level.WARNING ,"XSD type not found for: " + p + " - " + range.getURI() + " - " + literalString + "\r\n");
        }
    }
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:30,代码来源:RDFWriter.java

示例2: addListInstanceProperties

import com.hp.hpl.jena.ontology.OntProperty; //导入方法依赖的package包/类
private void addListInstanceProperties(List<Resource> reslist, List<String> listelements, OntResource listrange,IFCVO ivo) throws IOException, IfcDataFormatException {
       // GetListType
       String xsdType = getXSDTypeFromRange(listrange);
       if (xsdType == null)
           xsdType = getXSDTypeFromRangeExpensiveMethod(listrange);
       if (xsdType != null) {
           String xsdTypeCAP = Character.toUpperCase(xsdType.charAt(0)) + xsdType.substring(1);
           OntProperty valueProp = expressModel.getOntProperty(getExpressns() + "has" + xsdTypeCAP);

           // Adding Content only if found
           for (int i = 0; i < reslist.size(); i++) {
               Resource r = reslist.get(i);
               String literalString = listelements.get(i);
               String key = valueProp.toString() + ":" + xsdType + ":" + literalString;
               Resource r2 = propertyResourceMap.get(key);
               if (r2 == null) {
               	r2 = ResourceFactory.createResource(getBaseURI() + createLocalName(listrange.getLocalName() + "_" + IDcounter));
                   getRdfWriter().triple(new Triple(r2.asNode(), RDF.type.asNode(), listrange.asNode()));
//                   if (logToFile)
//                       bw.write("*OK 19*: created resource: " + r2.getLocalName() + "\r\n");
                   IDcounter++;
                   propertyResourceMap.put(key, r2);
                   addLiteralToResource(r2, valueProp, xsdType, literalString,ivo);
               }
               getRdfWriter().triple(new Triple(r.asNode(), listModel.getOntProperty(getListns() + "hasContents").asNode(), r2.asNode()));
//               if (logToFile)
//                   bw.write("*OK 11*: added property: " + r.getLocalName() + " - " + "-hasContents-" + " - " + r2.getLocalName() + "\r\n");

               if (i < listelements.size() - 1) {
                   getRdfWriter().triple(new Triple(r.asNode(), listModel.getOntProperty(getListns() + "hasNext").asNode(), reslist.get(i + 1).asNode()));
//                   if (logToFile)
//                       bw.write("*OK 12*: added property: " + r.getLocalName() + " - " + "-hasNext-" + " - " + reslist.get(i + 1).getLocalName() + "\r\n");
               }
           }
       } else {

               LOGGER.log(Level.WARNING ,"XSD type not found for: " + listrange.getLocalName() + "\r\n");
       }
   }
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:40,代码来源:RDFWriter.java

示例3: domainToString

import com.hp.hpl.jena.ontology.OntProperty; //导入方法依赖的package包/类
private String domainToString(OntProperty prop) throws IOException {
	ExtendedIterator<? extends OntResource> ditr = prop.listDomain();
	while (ditr.hasNext()) {
		OntResource dmnNode = ditr.next();
		if (dmnNode.canAs(OntClass.class)) {
			return ontClassToString(dmnNode.as(OntClass.class), null);
		}
		else {
			throw new IOException("Domain of property '" + prop.toString() + "' is not an OntClass!");
		}
	}
	return null;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:14,代码来源:OwlToSadl.java


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