Anzograph SPARQL issue

121 views Asked by At

I have the following SPARQL query :

SELECT * FROM {

          ?measurement a  oboe-core:Measurement ;
                          oboe-core:ofCharacteristic oboe-core:Name ;
                          oboe-core:usesStandard :Anaee-franceExperimentalSiteNamingStandard ;
                          oboe-core:hasValue ?anaeeSiteNameStandard .
    
           BIND ( IRI( CONCAT( "http://www.anaee-france.fr/ontology/anaee-france_ontology" , 
                               ?anaeeSiteNameStandard )  ) AS ?site ) .

           OPTIONAL { ?site rdfs:label ?_anaeeSiteName . }       
    
           BIND ( IF (BOUND (?_anaeeSiteName), ?_anaeeSiteName, "NULL_anaeeSiteName"@en ) AS 
                  ?anaeeSiteName) .

           FILTER (lang( ?anaeeSiteName ) = "en") .

} limit 3

?_anaeeSiteName is empty knowing that my graph contains :

<http://www.anaee-france.fr/ontology/anaee-france_ontology#Guyaflux> 
rdfs:label "Guyaflux"@en .

When I use directly

BIND ( IRI( "http://www.anaee-france.fr/ontology/anaee-france_ontology#Guyaflux" ) AS ?site ) .

Instead of BIND IRI CONCAT

BIND ( IRI( CONCAT( "http://www.anaee-france.fr/ontology/anaee-france_ontology" , 
            ?anaeeSiteNameStandard )  ) AS ?site ) .

I get some results.

Can anyone tell me what's wrong?

Thank's

2

There are 2 answers

0
Sean Martin On

We agree with Uninformed and Andy that we think there are syntax errors. You are missing the graph uri for the FROM and the WHERE key word, and the # in the concat is needed to match your example URI.

Disclaimer: I work for Cambridge Semantics Inc.

0
R YR On

Sorry, I removed the "FROM " in order to simplify the query.

The complete Sparql query is below :

SELECT * FROM <foret> WHERE {

      ?measurement a  oboe-core:Measurement ;
                      oboe-core:ofCharacteristic oboe-core:Name ;
                      oboe-core:usesStandard :Anaee-franceExperimentalSiteNamingStandard ;
                      oboe-core:hasValue ?anaeeSiteNameStandard .
    
       BIND ( IRI( CONCAT( "http://www.anaee-france.fr/ontology/anaee-france_ontology" , 
                           ?anaeeSiteNameStandard )  ) AS ?site ) .

       OPTIONAL { ?site rdfs:label ?_anaeeSiteName . }       
    
       BIND ( IF (BOUND (?_anaeeSiteName), ?_anaeeSiteName, "NULL_anaeeSiteName"@en ) AS 
                  ?anaeeSiteName) .

       FILTER (lang( ?anaeeSiteName ) = "en") .

} limit 3

The stange think is that when I add the :

BIND ( str(?anaeeSiteNameStandard) AS ?anaeeSiteNameStandard ) . 

just before :

BIND ( IRI( CONCAT( "http://www.anaee-france.fr/ontology/anaee-france_ontology" , 
                               ?anaeeSiteNameStandard )  ) AS ?site ) .

I get the expected result !