Virtuoso has limited support for the OWL sameAs predicate.

If sameAs traversal is enabled and a triple pattern with a given subject or object is being matched, all the synonyms of the S and O will be tried and results generated for all the tried bindings of S and O. The set of synonyms is generated at run time by following all owl:sameAs triples where the IRI in question is either the subject or the object. These are followed recursively from object to subject and subject to object until the complete transitive closure is generated. All sameAs triples from all the graphs applicable to instantiating the triple pattern at hand are considered.

Thus for example:

The inital SPARQL query:

prefix foaf: <>
prefix owl: <>
prefix sioc: <>
from <>
    ?person a foaf:Person FILTER REGEX(?person ,"").
    ?person foaf:name ?name .
    ?person owl:sameAs ?sameas .
limit 8;
person                                               name             sameas
VARCHAR                                              VARCHAR          VARCHAR
_______________________________________________________________________________  Kingsley Idehen  Kingsley Idehen  Kingsley Idehen  Kingsley Idehen  Kingsley Idehen  Kingsley Idehen  Kingsley Idehen  Kingsley Idehen

8 Rows. -- 181 msec.

So if we have:

<>        <> <> .
<>        <>             Kingsley Idehen

and we instantiate ?s <> "Kingsley Idehen" we get ?s bound to <> .

If we instantiate <> <> ?l we get ?l bound to "Kingsley Idehen" because the subject was given and it was expanded to its synonyms.

If binding a variable in a pattern where the variable was free, we do not expand the value to the complete set of its synonyms.

Same-as expansion is enabled in a query by define input:same-as "yes" in the beginning of the SPARQL query. This has a significant run time cost but is in some cases useful when joining data between sets which are mapped to each other with same-as.

We note that the number of same-as expansions will depend on the join order used for the SPARQL query. The compiler does not know the number of synonyms and cannot set the join order accordingly. Regardless of the join order we will however get at least one IRI of the each synonym set as answer. Also when interactively navigating a graph with a browser, the same-as expansion will take all synonyms into account.

For getting the complete entailment of same-as, a forward chaining approach should be used, effectively asserting all the implied triples.

DEFINE input:same-as "yes"
   ?s <> "Kingsley Idehen" .

No. of rows in result: 10