@classmethod
    def from_rdf(cls, rdfstring, record, app):
        s = parse_rdf(rdfstring)

        q = """
        PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
        PREFIX sp: <http://smartplatforms.org/terms#>
        SELECT ?notes ?severity
        WHERE {
            ?a rdf:type sp:Alert.
            ?a sp:notes ?notes.
            ?a sp:severity ?scv.
            ?scv sp:code ?severity.
        }"""

        r = list(s.query(q))
        assert len(r) == 1, len(r) % "Expected one alert in post, found %s"
        (notes, severity) = r[0]

        assert type(notes) == Literal
        spcodes = Namespace("http://smartplatforms.org/terms/code/alertLevel#")
        assert severity in [spcodes.information, spcodes.warning,
                            spcodes.critical]

        a = RecordAlert(
            record=record,
            alert_text=str(notes),
            triggering_app=app
        )
        a.save()
        return a
dataset/ETHPy150Open smart-classic/smart_server/smart/models/records.py/RecordAlert.from_rdf/swapped operands of `%`