首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >标签上的Jena和Pellet搜索返回错误

标签上的Jena和Pellet搜索返回错误
EN

Stack Overflow用户
提问于 2015-03-17 23:31:56
回答 2查看 131关注 0票数 0

我已经干了好几个小时了,想和珍娜一起工作。现在我终于明白了它的作用。查询类和推断类进行得很好。例如:

代码语言:javascript
复制
SELECT * WHERE { ?x rdf:type uni:Adult}

但是,当尝试使用以下方法查询标签时:

代码语言:javascript
复制
SELECT * WHERE { ?x ?y "Vincent"^^xsd:string}

返回:

代码语言:javascript
复制
 org.mindswap.pellet.jena.PelletReasoner@1b13b5d
PREFIX  xsd:  <http://www.w3.org/2001/XMLSchema#>
PREFIX  uni:  <http://localhost/SemanticSearch/semanticsearch.owl#>
PREFIX  rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX  rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX  owl:  <http://www.w3.org/2002/07/owl#>

SELECT  *
WHERE
  { ?x ?y "Vincent"^^xsd:string }

    {
      "head": {
        "vars": [ "x" , "y" ]
      } ,
      "results": {
        "bindings": [
    mrt 18, 2015 1:06:41 PM org.mindswap.pellet.jena.graph.loader.DefaultGraphLoader addUnsupportedFeature
    WARNING: Unsupported axiom: Ignoring range axiom for AnnotationProperty http://www.w3.org/2000/01/rdf-schema#label
    mrt 18, 2015 1:06:41 PM org.mindswap.pellet.jena.graph.loader.DefaultGraphLoader addUnsupportedFeature
    WARNING: Unsupported axiom: Ignoring range axiom for AnnotationProperty http://localhost/SemanticSearch/semanticsearch.owl#altLabel

        ]
      }
    }

我的完整代码如下:

代码语言:javascript
复制
            Model rawModel = ModelFactory.createDefaultModel();
            Reasoner r = PelletReasonerFactory.theInstance().create();
            Model data = FileManager.get().loadModel("file:C:/wamp/www/SemanticSearch/workspace/SemanticSearch/src/semanticsearch.owl");

            InfModel model = ModelFactory.createInfModel(r, data);
            InputStream in = new FileInputStream(new File("C:/wamp/www/SemanticSearch/semanticsearch.owl"));

            System.out.println(model.getReasoner()); 


             String sparqlQueryString1= "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>" +
                 "PREFIX owl: <http://www.w3.org/2002/07/owl#>"+
                     " PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>"+
                     " PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>"+
                     " PREFIX uni: <http://localhost/SemanticSearch/semanticsearch.owl#>"+
                     " SELECT * WHERE { ?x ?y \"Vincent\"^^xsd:string}";
                System.out.println(sparqlQueryString1); 


                          Query query = QueryFactory.create(sparqlQueryString1);
                          QueryExecution qexec = QueryExecutionFactory.create(query, model);

                          ResultSet results = qexec.execSelect();
                         //ORGINEEL ResultSetFormatter.out(System.out, results, query);       
                         //ALS RDF ResultSetFormatter.outputAsRDF("", results);    
                          ResultSetFormatter.outputAsJSON(results);
                         qexec.close() ;
        }

在耶拿中没有查询字符串吗?即使是在我用球团的时候?还有其他方法来使用Jena和Pellet来查询我的本体的and标签吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-03-18 13:50:46

好吧,这有点蠢。结果,我意外地使用OWL/XML导出了本体,并将其保存为RDF/XML修复了它。

票数 0
EN

Stack Overflow用户

发布于 2015-03-18 07:15:51

这一警告仅仅是说推理者忽略了批注属性上声明的范围。您的查询不应受其影响。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29111625

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档