2 Replies Latest reply on Mar 23, 2007 2:40 PM by Mannamal-Oracle

    Logic Operators?

    123857
      Howdy.

      Is there anyway to include logic operators (OR, NOT, etc..) in an SDO_RDF_MATCH query ?

      For example, the query below DOES NOT WORK with the OR
      placed between the two conditions... does anyone know how it
      should be rewritten?

      SELECT x, y grandChild
      FROM TABLE(SDO_RDF_MATCH(
      '(?x :parentOf ?y) OR (?x :gardianOf ?y)',
      SDO_RDF_Models('family'), null,
      SDO_RDF_Aliases(SDO_RDF_Alias('','http://www.example.org/family/')),
      null));

      Thanks!
        • 1. Re: Logic Operators?
          563141
          This may work

          SELECT x, y grandChild
          FROM TABLE(SDO_RDF_MATCH(
          '(?x :parentOf ?y)',
          SDO_RDF_Models('family'), null,
          SDO_RDF_Aliases(SDO_RDF_Alias('','http://www.example.org/family/')),
          null))
          UNION ALL
          SELECT x, y grandChild
          FROM TABLE(SDO_RDF_MATCH(
          '(?x :gardianOf ?y)',
          SDO_RDF_Models('family'), null,
          SDO_RDF_Aliases(SDO_RDF_Alias('','http://www.example.org/family/')),
          null))
          • 2. Re: Logic Operators?
            Mannamal-Oracle
            Yes, that would work. 'NOT' could be modelled using 'MINUS' in SQL.

            There is no way to include OR, NOT, etc. within a SPARQL graph pattern currently. The graph pattern matches a sub-graph within the RDF data, so the semantics are similar to that of 'AND' (all components of the pattern have to match).

            Melli