2 Replies Latest reply on Jun 4, 2010 4:24 PM by 772653

    Curly brace query with URI as an object

    772653
      Hello,

      I'm having trouble running a query where I specify the object, whereas it seems to work fine if it's also queried.


      I've inserted a few statements using the Sesame adapter.

      The output of:
      SELECT a.triple.GET_TRIPLE() AS triple FROM test_rdf_data a
      is:
      MDSYS.SDO_RDF_TRIPLE(<http://example.com/#me>,<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>,<http://xmlns.com/foaf/0.1/Person>)
      MDSYS.SDO_RDF_TRIPLE(<http://example.com/#me>,<http://xmlns.com/foaf/0.1/givenName>,"John")
      MDSYS.SDO_RDF_TRIPLE(<http://example.com/#me>,<http://xmlns.com/foaf/0.1/familyName>,"Smith")
      When I run this query, I get the expected result:
      SELECT  givenName, familyName, s, t
        FROM TABLE(SEM_MATCH(
          '{ ?s rdf:type ?t.  OPTIONAL { ?s foaf:givenName ?givenName }. OPTIONAL { ?s foaf:familyName ?familyName }. }',
          SEM_Models('test'),
          null, 
          SEM_ALIASES(SEM_ALIAS('foaf','http://xmlns.com/foaf/0.1/')),
          null));
      In particular, t is
      http://xmlns.com/foaf/0.1/Person
      However, the following produces 0 rows:
      SELECT  givenName, familyName, s
        FROM TABLE(SEM_MATCH(
          '{ ?s rdf:type foaf:Person. OPTIONAL { ?s foaf:givenName ?givenName }. OPTIONAL { ?s foaf:familyName ?familyName }. }',
          SEM_Models('test'),
          null, 
          SEM_ALIASES(SEM_ALIAS('foaf','http://xmlns.com/foaf/0.1/')),
          null));
      I don't understand why foaf:Person, explicitly written here doesn't work. Did I miss something in the documentation? foaf:givenName and foaf:familyName seem to work just fine.
      (I'm sure the triples were created using a URI, not a literal string, if it matters.)


      ------
      (edit)

      I've realised that the query seems to work fine with the parenthesis notation:
      SELECT  givenName, familyName, s
        FROM TABLE(SEM_MATCH(
          '(?s rdf:type foaf:Person) (?s foaf:givenName ?givenName) (?s foaf:familyName ?familyName)',
          SEM_Models('test'),
          null, 
          SEM_ALIASES(SEM_ALIAS('foaf','http://xmlns.com/foaf/0.1/')),
          null));
      Any idea what the correct syntax to say something like foaf:Person with the curly brackets ought to be?



      Best wishes,

      Bruno.

      Edited by: harbulot on 03-Jun-2010 02:38

      (I've edited the title and added the parenthesis example.)