class GenreSchema(JsonLDSchema):
        _id = fields.BlankNodeId()
        name = fields.String(schema.name)

        class Meta:
            rdf_type = schema.Genre
            model = Genre
Esempio n. 2
0
    class BSchema(JsonLDSchema):
        _id = fields.BlankNodeId()
        value = fields.Nested(schema.specifiedBy, ASchema)

        class Meta:
            rdf_type = schema.B
            model = B
    class AuthorSchema(JsonLDSchema):
        _id = fields.BlankNodeId()
        name = fields.String(schema.name)
        books = fields.Nested(schema.books, BookSchema, many=True)

        class Meta:
            rdf_type = schema.Author
            model = Author
    class BookSchema(JsonLDSchema):
        _id = fields.BlankNodeId()
        name = fields.String(schema.name)
        genre = fields.Nested(schema.genre, GenreSchema)

        class Meta:
            rdf_type = schema.Book
            model = Book