Exemplo n.º 1
0
 def test_alumniSuperproperty(self):
   p_alumni = VTerm.getTerm("alumni")
   p_alumniOf = VTerm.getTerm("alumniOf")
   p_suggestedAnswer = VTerm.getTerm("suggestedAnswer")
   self.assertFalse(p_alumni in p_suggestedAnswer.getSupers(), "not suggestedAnswer subPropertyOf alumni.")
   self.assertFalse(p_suggestedAnswer in p_alumni.getSupers(), "not alumni subPropertyOf suggestedAnswer.")
   self.assertFalse(p_alumni in p_alumni.getSupers(), "not alumni subPropertyOf alumni.")
   self.assertFalse(p_alumniOf in p_alumni.getSupers(), "not alumni subPropertyOf alumniOf.")
   self.assertFalse(p_suggestedAnswer in p_suggestedAnswer.getSupers(), "not suggestedAnswer subPropertyOf suggestedAnswer.")
Exemplo n.º 2
0
  def test_alumniInverse(self):
    p_alumni = VTerm.getTerm("alumni")
    p_alumniOf = VTerm.getTerm("alumniOf")
    p_suggestedAnswer = VTerm.getTerm("suggestedAnswer")

    #log.info("alumni: " + str(p_alumniOf.getInverseOf() ))

    self.assertTrue(p_alumni == p_alumniOf.getInverseOf(), "alumniOf inverseOf alumni." )
    self.assertTrue(p_alumniOf == p_alumni.getInverseOf(), "alumni inverseOf alumniOf." )

    self.assertFalse(p_alumni == p_alumni.getInverseOf(), "Not alumni inverseOf alumni." )
    self.assertFalse(p_alumniOf == p_alumniOf.getInverseOf(), "Not alumniOf inverseOf alumniOf." )
    self.assertFalse(p_alumni == p_suggestedAnswer.getInverseOf(), "Not answer inverseOf alumni." )
Exemplo n.º 3
0
 def test_FooBarIsNotClass(self):
   tFooBar = VTerm.getTerm("FooBar")
   try:
     tFooBarIsClass = tFooBar.isClass()
     self.assertFalse(tFooBarIsClass, "FooBar is not a class (should be None)")
     log.info("FooBar:" + str(tFooBar) )
   except:
     log.debug("Failed to get FooBar, as expected. So can't ask it if it isClass().")
Exemplo n.º 4
0
 def test_enumCommentCount(self):
   enum_comment_errors=[]
   for ev in VTerm.getAllEnumerations():
     comments = ev.getGetComments()
     log.debug("enumeration '%s': Expected 1 rdfs:comment, found: %s.\n" % ( ev.getId(), str(len(comments)  )) )
     if len(comments) != 1:
      enum_comment_errors.append ("enumerated value %s: Expected 1 rdfs:comment, found: %s.\n %s" % (e.id, len(comments), andstr.join(comments) ) )
   log.debug("enum comment count: "+ str(len(enum_comment_errors)))
   self.assertTrue(len(enum_comment_errors)==0, "Comment count enumeration errors. Aggregated: \n\n" + " \n".join(enum_comment_errors))
Exemplo n.º 5
0
  def test_gotThing(self):

     thing = VTerm.getTerm("Thing")
     if thing is None:
       gotThing = False
     else:
       gotThing = True

     self.assertEqual( gotThing, True, "Thing node should be accessible via GetUnit('Thing').")
Exemplo n.º 6
0
 def test_propCommentCount(self):
   prop_comment_errors=[]
   for p in VTerm.getAllProperties():
     comments = p.getComments()
     log.debug("property %s props %s" % (p.getId(), str(len(comments)) ))
     if len(comments) != 1:
       prop_comment_errors.append ("property '%s': Expected 1 rdfs:comment, found: %s.\n %s" % (p.getId(), len(comments), andstr.join(comments) ) )
   log.debug("property comment count: %s\n" % str(len(prop_comment_errors)))
   self.assertEqual(len(prop_comment_errors), 0, "Comment count property errors. Aggregated: \n\n" + " \n\n".join(prop_comment_errors))
