On 2/23/18 7:45 PM, Jason Koh wrote:
> Hi Kingsley,
>
> I did the same thing for my schema but it didn't work, I will debug it
> more.
>
> btw, what does p_score_init (); do? I receive when I run it:
> ```
> Error 42001: [Virtuoso Driver][Virtuoso Server]SR185: Undefined
> procedure DB.DBA.p_score_init.
> at line 5 of Top-Level:
> ```
>
> I use Virtuoso 7.2.4.2.
>
> Thanks!
>
>
> With regards,
> Jason Koh
> cseweb.ucsd.edu/~jbkoh <http://cseweb.ucsd.edu/%7Ejbkoh>

Oops, that was a cut and paste error. That procedure isn't relevant to
this kind of built-in reasoning and inference.


>
> On Fri, Feb 23, 2018 at 1:56 PM, Kingsley Idehen
> <kide...@openlinksw.com <mailto:kide...@openlinksw.com>> wrote:
>
>     On 2/22/18 10:33 PM, Jason Koh wrote:
>>     Just to provide my use case,
>>
>>     I presumed if there is a graph like
>>
>>     ```turtle
>>     ex:a rdf:type sch:Class1 .
>>     sch:Class1 owl:equivalentClass sch:Class2 .
>>     ```
>>     . a query like this should work
>>     ```sparql
>>     select ?s where {
>>     ?s rdf:type sch:Class2 .
>>     }
>>     ```
>>
>>

Yes, if you have mapped a built-in inference rule to the named graph
that contains you owl:equivalenClass statements.

As per my example, map the rule to a graph containing
owl:equivalentClass statements, and then reference rule using pragma in
your sparql query, to invoke built-in reasoning and inference context.

In my example:

Graph IRI:
 
<http://www.openlinksw.com/data/turtle/ontology_mappings/schemas_mappings/SchemaOrgToOpenLink.ttl>
<http://www.openlinksw.com/data/turtle/ontology_mappings/schemas_mappings/SchemaOrgToOpenLink.ttl>


Rule Mapping to Named Graph:

rdfs_rule_set ('urn:equivalent:class:inference:rules:demo:2018:16:45',
'http://www.openlinksw.com/data/turtle/ontology_mappings/schemas_mappings/SchemaOrgToOpenLink.ttl
<http://www.openlinksw.com/data/turtle/ontology_mappings/schemas_mappings/SchemaOrgToOpenLink.ttl>')

Invocation Pragma usage example :
DEFINE input:inference
'urn:equivalent:class:inference:rules:demo:2018:16:45'

What's missing from my initial response is that you should also load
owl:ontology into your named graph, so in my case I would:
SPARQL APPEND <http://www.w3.org/2002/07/owl#> TO
<http://www.openlinksw.com/data/turtle/ontology_mappings/schemas_mappings/SchemaOrgToOpenLink.ttl
<http://www.openlinksw.com/data/turtle/ontology_mappings/schemas_mappings/SchemaOrgToOpenLink.ttl>>
.

I didn't state that earlier because my named graph
<http://www.openlinksw.com/data/turtle/ontology_mappings/schemas_mappings/SchemaOrgToOpenLink.ttl
<http://www.openlinksw.com/data/turtle/ontology_mappings/schemas_mappings/SchemaOrgToOpenLink.ttl>>
also contains triples from <http://www.w3.org/2002/07/owl#> that
describe the nature of owl:equivalentClass relations. That's the problem
you are having, following my initial response verbatim :)

