Name
rdfs_rule_set — Adds the applicable facts of the graph into a rule set.
Synopsis
rdfs_rule_set
(
|
in rule_name varchar , |
in graph_iri varchar , | |
in
remove
integer
) ; |
Description
This function associates a rule-name with a source named graphs identified by a named graph IRI. This named graph is contains RDF statements that constitute the desired inference rule to be created. You can use this procedure to add RDF statements from other named graphs as part as part of a rule-enhancement effort.
Parameters
rule_name
Rule name (literal that identifies the rule).
graph_iri
A named graph IRI that identifies the source of RDF statements to be used as inference rules,
remove
(0|1 default 0) - where 1 indicates that the specified graph is to be removed from the rule set.
Examples
Example 24.280. Simple Usage Example
Google and Bloomberg Stock Quote Services return HTML5+Microdata based Linked Open Data using terms from Schema.org.
As will be quite common, there is a case sensitive issue in regards to the HTTP URIs that identify the "Financial Quote" class.
For Bloomberg we have: <http://schema.org/intangible/financialquote> and for Google:
<http://schema.org/Intangible/FinancialQuote> . What follows in an owl:equivalentProperty
relation that enables a processor of this data (e.g., SPARQL Query Processor) apply reasoning and inference based on
the semantics of the owl:equivalentProperty
relation. Using Virtuoso's SPARQL processor, you can
create an inference rule declaratively via
rdfs_rule_set()
:
-- Suppose a ttl file inference-rule-for-stock-quotes.ttl has the following content: <http://schema.org/intangible/financialquote> owl:equivalentProperty <http://schema.org/Intangible/FinancialQuote> . -- Load the data to a Named Graph that's implicitly (in the case of Virtuoso) -- identified by the RDF Document URL that contains the RDF statements that -- constitute the rule being created SQL> LOAD <http://example.com/inference-rule-for-stock-quotes.ttl> ; Done. -- 15 msec. -- Via SQL run the procedure: SQL> RDFS_RULE_SET ('schema_stock_quotes', 'http://example.com/inference-rule-for-stock-quotes.ttl');
Example 24.281. Create Rule example
Create rule set and verify rule's existence:
SQL> rdfs_rule_set('myset', 'http://mygraph.com'); Done. -- 15 msec. SQL> SELECT * FROM DB.DBA.SYS_RDF_SCHEMA ; RS_NAME RS_URI RS_G VARCHAR NOT NULL VARCHAR NOT NULL VARCHAR _______________________________________________________________________________ http://example.com/dataspace http://example.com/dataspace/inf NULL http://www.w3.org/2002/07/owl# http://www.w3.org/2002/07/owl# NULL myset http://mygraph.com NULL virtrdf-ifp virtrdf-ifp NULL virtrdf-label virtrdf-label NULL virtrdf-meta-entity-class http://www.openlinksw.com/schemas/virtrdf-meta-entity-class NULL 7 Rows. -- 0 msec.