示例#1
0
    def _aggregate_text(self, offering):
        """
        Create a single string for creating the index by extracting text fields
        from the USDL document of the offering
        """
        graph = rdflib.ConjunctiveGraph()

        generator = USDLGenerator()
        graph.parse(data=generator.generate_offering_usdl(offering)[0],
                    format='application/rdf+xml')

        text = offering.name

        for s, p, o in graph:
            if isinstance(o, rdflib.Literal):
                text += ' ' + unicode(o)

        return text