Named Notation and SEM_MATCH Table Function

This is a short post about a strange behavior I discovered today…

The fact is that it is not really possible to use the named notation with the SEM_MATCH table function. In fact, even though the parameter’s names can be specified, the order of the parameters overrides the specification done with the named notation!?!

Here is an example:

  • With positional notation everything works as expected
SQL> SELECT count(*)
  2  FROM table(
  3    sem_match('SELECT * WHERE { GRAPH :gCH { ?s ?p ?o } }',
  4              sem_models('SEMDEMO_WORK'),
  5              NULL,
  6              sem_aliases(sem_alias(NULL,'http://www.semwebtech.org/mondial/10/meta#')),
  7              NULL
  8    )
  9  );

  COUNT(*)
----------
       601
  • The named notation seems to be supported… (notice that the parameters are specified in the same order as they are defined in the table function)
SQL> SELECT count(*)
  2  FROM table(
  3    sem_match(query     => 'SELECT * WHERE { GRAPH :gCH { ?s ?p ?o } }',
  4              models    => sem_models('SEMDEMO_WORK'),
  5              rulebases => NULL,
  6              aliases   => sem_aliases(sem_alias(NULL,'http://www.semwebtech.org/mondial/10/meta#')),
  7              filter    => NULL
  8    )
  9  );

  COUNT(*)
----------
       601
  • … but when the parameters are not specified in the same order as they are defined (the RULEBASES and ALIASES parameters were swapped), a PLS-00306 is raised!
SQL> SELECT count(*)
  2  FROM table(
  3    sem_match(query     => 'SELECT * WHERE { GRAPH :gCH { ?s ?p ?o } }',
  4              models    => sem_models('SEMDEMO_WORK'),
  5              aliases   => sem_aliases(sem_alias(NULL,'http://www.semwebtech.org/mondial/10/meta#')),
  6              rulebases => NULL,
  7              filter    => NULL
  8    )
  9  );

SELECT count(*)
*
ERROR at line 1:
ORA-06550: line 4, column 13:
PLS-00306: wrong number or types of arguments in call to 'ODCITABLEDESCRIBE'
ORA-06550: line 4, column 6:
PL/SQL: Statement ignored

As a result, even though using the named notation is better for readability, the order of the parameters cannot be changed! I’m puzzled.

Update 2013-06-21: bug 16996604 (NAMED PARAMETERS DISCARDED BY ODCITABLEDESCRIBE AND PREPARE) was opened to track this issue.

4 Comments

  1. Steve C's Gravatar Steve C
    June 13, 2013    

    Does the same behavior occur if you go against RDF_MATCH instead of the public synonym SEM_MATCH?

    • Christian Antognini's Gravatar Christian Antognini
      June 14, 2013    

      Hi Steve

      Yes, same behavior.

      Best,
      Chris

      • Steve C's Gravatar Steve C
        June 14, 2013    

        I guess at this point I may run this past Zhe Wu in the Oracle Semantic forum. He is very responsive about these sorts of things.

        • Christian Antognini's Gravatar Christian Antognini
          June 18, 2013    

          Hi Steve

          This is a good idea. But, since the forums are waaaaay too slow right now, I sent him an email.

          Best,
          Chris

Leave a Reply

Your email address will not be published. Required fields are marked *