Search code examples
sparqlsemantic-webapache-jenaturtle-rdf

How to make Filter when querying turtle file using sparql


I should mention I'm beginner in the semantic web world. My turtle file has following structure:

@prefix ns0: <http://www.cws.org/ep/01#> .
@prefix dc: <http://purl.org/dc/terms/> .
@prefix gr: <http://purl.org/goodrelations/v1#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .    
#...
        <file:///C:/Users/Anis/Downloads/usdl-editor-master/usdl-editor-master/index.html#OSZwMOW5JiZTlJXb7>
          a ns0:GuaranteedState ;
          ns0:executionParameterType [
            a ns0:executionParameterType ;
            dc:description "Description Inpuuut" ;
            ns0:hasVariable <file:///C:/index.html#ekHCp7iFi1aEWM7QQ>

          ] ;
          dc:title "Input" .

        <file:///C:/index.html#ekHCp7iFi1aEWM7QQ>
          a ns0:Variable ;
          ns0:hasDefault [
            a gr:QuantitativeValue ;
            gr:hasValue "document.csv" ;
            gr:hasUnitOfMeasurement "csv"
          ] ;
          rdfs:label "test1" .
    #...

I'm trying to Filter by dc:title = "Input".

This is my query, what shall I add?

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ns0: <http://www.cws.org/ep/01#>
PREFIX dc: <http://purl.org/dc/terms/>
PREFIX gr: <http://purl.org/goodrelations/v1#>
SELECT   *
WHERE   { 

          ?path  dc:title ?x

}

My query result displays always the "@".. I don't know what does it mean?


Solution

  • The problem is fixed.. In my case I must add @whatever (eg. "@en") to my structure file .. Then I added this line to my query : FILTER(?x = "Input"@en). The following my query:

    PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    PREFIX owl: <http://www.w3.org/2002/07/owl#>
    PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    PREFIX ns0: <http://www.cws.org/ep/01#>
    PREFIX dc: <http://purl.org/dc/terms/>
    PREFIX gr: <http://purl.org/goodrelations/v1#>
    SELECT *
     WHERE { 
     ?path dc:title ?x .
    FILTER (?x = "Input"@en)
    }