本文整理匯總了Python中DatabaseManager.DatabaseManager.openConnection方法的典型用法代碼示例。如果您正苦於以下問題:Python DatabaseManager.openConnection方法的具體用法?Python DatabaseManager.openConnection怎麽用?Python DatabaseManager.openConnection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DatabaseManager.DatabaseManager
的用法示例。
在下文中一共展示了DatabaseManager.openConnection方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: concept_as_rdf
# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import openConnection [as 別名]
def concept_as_rdf(self, REQUEST, cp, ns="1"):
""" Return a concept in RDF format """
conn = DatabaseManager()
try:
conn.openConnection(self)
except OperationalError, error:
return None
示例2: searchThesaurus
# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import openConnection [as 別名]
def searchThesaurus(self, term, langcode='en', ns=1):
""" """
if not term:
return []
conn = DatabaseManager()
conn.openConnection(self)
collation = self._get_language_collation(langcode, conn)
err, res, msg = conn.query(sql_find_concept(term, langcode, collation))
if err:
# log error
return []
conn.closeConnection()
results = []
for i in res:
if i['scope_name'] is None:
i['scope_name'] = ''
if i['concept_alt_name'] is None:
i['concept_alt_name'] = ''
results.append(ConceptLink(ns, i['concept_id'], i['concept_name'], i['scope_name'], i['concept_alt_name']))
return results
示例3: GetAllRelations
# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import openConnection [as 別名]
def GetAllRelations(self):
""" return all relations """
conn = DatabaseManager()
try:
conn.openConnection(self)
except OperationalError, error:
# write log
return ((), 1)
示例4: getDefinitionSources
# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import openConnection [as 別名]
def getDefinitionSources(self):
""" return definition sources """
conn = DatabaseManager()
try:
conn.openConnection(self)
except OperationalError, error:
# write log
return ({}, 1)
示例5: GetBackbone
# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import openConnection [as 別名]
def GetBackbone(self):
""" return data for backbone.rdf """
conn = DatabaseManager()
try:
conn.openConnection(self)
except OperationalError, error:
#write log
return ((), 1)
示例6: GetConceptName
# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import openConnection [as 別名]
def GetConceptName(self, concept_ns, concept_id, langcode):
""" return a concepts name in requested language """
conn = DatabaseManager()
try:
conn.openConnection(self)
except OperationalError, error:
#write log
return (0, 1)
示例7: GetConceptsName
# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import openConnection [as 別名]
def GetConceptsName(self, langcode, start=0, letter=0, ns=1):
""" return the concepts name for a given language """
conn = DatabaseManager()
try:
conn.openConnection(self)
except OperationalError, error:
#write log
return ((), [], 1)
示例8: getAlphabet
# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import openConnection [as 別名]
def getAlphabet(self, lang, theme, case, theme_ns=""):
""" return the alphabet (default small letters) for a given language """
conn = DatabaseManager()
try:
conn.openConnection(self)
except OperationalError, error:
# write log
conn.closeConnection()
return ((), [], 1, "")
示例9: GetLanguageDirection
# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import openConnection [as 別名]
def GetLanguageDirection(self, lang):
""" get a language by its code """
conn = DatabaseManager()
try:
conn.openConnection(self)
except OperationalError, error:
# write log
return ({}, 1)
示例10: GetLanguages
# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import openConnection [as 別名]
def GetLanguages(self, concept_ns=None, concept_id=None):
""" get languages """
conn = DatabaseManager()
try:
conn.openConnection(self)
except OperationalError, error:
# write log
return None
示例11: _get_concept_relatives
# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import openConnection [as 別名]
def _get_concept_relatives(self, concept_ns, concept_id, target_ns=None, relation_uri=None):
""" get all concepts related to a given concept """
conn = DatabaseManager()
conn.openConnection(self)
err, res, msg = conn.query(sql_get_concept_relatives(concept_ns, concept_id, target_ns, relation_uri))
conn.closeConnection()
return res
示例12: fetch_concept_property_translations
# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import openConnection [as 別名]
def fetch_concept_property_translations(self, concept_ns, concept_id, prop_name):
conn = DatabaseManager()
conn.openConnection(self)
err, res, msg = conn.query(sql_get_concept_property(concept_ns, concept_id, prop_name))
if err:
print err, msg
conn.closeConnection()
return res
示例13: fetch_namespaces
# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import openConnection [as 別名]
def fetch_namespaces(self):
conn = DatabaseManager()
conn.openConnection(self)
err, res, msg = conn.query(sql_get_namespaces())
if err:
print err, msg
conn.closeConnection()
return res
示例14: GetGroupsAndThemes
# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import openConnection [as 別名]
def GetGroupsAndThemes(self, langcode):
""" return all the groups and all the themes for a given language """
errors = 0
conn = DatabaseManager()
try:
conn.openConnection(self)
except OperationalError, err:
# write log
errors = 1
return ((), (), (), err)
示例15: fetch_concept_by_regex
# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import openConnection [as 別名]
def fetch_concept_by_regex(self, namespace_id, regex, language):
conn = DatabaseManager()
conn.openConnection(self)
err, res, msg = conn.query(sql_get_concept_by_regex(namespace_id, regex, language))
if err:
print err, msg
conn.closeConnection()
return res