0

I built a Java pipeline that creates rdf triples from song lyrics and I would like to use an ontology to classify different types of songs.

I also wanted to count how many times each term occurs in the song (aside from the built-in cardinality which I have used to define the classes of songs). Finally, I wanted to be able to use a visual aid like graphDB or graphViz in Protege to compare what tagged words are more common in songs (this is why i have TaggedWordRelation class, to compare individuals specifically to one another).

I have the following statements in my Protege document that, when reasoned with Fact, Hermit, Pellet etc. locks my computer in an infinite-loop-esque manner. I can not get the reasoner to tell what kind of song it is:

Object Property: hasTaggedWordRelation
-domain:Song
-range:TaggedWord

Object Property: taggedWord
-domain: TaggedWordRelation
-range: Word

Class: Word is defined

Class: TaggedWordRelation is defined

Class: LoveWordRelation is defined
-subclass of TaggedWordRelation
-taggedWord some LoveWord

Class: LoveSong is defined -subclass of Song
-hasTaggedWordRelation some LoveWordRelation
-hasTaggedWordRelation exactly 0 HateWordRelation
-hasTaggedWordRelation min 0 SexWordRelation
-hasTaggedWordRelation min 0 GodWordRelation

Class: ReligiousSong is defined
-subclass of Song
-hasTaggedWordRelation some LoveWordRelation
-hasTaggedWordRelation exactly 0 HateWordRelation
-hasTaggedWordRelation exactly 0 SexWordRelation
-hasTaggedWordRelation some GodWordRelation

Basically I have about 6 different type of Song, I want to infer (using a reasoner and the constraints), the subclass of a Song instance based on the individual taggedWordRelations it has (via the object property). The pipeline outputs Song instances but I want the reasoner to infer their class based on the cardinality constraints I defined in the subClassOf definitions. Protege's error explanation is saying something about my Object Properties not satisfying cardinality...

  • not that I understand what you want to infer, but: that's not gonna work. First of all you have `SomeSongType SubClassOf: Song and someMoreFeatures` - so if you have an individual `x` that has those `someMoreFeatures` it won't work to infer that `x` belongs to `SomeSongType` because `SubClassOf` is basically "if-then" and just says *"Every SomeSongType is a song and has someMoreFeatures"* . But you would need the other direction, i.e. `(Song and someMoreFeatures) SubClassOf: SomeSongType`. Like *"Everything that is a song and has soemMoreFeatures is a SomeSongType"* – UninformedUser Nov 15 '20 at 14:13
  • But even then it won't work because of the Open World Assumption in OWL. You're using cardinality restrictions like `hasTaggedWordRelation exactly 0 HateWordRelation`, but in OWL the absence of information doesn't mean it does not exists at all, we just don't know if there is something somewhere. So a reasoner would never know that a song doesn't have some hate word relation even if there is nothing in the ontology. – UninformedUser Nov 15 '20 at 14:16
  • 1) So reason in both directions... I should make an EquivalentTo axiom from Song to subSong with the correctly implemented additional feature requirements? 2) My reason for this "Exactly 0" cardinality constraint is that I want to infer Song subClass by the appearance of (or by not allowing) the various WordRelation, I had a feeling this was ham-fisted. Would saying not(hasTaggedWordRealtion some HateWordRelation) be better? TYVM again for the reply!! – PlasticCasio Nov 15 '20 at 16:32
  • Regarding the infinite loop situation you describe, I wouldn't expect any of the reasoners to get stuck on the ontology as described - there might be something you've left out that's tripping them up. Best way for us to help is to post the actual ontology contents, if possible. – Ignazio Nov 15 '20 at 20:59
  • My "infinite loop" situations was a result of having 2 domains and one range in the object property (hasWordRelation) I believe. – PlasticCasio Nov 19 '20 at 14:23
  • Two domains and one range should not pose a challenge. – Ignazio Nov 20 '20 at 20:46
  • You're correct, it did not. The problem, as @UninformedUser stated, has to do with malformed constraints better suited to SHACL or individual SPARQL queries. Thanks for the reply!!! – PlasticCasio Nov 21 '20 at 01:19
  • is it `TaggedWordRelation` or `TaggedWord`? the very first `domain` uses `TaggedWord` but that class doesn't seem to be defined. Also, two domains is BAD: it means every time you use that prop, the subject gets those two classes as `rdf:type` – Vladimir Alexiev Feb 12 '21 at 12:18

0 Answers0