Search code examples
rdfsemantic-webshex

How do state multiple type constraints in ShEx?


If I have data like

@prefix my: <http://example.com/>
my:student1 a my:Student .
my:student1 a my:FoodballPlayer .
my:teacher2 a my:Teacher .
my:teacher2 a my:BaseballPlayer .
my:teacher2 a my:RugbyPlayer .

and I want to say the subjects are either students or teachers and they may be zero or more of football, baseball or rugby players, how do I write that in ShEx? I know this works for one type arc:

my:person {
  a [my:Student my:Teacher]
}

Solution

  • You don't need to do anything different than for one type arc constraint; just add another with your my:*Player value set:

    PREFIX my: <http://example.com/>
    my:person {
      a [my:Student my:Teacher];
      a [my:FootballPlayer my:BaseballPlayer my:RugbyPlayer]+
    }
    

    demo