SPARQL查询结果不适用于本地OWL文件

时间:2018-09-06 07:24:21

标签: sparql jena owl ontology fuseki

我最近使用protege创建了一个本体,然后使用Apache Jena Fuseki 3.8.0来查询结果。

因此,.OWL文件使用MAMP在本地托管。托管的OWL文件没有任何问题。

但是当我做一个简单的查询时,

PREFIX uni:<http://localhost:8888/university.owl#>
SELECT * {?Student uni:studies uni:M101}
  

这不会显示任何结果。是什么导致此问题?是因为我已经在本地托管.OWL文件吗?还是其他问题?

如果需要,可以在下面给出OWL文件。

<rdf:RDF xmlns="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xml:base="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl">
<owl:Ontology rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl"/>
 <!--

    ///////////////////////////////////////////////////////////////////////////////////////
    //
    // Object Properties
    //
    ///////////////////////////////////////////////////////////////////////////////////////

-->
 <!--
 http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#studies 
-->
<owl:ObjectProperty rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#studies">
<rdfs:domain rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Student"/>
<rdfs:range rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Module"/>
</owl:ObjectProperty>
 <!--
 http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#teaches 
-->
<owl:ObjectProperty rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#teaches"/>
 <!--  http://www.w3.org/2002/07/owl#topObjectProperty  -->
<rdf:Description rdf:about="http://www.w3.org/2002/07/owl#topObjectProperty">
<rdfs:domain rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Lecturer"/>
<rdfs:range rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Module"/>
</rdf:Description>
 <!--

    ///////////////////////////////////////////////////////////////////////////////////////
    //
    // Data properties
    //
    ///////////////////////////////////////////////////////////////////////////////////////

-->
 <!--
 http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#first_name 
-->
<owl:DatatypeProperty rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#first_name">
<rdfs:domain rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Person"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
</owl:DatatypeProperty>
 <!--
 http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#last_name 
-->
<owl:DatatypeProperty rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#last_name">
<rdfs:domain rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Person"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
</owl:DatatypeProperty>
 <!--
 http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#staffID 
-->
<owl:DatatypeProperty rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#staffID">
<rdfs:domain rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Lecturer"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
</owl:DatatypeProperty>
 <!--
 http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#studentID 
-->
<owl:DatatypeProperty rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#studentID">
<rdfs:domain rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Student"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
</owl:DatatypeProperty>
 <!--

    ///////////////////////////////////////////////////////////////////////////////////////
    //
    // Classes
    //
    ///////////////////////////////////////////////////////////////////////////////////////

-->
 <!--
 http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Lecturer 
-->
<owl:Class rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Lecturer">
<rdfs:subClassOf rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Person"/>
</owl:Class>
 <!--
 http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#MobileModule 
-->
<owl:Class rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#MobileModule">
<rdfs:subClassOf rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Module"/>
</owl:Class>
 <!--
 http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Module 
-->
<owl:Class rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Module"/>
 <!--
 http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Person 
-->
<owl:Class rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Person"/>
 <!--
 http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Student 
-->
<owl:Class rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Student">
<rdfs:subClassOf rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Person"/>
</owl:Class>
 <!--
 http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#WebModule 
-->
<owl:Class rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#WebModule">
<rdfs:subClassOf rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Module"/>
</owl:Class>
 <!--

    ///////////////////////////////////////////////////////////////////////////////////////
    //
    // Individuals
    //
    ///////////////////////////////////////////////////////////////////////////////////////

-->
 <!--
 http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Lecturer1 
-->
<owl:NamedIndividual rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Lecturer1">
<rdf:type rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Lecturer"/>
<teaches rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#M101"/>
<teaches rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#M102"/>
<first_name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Chris</first_name>
<last_name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Brown</last_name>
<staffID rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">43532</staffID>
</owl:NamedIndividual>
 <!--
 http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Lecturer2 
-->
<owl:NamedIndividual rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Lecturer2">
<rdf:type rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Lecturer"/>
<teaches rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#W101"/>
<teaches rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#W103"/>
<first_name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Larisa</first_name>
<last_name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Sherman</last_name>
<staffID rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">24214</staffID>
</owl:NamedIndividual>
 <!--
 http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#M101 
-->
<owl:NamedIndividual rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#M101">
<rdf:type rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#MobileModule"/>
</owl:NamedIndividual>
 <!--
 http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#M102 
-->
<owl:NamedIndividual rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#M102">
<rdf:type rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#MobileModule"/>
</owl:NamedIndividual>
 <!--
 http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Student1 
-->
<owl:NamedIndividual rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Student1">
<rdf:type rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Student"/>
<studies rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#M101"/>
<studies rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#W101"/>
<first_name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Steve</first_name>
<last_name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Perera</last_name>
<studentID rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">2015062</studentID>
</owl:NamedIndividual>
 <!--
 http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Student2 
-->
<owl:NamedIndividual rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Student2">
<rdf:type rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Student"/>
<studies rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#M102"/>
<studies rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#W103"/>
<first_name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Justin</first_name>
<last_name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Nience</last_name>
<studentID rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">2015063</studentID>
</owl:NamedIndividual>
 <!--
 http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Student3 
-->
<owl:NamedIndividual rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Student3">
<rdf:type rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Student"/>
<studies rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#M101"/>
<first_name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">John</first_name>
<last_name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Fernando</last_name>
<studentID rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">2015076</studentID>
</owl:NamedIndividual>
 <!--
 http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#W101 
-->
<owl:NamedIndividual rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#W101">
<rdf:type rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#WebModule"/>
</owl:NamedIndividual>
 <!--
 http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#W103 
-->
<owl:NamedIndividual rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#W103">
<rdf:type rdf:resource="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#WebModule"/>
</owl:NamedIndividual>
 <!--

    ///////////////////////////////////////////////////////////////////////////////////////
    //
    // General axioms
    //
    ///////////////////////////////////////////////////////////////////////////////////////

-->
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#AllDisjointClasses"/>
<owl:members rdf:parseType="Collection">
<rdf:Description rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Lecturer"/>
<rdf:Description rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#MobileModule"/>
<rdf:Description rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#Student"/>
<rdf:Description rdf:about="http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#WebModule"/>
</owl:members>
</rdf:Description>
</rdf:RDF>
<!--
 Generated by the OWL API (version 4.2.8.20170104-2310) https://github.com/owlcs/owlapi 
-->

1 个答案:

答案 0 :(得分:1)

根据您的Protégé首选项(文件>首选项),新实体IRI以活动的本体URI开始,后跟#,并以用户提供的名称结束。

因此,声明uni前缀如下:

PREFIX uni: <http://www.semanticweb.org/lakindugunasekara/ontologies/2018/8/university.owl#>