Exemplo n.º 7
0
 def test_typeCommentCount(self):
   type_comment_errors=[]
   for t in VTerm.getAllTypes():
     comments = t.getComments()
     log.debug(t.getId() + " " + str(len(comments)))
     if len(comments) != 1:
      type_comment_errors.append ("type '%s': Expected 1 rdfs:comment, found: %s.\n %s" % (t.getId(), len(comments), andstr.join(comments) ) )
   log.debug("type comment count: "+ str(len(type_comment_errors)))
   self.assertTrue(len(type_comment_errors)==0, "Comment count type errors. Aggregated: \n" + " \n\n".join(type_comment_errors))
Exemplo n.º 8
0
  def test_gotFooBarThing(self):

     foobar = VTerm.getTerm("FooBar")
     if foobar is None:
       gotFooBar = False
     else:
       gotFooBar = True

     self.assertEqual( gotFooBar, False, "Thing node should NOT be accessible via GetUnit('FooBar').")
Exemplo n.º 9
0
 def test_DataTypeSupertypeDataType(self):
     tDataType = VTerm.getTerm("DataType")
     self.assertTrue(tDataType.subClassOf(tDataType),
                     "DataType subClassOf DataType.")
Exemplo n.º 10
0
 def test_NewsArticleSupertypeArticle(self):
     tNewsArticle = VTerm.getTerm("NewsArticle")
     tArticle = VTerm.getTerm("Article")
     self.assertFalse(tArticle.subClassOf(tNewsArticle),
                      "Article is not a sub-type of NewsArticle")
Exemplo n.º 11
0
 def test_EnumerationIsEnumeration(self):
     eEnumeration = VTerm.getTerm("Enumeration")
     self.assertTrue(eEnumeration.isEnumeration(),
                     "Enumeration is an Enumeration type.")
Exemplo n.º 12
0
 def test_answerSubpropertiesArrayLen(self):
     p_suggestedAnswer = VTerm.getTerm("suggestedAnswer")
     log.info("suggestedAnswer array: " + str(p_suggestedAnswer.getSubs()))
     self.assertEqual(p_suggestedAnswer.getSubs(), 0,
                      "answer subproperties() gives array of len 1.")
Exemplo n.º 13
0
 def test_EventCancelledIsEnumerationValue(self):
     eEventCancelled = VTerm.getTerm("EventCancelled")
     self.assertTrue(eEventCancelled.isEnumerationValue(),
                     "EventCancelled is an Enumeration value.")
Exemplo n.º 14
0
 def test_answerSubpropertiesArrayLen(self):
   p_offers = VTerm.getTerm("offers")
   self.assertEqual(len(p_offers.getSubs()), 0, "offers subproperties() gives array of len 0.")
Exemplo n.º 15
0
 def test_GetImmediateSubtypesWrong(self):
     tArticle = VTerm.getTerm("CreativeWork")
     self.assertFalse(
         VTerm.getTerm("NewsArticle") in tArticle.getSubs(),
         "CreativeWork is not in immediate subtypes of Article.")
Exemplo n.º 16
0
 def test_answerSubproperties(self):
   p_suggestedAnswer = VTerm.getTerm("suggestedAnswer")
   p_acceptedAnswer = VTerm.getTerm("acceptedAnswer")
   self.assertTrue(p_acceptedAnswer == p_suggestedAnswer.getSubs()[0], "suggestedAnswer subproperties(), acceptedAnswer in 0th element of array.")
Exemplo n.º 17
0
 def test_answerSubpropertiesArrayLen(self):
   p_suggestedAnswer = VTerm.getTerm("suggestedAnswer")
   log.info("suggestedAnswer array: "+ str(p_suggestedAnswer.getSubs() ))
   self.assertEqual(p_suggestedAnswer.getSubs(), 0, "answer subproperties() gives array of len 1.")
Exemplo n.º 18
0
 def test_answerSubproperty(self):
   p_suggestedAnswer = VTerm.getTerm("suggestedAnswer")
   p_acceptedAnswer = VTerm.getTerm("acceptedAnswer")
   subs = p_suggestedAnswer.getSubs()
   self.assertTrue(p_acceptedAnswer in subs, "acceptedAnswer is a subPropertyOf suggestedAanswer.")