Kingsley
>
>>     On Thu, Feb 22, 2018 at 5:33 PM, Jason Koh <jb...@eng.ucsd.edu
>>     <mailto:jb...@eng.ucsd.edu>> wrote:
>>
>>         Hi,
>>
>>         I would like to exploit OWL/RDFS inferences like
>>         here: 
>> https://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/VirtSPARQLReasoningTutorial#Step
>>         
>> <https://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/VirtSPARQLReasoningTutorial#Step>
>>         6.: SPARQL Inference Queries
>>
>>         1. However, I can't find the "define rules" for
>>         owl:equivalentClass as mentioned
>>         here: 
>> http://docs.openlinksw.com/virtuoso/virtuosotipsandtricksrdfschowlinfrl/
>>         
>> <http://docs.openlinksw.com/virtuoso/virtuosotipsandtricksrdfschowlinfrl/>.
>>
>>         What is the exact keyword to use owl:equivalentClass like
>>         ``DEFINE input:same-as "yes"``?
>>
>>
>>         2. And if I use inference instead of transitive search like
>>         ``rel:ancestorOf+``, is it faster?
>>
>>         Thank you!
>>
>>
>>         With regards,
>>         Jason Koh
>>         cseweb.ucsd.edu/~jbkoh <http://cseweb.ucsd.edu/%7Ejbkoh>
>>
>     Steps:
>
>     SQL> sparql define get:soft "no-sponge" load
>     
> <http://www.openlinksw.com/data/turtle/ontology_mappings/schemas_mappings/SchemaOrgToOpenLink.ttl>
>     
> <http://www.openlinksw.com/data/turtle/ontology_mappings/schemas_mappings/SchemaOrgToOpenLink.ttl>
>     ;
>
>     Done. -- 6146 msec.
>     SQL> rdfs_rule_set
>     ('urn:equivalent:class:inference:rules:demo:2018:16:45',
>     
> 'http://www.openlinksw.com/data/turtle/ontology_mappings/schemas_mappings/SchemaOrgToOpenLink.ttl
>     
> <http://www.openlinksw.com/data/turtle/ontology_mappings/schemas_mappings/SchemaOrgToOpenLink.ttl>');
>
>     Done. -- 182 msec.
>     SQL> p_score_init ();
>
>     Here are links Virtuoso's Reasoning & Inference functionality with
>     live demo links based on the above
>
>     [1]
>     
> http://lod.openlinksw.com/describe/?url=http%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2FOrganization&distinct=1
>     
> <http://lod.openlinksw.com/describe/?url=http%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2FOrganization&distinct=1>
>     -- FOAF Organization instances modulo built-in Reasoning & Inference
>
>     [2]
>     
> http://lod.openlinksw.com/describe/?uri=http%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2FOrganization&inf=urn%3Aequivalent%3Aclass%3Ainference%3Arules%3Ademo%3A2018%3A16%3A45
>     
> <http://lod.openlinksw.com/describe/?uri=http%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2FOrganization&inf=urn%3Aequivalent%3Aclass%3Ainference%3Arules%3Ademo%3A2018%3A16%3A45>
>     -- Ditto, but with built-in Reasoning & Inference by initializing
>     inference rule identified by
>     <urn:equivalent:class:inference:rules:demo:2018:16:45> .
>
>     Links:
>
>     [1]
>     http://kidehen.blogspot.com/2014/02/class-equivalence-based-reasoning.html
>     
> <http://kidehen.blogspot.com/2014/02/class-equivalence-based-reasoning.html> 
>     -- Built-In Reasoning & Inference using Class Equivalence Semantics
>
>     [2]
>     
> https://www.linkedin.com/pulse/simple-sparql-based-query-reasoning-inference-example-idehen/
>     
> <https://www.linkedin.com/pulse/simple-sparql-based-query-reasoning-inference-example-idehen/>
>     -- Built-In Reasoning & Inference using British Royal Family
>     relationship types
>
>     [3]
>     
> https://www.linkedin.com/pulse/reasoning-inference-using-british-royal-family-part-idehen/
>     
> <https://www.linkedin.com/pulse/reasoning-inference-using-british-royal-family-part-idehen/>
>     -- Custom Reasoning & Inference (leveraging SPARQL as Rules
>     Language via SPIN Vocabulary terms) a using British Royal Family
>     relationship types
>
>     -- 
>     Regards,
>
>     Kingsley Idehen         
>     Founder & CEO 
>     OpenLink Software   (Home Page: http://www.openlinksw.com)
>
>     Weblogs (Blogs):
>     Legacy Blog: http://www.openlinksw.com/blog/~kidehen/
>     <http://www.openlinksw.com/blog/%7Ekidehen/>
>     Blogspot Blog: http://kidehen.blogspot.com
>     Medium Blog: https://medium.com/@kidehen
>
>     Profile Pages:
>     Pinterest: https://www.pinterest.com/kidehen/
>     <https://www.pinterest.com/kidehen/>
>     Quora: https://www.quora.com/profile/Kingsley-Uyi-Idehen
>     <https://www.quora.com/profile/Kingsley-Uyi-Idehen>
>     Twitter: https://twitter.com/kidehen
>     Google+: https://plus.google.com/+KingsleyIdehen/about
>     <https://plus.google.com/+KingsleyIdehen/about>
>     LinkedIn: http://www.linkedin.com/in/kidehen
>     <http://www.linkedin.com/in/kidehen>
>
>     Web Identities (WebID):
>     Personal: http://kingsley.idehen.net/public_home/kidehen/profile.ttl#i
>     <http://kingsley.idehen.net/public_home/kidehen/profile.ttl#i>
>             : 
> http://id.myopenlink.net/DAV/home/KingsleyUyiIdehen/Public/kingsley.ttl#this
>     
> <http://id.myopenlink.net/DAV/home/KingsleyUyiIdehen/Public/kingsley.ttl#this>
>
>
>     
> ------------------------------------------------------------------------------
>     Check out the vibrant tech community on one of the world's most
>     engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>     _______________________________________________
>     Virtuoso-users mailing list
>     Virtuoso-users@lists.sourceforge.net
>     <mailto:Virtuoso-users@lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/virtuoso-users
>     <https://lists.sourceforge.net/lists/listinfo/virtuoso-users>
>
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>
> _______________________________________________
> Virtuoso-users mailing list
> Virtuoso-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/virtuoso-users


-- 
Regards,

Kingsley Idehen       
Founder & CEO 
OpenLink Software   (Home Page: http://www.openlinksw.com)

Weblogs (Blogs):
Legacy Blog: http://www.openlinksw.com/blog/~kidehen/
Blogspot Blog: http://kidehen.blogspot.com
Medium Blog: https://medium.com/@kidehen

Profile Pages:
Pinterest: https://www.pinterest.com/kidehen/
Quora: https://www.quora.com/profile/Kingsley-Uyi-Idehen
Twitter: https://twitter.com/kidehen
Google+: https://plus.google.com/+KingsleyIdehen/about
LinkedIn: http://www.linkedin.com/in/kidehen

Web Identities (WebID):
Personal: http://kingsley.idehen.net/public_home/kidehen/profile.ttl#i
        : 
http://id.myopenlink.net/DAV/home/KingsleyUyiIdehen/Public/kingsley.ttl#this

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Reply via email to