Chris; Yes it is possible to define classes with distinct members.
There isn't a direct way to do this in OWL, as owl:AllDifferent can
contain any resource - classes, properties, instances, etc., and does
not make any distinctions about class membership.  owl:disjointWith
just states that two classes cannot contain the same members, so
that's also unhelpful for your use case.

You can write some SPARQL queries that define owl:AllDifferent (or
owl:differentFrom if you prefer) for each member of a class.

First, Composer supports creating classes with distinct class
members.  Create a class and select it so it appears in the Form
view.  Then click the context menu (small triangle in upper-right of
Form View) and choose "Create class members...".  Provide names for
the members and check "Declare all values distinct" on the bottom of
the dialog box.  This will create an instance of owl:AllDifferent with
the list of members created.

Maintaining this list once created is a bit more difficult, but not
impossible.  Class membership can change dynamically, both adding and
removing members.  The best way I can think of to maintain
correspondence between the AllDifferent list and class membership is
to periodically run a script that removes the current list and re-
creates one from the current class memberships.  SPARQLMotion is very
good for this kind of operation.  You can define a script and have it
execute whenever an operation takes place that may change class
membership (including a SPIN constructor).

Here's a concrete example.  There are doubtless many variations of
this theme.  One idea is to add a property to the owl:AllDifferent
instance identifying the class.  E.g.
{_:b0 :isAssociatedWithClass :myClass}.  Then run the following two
queries in succession:

#use tops:dependOn to remove the full list in owl:members
DELETE {?s ?p ?o}
WHERE
{  ?alldiff a owl:AllDifferent .
   ?alldiff :isAssociatedWithClass ?class . # only do this for
AllDifferent members associated with a class being "tracked"
   ?alldiff owl:members ?diffList .
   (?s ?p ?o) tops:dependsOn ?diffList .
   FILTER (?p = rdf:first || ?p = rdf:rest || ?p = owl:members)
}

#use tops:constructRDFList to create a list of current members of a
class
INSERT
{  ?alldiff owl:members ?list .
   ?subList rdf:first ?element .
   ?subList rdf:rest ?rest .
}
WHERE
{  ?alldiff a owl:AllDifferent .
   ?alldiff :isAssociatedWithClass ?class . # only do this for
AllDifferent members associated with a class being "tracked"
   (?list ?subList ?element ?rest) tops:constructRDFList (?inst
rdf:type ?class ) .
}

To put this in a SPARQLMotion script, use PerformUpdate modules for
each of the queries.  Add a script import of the model you want to run
the script on and use its base URI to specify the GRAPH in the DELETE
and INSERT clauses.

As stated, there are some variations of this example that will meet
the criteria of maintaining the relationships that all members of a
class are distinct.  One is to use owl:differentFrom in pairwise
relationships.  An advantage of that is that the list is maintained on
each instance, as opposed to a separate owl:AllDifferent list.  That
would involve a similar set of queries that one can probably figure
out from this example (but ask if you like us to try).

Let us know if there are any questions or clarifications needed.

-- Scott

On Feb 2, 8:38 am, chris <[email protected]> wrote:
> Hi,
>
> is it possible to create a class with only distinct members? That
> means new individual of this class will automatically become distinct
> from all existing individuals of this class without adding it explicit
> to owl:Alldifferent.
>
> Thanks,
>
> Christoph

-- 
You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary 
Network (EVN), TopBraid Composer,
TopBraid Live, TopBraid Ensemble, SPARQLMotion and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en

Reply via email to