Exemplo n.º 19
0
 def test_acceptedAnswerSuperpropertiesArrayLen(self):
   p_acceptedAnswer = VTerm.getTerm("acceptedAnswer")
   aa_supers = p_acceptedAnswer.getSupers()
   for f in aa_supers:
       log.info("acceptedAnswer's subproperties(): %s" % f.id)
   self.assertTrue( len(aa_supers) == 1, "acceptedAnswer subproperties() gives array of len 1. Actual: %s ." % len(aa_supers) )
Exemplo n.º 20
0
 def test_offersNotSupersededByActor(self):
   p_actor = VTerm.getTerm("actor")
   p_offers = VTerm.getTerm("offers")
   self.assertFalse(p_offers in p_actor.getSupersedes(), "offers property doesn't supersede actors property.")
Exemplo n.º 21
0
 def test_actorNotSupersededByOffers(self):
   p_actor = VTerm.getTerm("actor")
   p_offers = VTerm.getTerm("offers")
   self.assertFalse(p_actor in p_offers.getSupersedes(), "actor property doesn't supersede offers property.")
Exemplo n.º 22
0
 def test_actorSupersedesActors(self):
   p_actor = VTerm.getTerm("actor")
   p_actors = VTerm.getTerm("actors")
   self.assertTrue(p_actors in p_actor.getSupersedes(), "actor supersedes actors.")
Exemplo n.º 23
0
 def test_PersonNotAttribute(self):
     tPerson = VTerm.getTerm("Person")
     self.assertFalse(tPerson.isProperty(),
                      "Not true that Person isAttribute().")
Exemplo n.º 24
0
 def test_GetImmediateSubtypesWrong(self):
   tArticle = VTerm.getTerm("CreativeWork")
   self.assertFalse(VTerm.getTerm("NewsArticle") in tArticle.getSubs(), "CreativeWork is not in immediate subtypes of Article.")
Exemplo n.º 25
0
 def test_actorNotSuperseded(self):
   p_actor = VTerm.getTerm("actor")
   self.assertFalse(p_actor.superseded(), "actor property has not been superseded.")
Exemplo n.º 26
0
 def test_EventStatusTypeIsEnumeration(self):
   eEventStatusType = VTerm.getTerm("EventStatusType")
   self.assertTrue(eEventStatusType.isEnumeration(), "EventStatusType is an Enumeration.")
Exemplo n.º 27
0
 def test_EventStatusTypeIsEnumeration(self):
     eEventStatusType = VTerm.getTerm("EventStatusType")
     self.assertTrue(eEventStatusType.isEnumeration(),
                     "EventStatusType is an Enumeration.")
Exemplo n.º 28
0
 def test_EventStatusTypeIsntEnumerationValue(self):
   eEventStatusType = VTerm.getTerm("EventStatusType")
   self.assertFalse(eEventStatusType.isEnumerationValue(), "EventStatusType is not an Enumeration value.")
Exemplo n.º 29
0
 def test_dualPath(self):
     self.assertEqual(
         len(
             GetParentPathTo(VTerm.getTerm("Restaurant"),
                             VTerm.getTerm("Thing"))), 2,
         "2 supertype paths from Restaurant to Thing.")
Exemplo n.º 30
0
 def test_EventCancelledIsEnumerationValue(self):
   eEventCancelled = VTerm.getTerm("EventCancelled")
   self.assertTrue(eEventCancelled.isEnumerationValue(), "EventCancelled is an Enumeration value.")
Exemplo n.º 31
0
 def test_ItemAvailabilityIsEnumeration(self):
     eItemAvailability = VTerm.getTerm("ItemAvailability")
     self.assertTrue(eItemAvailability.isEnumeration(),
                     "ItemAvailability is an Enumeration.")
Exemplo n.º 32
0
 def test_EventTotallyFooBarIsntEnumerationValue(self):
   eEventCancelledFB = VTerm.getTerm("EventTotallyFooBar")
   if eEventCancelledFB is not None:
     self.assertFalse(eEventCancelledFB.isEnumerationValue(), "EventTotallyFooBar is not an Enumeration value, not even a node.")
   self.assertTrue(eEventCancelledFB is None, "EventTotallyFooBar should not resolve to a node.")
