Search code examples
sparqlsemantic-webprotege

SPARQL query individual in protege


Im trying to run sparql with protege 5 . This is my ontology created with protege5 :

<?xml version="1.0"?>
<rdf:RDF xmlns="http://www.semanticweb.org/lion/ontologies/2017/5/untitled-ontology-73#"
     xml:base="http://www.semanticweb.org/lion/ontologies/2017/5/untitled-ontology-73"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:owl="http://www.w3.org/2002/07/owl#"
     xmlns:xml="http://www.w3.org/XML/1998/namespace"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
    <owl:Ontology rdf:about="http://www.semanticweb.org/lion/ontologies/2017/5/untitled-ontology-73"/>



    <!-- 
    ///////////////////////////////////////////////////////////////////////////////////////
    //
    // Data properties
    //
    ///////////////////////////////////////////////////////////////////////////////////////
     -->




    <!-- http://www.semanticweb.org/lion/ontologies/2017/5/untitled-ontology-73#family -->

    <owl:DatatypeProperty rdf:about="http://www.semanticweb.org/lion/ontologies/2017/5/untitled-ontology-73#family">
        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    </owl:DatatypeProperty>



    <!-- 
    ///////////////////////////////////////////////////////////////////////////////////////
    //
    // Classes
    //
    ///////////////////////////////////////////////////////////////////////////////////////
     -->




    <!-- http://www.semanticweb.org/lion/ontologies/2017/5/untitled-ontology-73#name -->

    <owl:Class rdf:about="http://www.semanticweb.org/lion/ontologies/2017/5/untitled-ontology-73#name"/>



    <!-- 
    ///////////////////////////////////////////////////////////////////////////////////////
    //
    // Individuals
    //
    ///////////////////////////////////////////////////////////////////////////////////////
     -->




    <!-- http://www.semanticweb.org/lion/ontologies/2017/5/untitled-ontology-73#amin -->

    <owl:NamedIndividual rdf:about="http://www.semanticweb.org/lion/ontologies/2017/5/untitled-ontology-73#amin">
        <family rdf:datatype="http://www.w3.org/2001/XMLSchema#string">mazrouei</family>
    </owl:NamedIndividual>



    <!-- http://www.semanticweb.org/lion/ontologies/2017/5/untitled-ontology-73#sara -->

    <owl:NamedIndividual rdf:about="http://www.semanticweb.org/lion/ontologies/2017/5/untitled-ontology-73#sara">
        <family>rezaei</family>
    </owl:NamedIndividual>
</rdf:RDF>



<!-- Generated by the OWL API (version 4.2.5.20160517-0735) https://github.com/owlcs/owlapi -->

i'm trying to run this query in snap sparql query window:

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX :<http://www.semanticweb.org/lion/ontologies/2017/5/untitled-ontology-73#>


SELECT ?x  WHERE{?x :family ?y}

but no result returned .family is a data property that define the family for an individual. how may i fix this?


Solution

  • Snap SPARQL plugin is designed for querying involving inferred knowledge. However, there is a weirdness in its UI. If a reasoner is selected, though not started, a query returns empty result.

    In order to get expected result, one should:

    • Disable reasoning (Reasoner > None) — for querying over asserted knowledge only, or
    • Start reasoning (Reasoner > Start reasoning) — for querying over both asserted and inferred knowledge.

    P.S. Snap SPARQL query on Github.