Exemple #1
0
 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 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')
Exemple #4
0
 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 ''
Exemple #5
0
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 ''
Exemple #7
0
 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 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
Exemple #9
0
 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 ''
Exemple #10
0
 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 '' 
Exemple #11
0
 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 ''
Exemple #12
0
 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 ''
Exemple #13
0
 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 '{}'
Exemple #14
0
    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('<', '&lt;')
        res = res.replace('>', '&gt;')
        jq("#sparql_result").html(res)

        return jq
Exemple #15
0
 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 '{}' 
Exemple #16
0
    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('<', '&lt;')
        res = res.replace('>', '&gt;')
        jq("#sparql_result").html(res)

        return jq
Exemple #17
0
    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
Exemple #18
0
    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