Exemplo n.º 33
0
 def test_ArticleSupertypeNewsArticle(self):
     tNewsArticle = VTerm.getTerm("NewsArticle")
     tArticle = VTerm.getTerm("Article")
     self.assertTrue(tNewsArticle.subClassOf(tArticle),
                     "NewsArticle is a sub-type of Article")
Exemplo n.º 34
0
 def test_ThingNotSupertypePerson(self):
     tThing = VTerm.getTerm("Thing")
     tPerson = VTerm.getTerm("Person")
     self.assertFalse(tThing.subClassOf(tPerson),
                      "Thing not subClassOf Person.")
Exemplo n.º 35
0
 def test_ThingSupertypeThing(self):
     tThing = VTerm.getTerm("Thing")
     self.assertTrue(tThing.subClassOf(tThing), "Thing subClassOf Thing.")
Exemplo n.º 36
0
 def test_StoresArePlaces(self):
     tStore = VTerm.getTerm("Store")
     tPlace = VTerm.getTerm("Place")
     self.assertTrue(tStore.subClassOf(tPlace), "Store subClassOf Place.")
Exemplo n.º 37
0
 def test_PersonSupertypeThing(self):
     tThing = VTerm.getTerm("Thing")
     tPerson = VTerm.getTerm("Person")
     self.assertTrue(tPerson.subClassOf(tThing), "Person subClassOf Thing.")
Exemplo n.º 38
0
 def test_offersNotSuperseded(self):
   p_offers = VTerm.getTerm("offers")
   self.assertFalse(p_offers.superseded(), "offers property has not been superseded.")
Exemplo n.º 39
0
 def test_StoreSupertypeLocalBusiness(self):
     tStore = VTerm.getTerm("Store")
     tLocalBusiness = VTerm.getTerm("LocalBusiness")
     self.assertTrue(tStore.subClassOf(tLocalBusiness),
                     "Store subClassOf LocalBusiness.")
Exemplo n.º 40
0
 def test_actorsSuperseded(self):
     p_actors = VTerm.getTerm("actors")
     self.assertTrue(p_actors.superseded(),
                     "actors property has been superseded.")
Exemplo n.º 41
0
 def test_StoresAreOrganizations(self):
     tStore = VTerm.getTerm("Store")
     tOrganization = VTerm.getTerm("Organization")
     self.assertTrue(tStore.subClassOf(tOrganization),
                     "Store subClassOf Organization.")
Exemplo n.º 42
0
 def test_offersNotSuperseded(self):
     p_offers = VTerm.getTerm("offers")
     self.assertFalse(p_offers.superseded(),
                      "offers property has not been superseded.")
Exemplo n.º 43
0
 def test_GetImmediateSubtypesOk(self):
     tArticle = VTerm.getTerm("Article")
     self.assertTrue(
         VTerm.getTerm("NewsArticle") in tArticle.getSubs(),
         "NewsArticle is in immediate subtypes of Article.")
Exemplo n.º 44
0
 def test_offersNotSupersededByActor(self):
     p_actor = VTerm.getTerm("actor")
     p_offers = VTerm.getTerm("offers")
     self.assertFalse(p_offers in p_actor.getSupersedes(),
                      "offers property doesn't supersede actors property.")
Exemplo n.º 45
0
 def test_actorSupersedesActors(self):
     p_actor = VTerm.getTerm("actor")
     p_actors = VTerm.getTerm("actors")
     self.assertTrue(p_actors in p_actor.getSupersedes(),
                     "actor supersedes actors.")
Exemplo n.º 46
0
 def test_actorsSuperseded(self):
   p_actors = VTerm.getTerm("actors")
   self.assertTrue(p_actors.superseded(), "actors property has been superseded.")
Exemplo n.º 47
0
 def test_actorNotSuperseded(self):
     p_actor = VTerm.getTerm("actor")
     self.assertFalse(p_actor.superseded(),
                      "actor property has not been superseded.")
