我尝试使用 OWL API 编写以下评论:
<rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
CRECK 建模组(米兰理工大学)
http://crickmodeling.chem.polimi.it/
初级参考燃料 (PRF) + PAH 机制
版本 1311,2013 年 11 月
热解、
部分氧化和燃烧初级参考燃料的详细和半详细(集中)机制,
包括高达 C20 的 PAH(多环芳烃)形成。动力学方案(低温和高温):276 种物质和 8476 种反应
参考
E. Ranzi、A. Frassoldati、S. Granata、T. Faravelli、
Ind. Eng。化学。水库。44(14), 5170-5183 (2005), doi: 10.1021/ie049318gT. Bieleveld、A. Frassoldati、A. Cuoci、T. Faravelli、E. Ranzi、U. Niemann K. Seshadri,
《燃烧研究所学报》32 I,第 493-500 页(2009 年),doi:10.116/j。 proci.2008.06.214Saggese C., Frassoldati, Cuoci A., Faravelli T., Ranzi,
Combustion and Flame (2013), DOI: 10.1016/j.combustflame.2013.02.013CRECK Modeling Group (Politecnico di Milano) http://crickmodeling.chem.polimi.it/
版本 1311,2013 年 11 月
</rdfs:comment>
不幸的是,它最终向我显示了以下注释,其中删除了空行:
<rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
CRECK Modeling Group (Politecnico di Milano)http://crickmodeling.chem.polimi.it/
Primary Reference Fuels ( PRF) + PAH 机制
版本 1311,2013 年 11 月
热解、
部分氧化和燃烧初级参考燃料的详细和半详细(集中)机制,
包括高达 C20 的 PAH(多环芳烃)形成。
动力学方案(低温和高温):276 种物质和 8476 种反应
参考文献 E. Ranzi、A. Frassoldati、S. Granata、T. Faravelli、
Ind. Eng。化学。水库。44(14), 5170-5183 (2005), doi: 10.1021/ie049318g
T. Bieleveld、A. Frassoldati、A. Cuoci、T. Faravelli、E. Ranzi、U. Niemann、K. Seshadri,
《燃烧研究所学报》32 I,第 493-500 页(2009 年),doi:10.1016/j .proci.2008.06.214
Saggese C., Frassoldati, Cuoci A., Faravelli T., Ranzi,
Combustion and Flame (2013), DOI: 10.1016/j.combustflame.2013.02.013
CRECK Modeling Group (Politecnico di Milano)
http: //creckmodeling.chem.polimi.it/第 1311 版,2013 年 11 月
</rdfs:comment>
为了在 OWL 中对上述注释进行编码,我使用以下方法: org.semanticweb.owlapi.model.OWLDataFactory.getOWLLiteral(comment);
与问题描述相关的代码片段如下:
/**
* Creates an OWL literal with one of the following data types:</br>
* 1. String.
* 2. Integer, and
* 3. Float.
*
* @param ontoFactory
* @param propertyName
* @param literal
* @return
* @throws OntoException
*/
private OWLLiteral createOWLLiteral(OWLDataFactory ontoFactory, String propertyName, String literal) throws OntoException{
if(propertyName.startsWith(basePathTBox.concat(HASH))){
propertyName = propertyName.replace(basePathTBox.concat(HASH), EMPTY);
}
if(dataPropertyNameVsTypeMap.containsKey(propertyName.toLowerCase())){
if(dataPropertyNameVsTypeMap.get(propertyName.toLowerCase()).equals("string")){
return ontoFactory.getOWLLiteral(literal);
} else if(dataPropertyNameVsTypeMap.get(propertyName.toLowerCase()).equals("integer")){
try{
return ontoFactory.getOWLLiteral(Integer.parseInt(literal));
}catch(NumberFormatException e){
throw new OntoException("The following value is not an integer:"+literal);
}
} else if(dataPropertyNameVsTypeMap.get(propertyName.toLowerCase()).equals("float")){
try{
return ontoFactory.getOWLLiteral(Float.parseFloat(literal));
}catch(NumberFormatException e){
throw new OntoException("The following value is not a float:"+literal);
}
}
}
throw new OntoException("The following data type could not be recognised:"+dataPropertyNameVsTypeMap.get(propertyName.toLowerCase()));
}
非常感谢您帮助解决此问题。