def test_sparql_ascii_stress(self):
     seed("sacala dunga dunga dunga")
     for _ in xrange(100):
         expression = random_expression(only_ascii=True)
         _, s = expression_to_sparql(expression)
         self._standard_check(s, expression)
         self._sparql_check(s)
Beispiel #2
0
def get_code(expression, language):
    """
    Given an expression and a supported language, it
    returns the query for that expression on that language.
    """

    if language == "sparql":
        if len(expression) > 1:
            return expression_to_sparql(expression, True)
        else:
            return expression_to_sparql(expression, False)

    elif language == "dot":
        return expression_to_dot(expression)
    elif language == "mql":
        return generate_mql(expression)
    else:
        message = u"Language '{}' is not supported"
        raise ValueError(message.format(language))
    def test_sparql_stress(self):
        seed("sacala dunga dunga dunga")
        for _ in xrange(100):
            expression = random_expression()
            try:
                _, s = expression_to_sparql(expression)
            except ValueError as error:
                if "Unable to generate sparql" in str(error):
                    continue

            self._standard_check(s, expression)
            self._sparql_check(s)
Beispiel #4
0
def get_code(expression, language):
    """
    Given an expression and a supported language, it
    returns the query for that expression on that language.
    """

    if language == "sparql":
        return expression_to_sparql(expression, True) #add True for all information
    elif language == "dot":
        return expression_to_dot(expression)
    elif language == "mql":
        return generate_mql(expression)
    else:
        message = u"Language '{}' is not supported"
        raise ValueError(message.format(language))
 def test_sparql_takes_unicode(self):
     e = gen_fixedtype(u"·̣─@łæßð~¶½")
     e += gen_datarel(u"tµŧurułej€", u"←ðßðæßđæßæđßŋŋæ @~~·ŋŋ·¶·ŋ“¶¬@@")
     _, s = expression_to_sparql(e)
     self._standard_check(s, e)
     self._sparql_check(s)