Exemplo n.º 48
0
 def test_booleanDataType(self):
   self.assertTrue(VTerm.getTerm("Boolean").isDataType())
   self.assertTrue(VTerm.getTerm("DataType").isDataType())
   self.assertFalse(VTerm.getTerm("Thing").isDataType())
   self.assertFalse(VTerm.getTerm("Duration").isDataType())
Exemplo n.º 49
0
 def test_actorNotSupersededByOffers(self):
     p_actor = VTerm.getTerm("actor")
     p_offers = VTerm.getTerm("offers")
     self.assertFalse(p_actor in p_offers.getSupersedes(),
                      "actor property doesn't supersede offers property.")
Exemplo n.º 50
0
 def test_html_tree(self):
     uThing = VTerm.getTerm("Thing")
     mainroot = TypeHierarchyTree("local_label")
     mainroot.traverseForHTML(uThing, layers="core", idprefix="C.")
     html = mainroot.toHTML()
     self.assertTrue( html != None and len(html) > 0, "traverseForHTML should return content")
Exemplo n.º 51
0
 def test_answerSubproperty(self):
     p_suggestedAnswer = VTerm.getTerm("suggestedAnswer")
     p_acceptedAnswer = VTerm.getTerm("acceptedAnswer")
     subs = p_suggestedAnswer.getSubs()
     self.assertTrue(p_acceptedAnswer in subs,
                     "acceptedAnswer is a subPropertyOf suggestedAanswer.")
Exemplo n.º 52
0
 def test_jsonld_tree(self):
     uThing = VTerm.getTerm("Thing")
     mainroot = TypeHierarchyTree()
     mainroot.traverseForJSONLD(uThing, layers="core")
     thing_tree = mainroot.toJSON()
     self.assertTrue( thing_tree != None and len(thing_tree) > 0, "traverseForJSONLD should return content")
Exemplo n.º 53
0
 def test_answerSubpropertiesArrayLen(self):
     p_offers = VTerm.getTerm("offers")
     self.assertEqual(len(p_offers.getSubs()), 0,
                      "offers subproperties() gives array of len 0.")
Exemplo n.º 54
0
    def test_simplePath(self):

      self.assertEqual(  len(
                  GetParentPathTo(VTerm.getTerm("CreativeWork"), VTerm.getTerm("Thing"))
                  ), 1, "1 supertype path from CreativeWork to Thing."  )
Exemplo n.º 55
0
 def test_EventStatusTypeIsntEnumerationValue(self):
     eEventStatusType = VTerm.getTerm("EventStatusType")
     self.assertFalse(eEventStatusType.isEnumerationValue(),
                      "EventStatusType is not an Enumeration value.")
Exemplo n.º 56
0
 def test_dualPath(self):
   self.assertEqual(  len(
               GetParentPathTo(VTerm.getTerm("Restaurant"), VTerm.getTerm("Thing"))
               ), 2, "2 supertype paths from Restaurant to Thing."  )
Exemplo n.º 57
0
 def test_booleanDataType(self):
     self.assertTrue(VTerm.getTerm("Boolean").isDataType())
     self.assertTrue(VTerm.getTerm("DataType").isDataType())
     self.assertFalse(VTerm.getTerm("Thing").isDataType())
     self.assertFalse(VTerm.getTerm("Duration").isDataType())
Exemplo n.º 58
0
 def test_inverseDualPath(self):
   self.assertEqual(  len(
               GetParentPathTo(VTerm.getTerm("Thing"), VTerm.getTerm("Restaurant"))
               ), 0, "0 supertype paths from Thing to Restaurant."  )
Exemplo n.º 59
0
 def test_inverseDualPath(self):
     self.assertEqual(
         len(
             GetParentPathTo(VTerm.getTerm("Thing"),
                             VTerm.getTerm("Restaurant"))), 0,
         "0 supertype paths from Thing to Restaurant.")
Exemplo n.º 60
0
 def test_QuantityisClass(self):
     tQuantity = VTerm.getTerm("Quantity")
     self.assertTrue(tQuantity.isClass(), "Quantity is a class.")