-
Notifications
You must be signed in to change notification settings - Fork 3
2.2 logical table
SYNTAX:
<logical-table rr:tableName="string"/>
CONTAINED IN:
<mapping>
DESCRIPTION:
Specifies the logical table which is a tabular SQL query result that is to be mapped to RDF triples. Every logical table has an effective SQL query that, if executed over the SQL connection, produces the content of the logical table. A logical table is either:
- a SQL base table or view, or
- a valid SQL query
A SQL base table or view is represented by a resource that has exactly one rr:tableName
attribute. The value of rr:tableName
specifies the table or view name of the base table or view. Its value MUST be valid schema-qualified name that names an existing base table or view in the input database.
The effective SQL query of a SQL base table or view is:
SELECT * FROM {table}
with {table}
replaced with the table or view name.
A SQL query is a SELECT query in the SQL language that can be executed over the input database. It MUST be valid to execute over the SQL connection. Any columns in the SELECT list derived by projecting an expression or schema-qualified name should be aliased, because otherwise they cannot be reliably referenced in the mapping. The SQL query is the text node enclosed by <![CDATA[ ... ]]>
.
The following example shows a logical table specified as a SQL query conforming to MySQL database.
<logical-table>
<![CDATA[
SELECT dept_manager.emp_no as employeeID
FROM dept_manager
JOIN titles ON dept_manager.emp_no = titles.emp_no]]>
</logical-table>
NOTE that a well-defined query plays an important role in optimization algorithm. A general rule is to always use simple "select-from-where" pattern and avoid sub-queries. Use the JOIN keyword when expressing join tables instead of using simple "comma" join expression.
ATTRIBUTES:
-
rr:tableName
: The SQL table or view name.
LIMITATIONS:
- Version 0.5:
- Support simple join and
JOIN... ON...
expression. - Support column value expression (e.g.,
+
,-
,*
,/
) in SELECT clause. - No support column value expression in WHERE clause.
- No support
LIKE
expression. - No support
CASE
,BETWEEN
andIN
expression. - No support
LEFT JOIN
,RIGHT JOIN
,OUTER JOIN
,FULL JOIN
andNATURAL JOIN
expression. - No support aggregation functions (e.g.,
AVG
,SUM
,MAX
,MIN
) andGROUP BY
expression.
- Support simple join and
SEE ALSO:
Join the user community or follow the development on Twitter @obda_semantika