basic noob question - adding properties to classes
stevenemrick opened this issue · 7 comments
I have a data structure as follows - each row contains a class.
Id | Name | parentId | myFavorite |
---|---|---|---|
1 | First Level | ||
2 | Second Level | ||
3 | Third Level | ||
4 | First child | 1 | N |
5 | Second Child | 2 | N |
6 | Third Child | 3 | Y |
So the classes with no parentId are the top levels, and subclasses reference their respective parentID. Each class has a property, myFavorite, which could be null but is a boolean when filled it is not null. I can import the classes easily, but how do I create a myFavorite property on each class and define as an xsd:boolean? This is where I am getting stuck. Thank you.
Perhaps I am misunderstanding your question, but in OWL data properties are used to associate an OWL individuals with a value. Properties cannot be associated with classes in the way you desire.
FYI, I'd recommend the Protege mailing list for further questions: https://protege.stanford.edu/support.php
It has a very active community.
I think this rule would do exactly what you want:
Class: @A*(rdf:id)
Annotations: rdfs:label @B*
SubClassOf: @C*
SubClassOf: isMyFavorite value @D*(xsd:boolean mm:replaceAll("Y","true"))
PS: Took me some time to figure it out how to write this so that it works, so not a newbie question at all. But as @martinjoconnor said, such questions should go to the mailing list.
Quick note to @stevenemrick : You will need to create a datatype property called isMyFavorite
in your ontology, before you run the rule that I suggested.
ok thank you @martinjoconnor and @csnyulas. Yes the example I had above used a boolean data property. Your examples were helpful. If I may, is ObjectProperty allowed to be imported? Say I had an additional column called favoriteSport (and that I've declared in my ontology) as a property of each class - can I import it in? It seems like it is not supported but wanted to verify.
ok - figured this one out - thanks again!
As you figured it out, I assume, you can create axioms that use ObjectSomeValuesFrom
, ObjectAllValuesFrom
, ObjectHasValue
, and other class expressions that refer to object properties.
The object properties, themselves, can come from the spreadsheet. Here are some examples.
Yes - I found the grocery store tutorial which was very useful. Thanks.