package cyh;
import com.hp.hpl.jena.rdf.*;
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.ontology.*;
import com.hp.hpl.jena.reasoner.*;
import com.hp.hpl.jena.vocabulary.*;
import com.hp.hpl.jena.reasoner.rulesys.*;
import com.hp.hpl.jena.util.*;
import java.lang.*;
import java.util.*;
import java.io.*;
public class getInfModel {
public InfModel getInfModel(){
InfModel infModel;
String file = "../../ontology/pub.owl";
Model data = ModelFactory.createDefaultModel();
Model model = ModelFactory.createDefaultModel();
InputStream in ;
try{
in = FileManager.get().open( file );
data.read(in, "");
}
catch (Exception e ){
}
Resource configuration=model.createResource() ;
configuration.addProperty(ReasonerVocabulary.PROPruleMode, "forward");
configuration.addProperty(ReasonerVocabulary.PROPruleSet, "../../rules/pub.rules");
Reasoner reasoner = GenericRuleReasonerFactory.theInstance().create(configuration);
infModel=ModelFactory.createInfModel(reasoner, data);
return infModel;
}
public String itemToProperty(String item){
String property=null;
if (item.equals("title")){
property="http://www.domain2.com#hasTitle";
}
else if(item.equals("keywords")){
property="http://www.domain2.com#keywords";
}
else if(item.equals("author")){
property="http://www.domain2.com#hasAuthor";
}
else if(item.equals("content") ) {
property="http://www.domain2.com#content";
}
else if(item.equals("pulished") ) {
property="http://www.domain2.com#isPublished";
}
else if(item.equals("Citing") ) {
property="http://www.domain2.com#Citing";
}else if(item.equals("bothCiting") ) {
property="http://www.domain2.com#bothCiting";
}
else if(item.equals("bothCited") ) {
property="http://www.domain2.com#bothCited";
}
return property;
}
public String addNameSpace(String value){
String result=value;
result="http://www.owl-ontologies.com/unnamed.owl#" + value;
return result;
}
public String removeType(String sou){
String result=sou;
if(sou.indexOf("^^")>0){
result=sou.substring(0,sou.indexOf("^^"));
}
return result;
}
public String addPrefix(String sou){
String result=null;
result="http://www.owl-ontologies.com/unnamed.owl#"+sou;
return result;
}
}
用jena做的语义检索系统
4星 · 超过85%的资源 需积分: 9 66 浏览量
2007-10-23
14:50:42
上传
评论 6
收藏 7.32MB RAR 举报
bzbcxwp
- 粉丝: 14
- 资源: 10
最新资源
- 基于keras+fasterRCNN,在VOC格式的口罩数据集上训练,检测人群中有无戴口罩python源码+模型
- 基于opencv+qt5机器视觉的传统缺陷检测, 即采用标准图片和待测图片进行pixel to pixel的XOR操作源码+文档
- 管道内检测缺陷数据库管理系统源码+文档说明+sln
- 毕业设计-低功耗STM32F411开发板(原理图+PCB源文件+官方例程+驱动等)源码+文档说明+截图
- 基于yolov5-tensorRT检测+发动机缸体内壁缺陷检测系统源码+文档说明
- 基于C++实现的锂电池缺陷检测源码+文档说明
- push_version
- 软件自制图像批量压缩工具
- 经典缺陷检测算法源码整理包含PaDiM(2020ICPR)、PatchCore(2022CVPR)、SimpleNet+文档说明
- 基于深度学习的抗梯度噪声的缺陷检测器python源码+文档说明+模型的预训练
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
- 3
- 4
- 5
前往页