def __init__(self, uri): self.uri = URIRef(uri) self.label = graph.query_single ( """SELECT ?l WHERE { ?u rdfs:subClassOf smdb:Genre . ?u rdfs:label ?l . }""", initBindings={'u': self.uri})
def __init__(self, uri): if super(MovieReview, self).__init__(uri): return # Call super and exit if this is a created instance self.id, self.reviewText = graph.query_single( """SELECT ?id ?t WHERE { ?u rdf:type smdb:MovieReview . ?u smdb:id ?id . ?u smdb:reviewText ?t . }""", initBindings={'u': self.uri}) self.dynamic = { 'refersTo': None, 'writtenByUser': None, }
def __init__(self, uri): if super(SMDBUser, self).__init__(uri): return # Call super and exit if this is a created instance self.username, self.fullName = graph.query_single( """SELECT ?un ?fn WHERE { ?u rdf:type smdb:SMDBUser . ?u smdb:username ?un . OPTIONAL { ?u smdb:fullName ?fn . } }""", initBindings={'u': self.uri}) self.dynamic = { 'isFriendsWith': None, 'hasWritten': None, 'hasSeen': None, }
def __init__(self, uri): if super(Character, self).__init__(uri): return # Call super and exit if this is a created instance self.name = graph.query_single( """SELECT ?n WHERE { ?u rdf:type smdb:Character . ?u smdb:name ?n . }""", initBindings={'u': self.uri}) if self.name == None: raise TypeError self.dynamic = { 'portrayedBy': None, 'inMovie': None, }
def __init__(self, uri): if super(Person, self).__init__(uri): return # Call super and exit if this is a created instance self.name = graph.query_single( """SELECT ?n WHERE { ?u rdf:type smdb:Person . ?u smdb:name ?n . }""", initBindings={'u': self.uri}) if self.name == None: raise TypeError self.dynamic = { 'directed': None, 'wrote': None, 'performedIn': None, 'playsCharacter': None, }
def __init__(self, uri): if super(Movie, self).__init__(uri): return # Call super and exit if this is a created instance self.title, self.releaseDate, self.duration, self.synopsis = graph.query_single( """SELECT ?t ?y ?d ?s WHERE { ?u rdf:type smdb:Movie . ?u smdb:title ?t . ?u smdb:releaseDate ?y . ?u smdb:synopsis ?s . OPTIONAL { ?u smdb:duration ?d . } }""", initBindings={'u': self.uri}) self.dynamic = { 'directedBy': None, 'writtenBy': None, 'featured': None, 'isOfGenre': None, 'hasReview': None, 'shotIn': None, 'hasRating': None, }