Closed candlecao closed 3 months ago
@candlecao
Please read the Virtuoso OWL sameAs
Support.
short explanation: The subject or object must be given in order sameAs
traversal to start. Also, the sameAs
relations should be in the instance graph(s).
HTH
@candlecao
Please read the Virtuoso OWL
sameAs
Support.short explanation: The subject or object must be given in order
sameAs
traversal to start. Also, thesameAs
relations should be in the instance graph(s).HTH
Thank you very much. I will try it.
@imitko Hi, imitko. I tried. But it seemed the sameAs doesn't take effect: For example:
First, I prepared an .ttl file in which there are 2 triples like:
<http://example.com/dataspace/person/kidehen#this> <http://www.w3.org/2002/07/owl#sameAs> <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this> .
<http://example.com/dataspace/person/kidehen#this> <http://xmlns.com/foaf/0.1/name> "Kingsley Idehen" .
Second, I imported the .ttl file to Virtuoso as named graph http://OWL_sameAs_example. Third, I input code in ISQL:
SPARQL
DEFINE input:same-as "yes"
SELECT distinct *
WHERE
{GRAPH <http://OWL_sameAs_example>{
?s <http://xmlns.com/foaf/0.1/name> "Kingsley Idehen" .}
};
and expected to get feedback as both <http://example.com/dataspace/person/kidehen#this>
and <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this>
.
However, there is only <http://example.com/dataspace/person/kidehen#this>
fed back.
Why? It seems the <http://www.w3.org/2002/07/owl#sameAs>
doesn't work or DEFINE input:same-as "yes"
doesn't take effect.
I asked chatGPT, getting a reply:
you can enable OWL sameAs reasoning support using the Virtuoso SQL command line interface (iSQL) with the following command:
DB.DBA.RDF_OBJ_FT_RULE_ADD (, 'http://www.w3.org/2002/07/owl#sameAs', 0, 0);
This command adds the sameAs reasoning rule to the Virtuoso database.
However, I tried it, but it didn't work and reported an error:
@candlecao
The minimal example you can try re:sameAs via command-line ISQL:
TTLP (
' @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
<#ent1> <http://www.w3.org/2002/07/owl#sameAs> <#ent2> .
<#ent2> <http://www.w3.org/2002/07/owl#sameAs> <#ent3> .
<#ent3> <http://www.w3.org/2002/07/owl#sameAs> <#ent4> .
<#ent1> rdfs:label "ent1" .
', '', 'g-sas', 0);
then
SPARQL define input:same-as "yes" SELECT ?s FROM <g-sas> WHERE { ?s ?p ?o ; ?p1 "ent1" };
compare with
SPARQL SELECT ?s FROM <g-sas> WHERE { ?s ?p ?o ; ?p1 "ent1" };
BTW: GPT answer is absolutely wrong, hallucination as per usual, neither syntax nor API call are correct.
HTH
Hello, @imitko. I tried your code and it worked. But something is so weird:
If I replace your code
SPARQL define input:same-as "yes" SELECT ?s FROM <g-sas> WHERE { ?s ?p ?o ; ?p1 "ent1" };
to
SPARQL define input:same-as "yes" SELECT ?s FROM <g-sas> WHERE { ?s ?p "ent1" };
, the feedback is different!? Why?!
And another my case is like this:
TTLP (
'@prefix wdt: <http://www.wikidata.org/prop/direct/> .
<#InstanceA_local> <http://www.w3.org/2002/07/owl#sameAs> <#InstanceA_wiki> .
<#InstanceB_local> <http://www.w3.org/2002/07/owl#sameAs> <#InstanceB_wiki> .
<#InstanceA_local> wdt:P136 <#InstanceB_local> .
', '', 'http://g-sameAs', 0);
(you know, I just want to use this example to generate <#InstanceA_wiki> wdt:P136 <#InstanceB_wiki>
.)
then I query via ISQL by imitating your code:
SPARQL
define input:same-as "yes"
prefix wdt: <http://www.wikidata.org/prop/direct/>
SELECT * FROM <http://g-sameAs>
WHERE {
?s ?p ?o ;
wdt:P136 <#InstanceB_local> };
The expected result should contain <#InstanceA_wiki> wdt:P136 <#InstanceB_local>
. However it didn't appear in the feedback after execution. I don't know why.
Would you please kindly further check it? Thank you.
In terms of OpenLink Virtuoso, I want to realize the knowledge inference based on OWL.
But I don't know how to realize this for the occasion as below: if in an RDF instance graph,there is a triple
<InstanceA> <propertyX> <InstanceB>
.and in an OWL document, there is content as:
then,what I expect to supplement is:
<Instance_a> <propertyX> <Instance_b>.
--I mean I want to retrieve this triple with the activated inference function.Regarding above, I tried operating like this:
<Instance_a> owl:sameAs <InstanceA>.
And<Instance_b> owl:sameAs <InstanceB>.
<http://sampleForReasoning/ontology>
for it.<http://sampleForReasoning/instance>
where there is triple that is:<InstanceA> <propertyX> <InstanceB>
. And also there are triples including<Instance_a>
and<Instance_b>
.<http://sampleForReasoning/ontology>
named graph:rdfs_rule_set ('urn:owl.music', 'http://sampleForReasoning/ontology') ;
However, the result returned is only still
<InstanceA> <propertyX> <InstanceB>
, there is no inferred triple such as<Instance_a> <propertyX> <Instance_b>
.How to solve the problem?
Actually I know how to realize inference in Virtuoso based on T-box (such as classes and properties) to generate latent triples of instances, but here the
owl:sameAs
is about A-box (instances). Then I just don't know how to deal with it.