def referenced(self): """ @param self: the object itself @return the referenced sites by Apache Stanbol EntityHub """ stanbol = get_stanbol(self.context) res = stanbol.entityHubSite().get_referenced_sites() return res
def stanbol_indexer_handler(obj, event): obj._stanbol_enhancements = None stanbol = get_stanbol(obj) try: obj._stanbol_enhancements = stanbol.engines(obj.SearchableText(), 'rdfjson') except Exception, e: msg = "Problem while using Stanbol server for automatic "+\ "enhancement.\n%s" % str(e) IStatusMessage(obj.REQUEST).addStatusMessage(msg, type='error')
def __call__(self): """ Method called when EntityHubProxy is called @param self: the object itself @return: the Stanbol EntityHub results """ response = self.request.response stanbol = get_stanbol(self.context) #TODO return ''
def engineCall(self, data): """ Returns the graph resulting from processing data with Stanbol engine @param self: the object itself @param data: data to process @return the rdflib graph """ stanbol = get_stanbol(self.context) res = stanbol.engines(payload=data, format='rdfxml', parsed=True) return res
def entity(self): """ @param self: the object itself @return informations on the requested entity """ if self.request.form['id']: uri = self.request.form['id'] stanbol = get_stanbol(self.context) ehs = stanbol.entityHubSite if uri: res = ehs.get_entity(uri) return res return ''
def __call__(self): """ Method called when EntityHubSiteProxy is called @param self: the object itself @return: the Stanbol EntityHub sites results """ response = self.request.response stanbol = get_stanbol(self.context) print self.request["URL"] req = self.request["URL"].split("sites") req = req[1] #TODO return ''
def __call__(self): """ Method called when EngineProxy is called @param self: the object itself @return: the Stanbol engines results in json format or an empty json object """ #response = self.request.response stanbol = get_stanbol(self.context) print self.request.form try: print self.request.form['data'] data = self.request.form['data'] res = stanbol.engines(payload=data, format="jsonld", parsed=False) print res return res except: return '{}'
def sparqlCall(self): """ JQuery.PyProxy View for SparQL console @param self: the object itself @return sparql query result """ jq = JQueryProxy() data = self.request.form.get('text') print self.request.stdin.getvalue() print data stanbol = get_stanbol(self.context) res = stanbol.sparql(data).body_string() print res res = res.replace('<', '<') res = res.replace('>', '>') jq("#sparql_result").html(res) return jq
def __call__(self): """ Method called when EngineProxy is called @param self: the object itself @return: the Stanbol engines results in json format or an empty json object """ response = self.request.response stanbol = get_stanbol(self.context) print self.request.form try: print self.request.form['data'] data = self.request.form['data'] res = stanbol.engines(payload=data, format="jsonld", parsed=False) print res return res except: return '{}'
def find(self): """ @param self: the object itself @return the id of related entities """ # name # field # lang # limit # offset stanbol = get_stanbol(self.context) ehs = stanbol.entityHubSite try: _name = self.request.form['name'] except: _name = None try: _field = self.request.form['field'] except: _field = None try: _lang = self.request.form['lang'] except: _lang = None try: _limit = self.request.form['limit'] except: _limit = None try: _offset = self.request.form['offset'] except: _offset = None res = ehs.find( name = _name, field=_field, lang=_lang, limit=_limit, offset=_offset ) return res
def find(self): """ @param self: the object itself @return the id of related entities """ # name # field # lang # limit # offset stanbol = get_stanbol(self.context) ehs = stanbol.entityHubSite try: _name = self.request.form['name'] except: _name = None try: _field = self.request.form['field'] except: _field = None try: _lang = self.request.form['lang'] except: _lang = None try: _limit = self.request.form['limit'] except: _limit = None try: _offset = self.request.form['offset'] except: _offset = None res = ehs.find(name=_name, field=_field, lang=_lang, limit=_limit, offset=_offset) return res