Ejemplo n.º 1
0
def testGetSubClasses():
    ontology = OntologyLib()
    ref = ontology.toURIRef("NOSQL")
    result = ontology.getSubClasses(ref)

    for o in result:
        print type(o), ":", o
Ejemplo n.º 2
0
def testGetSubClasses():
    ontology = OntologyLib()
    ref = ontology.toURIRef("NOSQL")
    result = ontology.getSubClasses(ref)
    
    for o  in result:
        print type(o), ":" , o
Ejemplo n.º 3
0
def test_getSimilarityPair():
    ontology = OntologyLib("web_dev.owl")
    pairs = ontology.getSimilarityPairs()
    i = 0
    for pair in pairs:
        ref1, ref2 = pair
        i += 1
        print i, " : ", (ref1.rsplit('#')[-1]), "---", (ref2.rsplit('#')[-1])
Ejemplo n.º 4
0
def test_getSimilarityPair():
    ontology = OntologyLib("web_dev.owl")
    pairs = ontology.getSimilarityPairs()
    i = 0
    for pair in pairs:
        ref1, ref2 = pair   
        i+=1
        print i, " : " , (ref1.rsplit('#')[-1]) , "---" ,  (ref2.rsplit('#')[-1]) 
Ejemplo n.º 5
0
def testFindSuperClass():
    ontology = OntologyLib("web_dev.owl")
    ref = ontology.toURIRef("Nosql_Database")
    print ref
    result = ontology.getSuperClass(ref)
    
    for o  in result:
        print type(o), ":" , o
        a = ontology.getSuperClass(o)
        for o2  in a:
            print type(o2), ":" , o2
Ejemplo n.º 6
0
def testFindSuperClass():
    ontology = OntologyLib("web_dev.owl")
    ref = ontology.toURIRef("Nosql_Database")
    print ref
    result = ontology.getSuperClass(ref)

    for o in result:
        print type(o), ":", o
        a = ontology.getSuperClass(o)
        for o2 in a:
            print type(o2), ":", o2
Ejemplo n.º 7
0
def testGetLabels():
    ontology = OntologyLib("web_dev.owl")
    result = ontology.getLabels(ontology.ns.Nosql_Database)
    for r in result:
        print r
    return

    result = ontology.getAllLabels()
    #for entity, label  in result:
    #    print type(label), ":" , label

    termdict = ontology.getLabelDict()
    printLableDict(termdict)
Ejemplo n.º 8
0
def testGetLabels():
     ontology = OntologyLib("web_dev.owl")    
     result = ontology.getLabels(ontology.ns.Nosql_Database)
     for r in result :
         print r
     return
     
     result = ontology.getAllLabels()    
     #for entity, label  in result:
     #    print type(label), ":" , label
     
     termdict = ontology.getLabelDict()
     printLableDict( termdict )
Ejemplo n.º 9
0
def test_isSuperClass():
    ontology = OntologyLib("web_dev.owl")
    ref1 = ontology.toURIRef("Nosql_Database")
    ref2 = ontology.toURIRef("Database")
    ref3 = ontology.toURIRef("Software")
    print ontology.isSuperClass(ref1, ref2)
    print ontology.isSuperClass(ref1, ref3)
    print ontology.isSuperClass(ref2, ref3)
    print ontology.isSuperClass(ref3, ref2)
Ejemplo n.º 10
0
def test_isSuperClass():
    ontology = OntologyLib("web_dev.owl")
    ref1 = ontology.toURIRef("Nosql_Database")
    ref2 = ontology.toURIRef("Database")
    ref3 = ontology.toURIRef("Software")
    print ontology.isSuperClass( ref1, ref2 )
    print ontology.isSuperClass( ref1, ref3 )
    print ontology.isSuperClass( ref2, ref3 )
    print ontology.isSuperClass( ref3, ref2 )
Ejemplo n.º 11
0
def test_getTokenDict():
    ontology = OntologyLib()
    printLableDict(ontology.tokenDict)
Ejemplo n.º 12
0
def printGraph():
    ontology = OntologyLib("web_dev.owl")
    listGraph(ontology.g)
Ejemplo n.º 13
0
def test_getClasses():
    ontology = OntologyLib("web_dev.owl")
    classes = ontology.getClasses()
    for c in classes:
        print c
Ejemplo n.º 14
0
def testGetClassnames():
     ontology = OntologyLib("web_dev.owl")
     for n in ontology.getAllClassNames():
         print n
Ejemplo n.º 15
0
def test_getTerms():
    ontology = OntologyLib("web_dev.owl")
    ref1 = ontology.toURIRef("Nosql_Database")
    print ontology.getTerms(ref1)
Ejemplo n.º 16
0
def test_haveSameSuperClass():
    ontology = OntologyLib("web_dev.owl")
    ref1 = ontology.toURIRef("Database")
    ref2 = ontology.toURIRef("MySQL")
    ref3 = ontology.toURIRef("Software") 
    ref4 = ontology.toURIRef("Sql_Server")
    ref5 = ontology.toURIRef("Nosql_Database") 
    ref6 = ontology.toURIRef("Relational_Database") 
  #  print ref4
  #  result = ontology.getSuperClass(ref4)
    
    print ontology.haveSameSuperClass(ref4, ref2)
    print ontology.haveSameSuperClass(ref2, ref3)
    print ontology.haveSameSuperClass(ref5, ref6)
    print ontology.haveSameSuperClass(ref5, ref4)
Ejemplo n.º 17
0
def test_getClasses():
    ontology = OntologyLib("web_dev.owl")
    classes = ontology.getClasses()
    for c in classes:
        print c
Ejemplo n.º 18
0
def test_getFullDict():
    ontology = OntologyLib("web_dev.owl")
    fullDict = ontology.getFullDict()
    for label, className in fullDict.items():
        print label, "->", className
Ejemplo n.º 19
0
def test_getLabelDict():
    ontology = OntologyLib("web_dev.owl")
    for  label , className in ontology.getLabelDict().items():           
          print  label ,"->" , className 
Ejemplo n.º 20
0
def test_haveSameSuperClass():
    ontology = OntologyLib("web_dev.owl")
    ref1 = ontology.toURIRef("Database")
    ref2 = ontology.toURIRef("MySQL")
    ref3 = ontology.toURIRef("Software")
    ref4 = ontology.toURIRef("Sql_Server")
    ref5 = ontology.toURIRef("Nosql_Database")
    ref6 = ontology.toURIRef("Relational_Database")
    #  print ref4
    #  result = ontology.getSuperClass(ref4)

    print ontology.haveSameSuperClass(ref4, ref2)
    print ontology.haveSameSuperClass(ref2, ref3)
    print ontology.haveSameSuperClass(ref5, ref6)
    print ontology.haveSameSuperClass(ref5, ref4)
Ejemplo n.º 21
0
def test_getTerms():
    ontology = OntologyLib("web_dev.owl")
    ref1 = ontology.toURIRef("Nosql_Database")
    print ontology.getTerms(ref1)
Ejemplo n.º 22
0
def testGetClassnames():
    ontology = OntologyLib("web_dev.owl")
    for n in ontology.getAllClassNames():
        print n
Ejemplo n.º 23
0
def test_getFullDict():
    ontology = OntologyLib("web_dev.owl")
    fullDict = ontology.getFullDict()
    for  label, className  in fullDict.items():           
           print  label ,"->" , className    
Ejemplo n.º 24
0
def test_getLabelDict():
    ontology = OntologyLib("web_dev.owl")
    for label, className in ontology.getLabelDict().items():
        print label, "->", className