コード例 #1
0
ファイル: test_annotation.py プロジェクト: zanachka/calamus
    class Book(metaclass=JsonLDAnnotation):
        _id = fields.Id(default="http://example.com/book/1")
        name = fields.String(schema.name, default=lambda: "Bill")
        surname = fields.String(schema.surname, default=default_surname)

        class Meta:
            rdf_type = schema.Book
コード例 #2
0
    class BookSchema(JsonLDSchema):
        _id = fields.Id()
        name = fields.String(schema.name)
        author = fields.String(schema.author)

        class Meta:
            rdf_type = schema.Book
            model = Book
コード例 #3
0
    class BookSchema(JsonLDSchema):
        _id = fields.Id()
        name = fields.String(schema.name)
        author = fields.String(schema.author)
        publishedYear = fields.Integer(schema.publishedYear)

        class Meta:
            rdf_type = schema.Book
            model = Book
コード例 #4
0
    class BookSchema(JsonLDSchema):
        _id = fields.Id()
        name = fields.String(schema.name)
        isbn = fields.String(schema.isbn)
        copyright_year = fields.Integer(schema.copyrightYear)

        class Meta:
            rdf_type = schema.Book
            model = Book
コード例 #5
0
class ImplementationSchema(JsonLDSchema):
    _id = fields.Id()
    name = fields.String(DC_TERMS.title)
    parameters = fields.Nested(ML_SCHEMA.hasHyperParameter,
                               HyperParameterSchema,
                               many=True)
    implements = fields.Nested(ML_SCHEMA.implements, AlgorithmSchema)
    version = fields.String(DC_TERMS.hasVersion)

    class Meta:
        rdf_type = ML_SCHEMA.Implementation
        model = Implementation
コード例 #6
0
    class ASchema(JsonLDSchema):
        name = fields.String(schema.name)

        class Meta:
            rdf_type = schema.A
            model = A
            id_generation_strategy = blank_node_id_strategy
コード例 #7
0
    class GenreSchema(JsonLDSchema):
        _id = fields.BlankNodeId()
        name = fields.String(schema.name)

        class Meta:
            rdf_type = schema.Genre
            model = Genre
コード例 #8
0
    class AuthorSchema(JsonLDSchema):
        _id = fields.Id()
        name = fields.String(schema.name)

        class Meta:
            rdf_type = schema.Person
            model = Author
コード例 #9
0
class AlgorithmSchema(JsonLDSchema):
    _id = fields.Id()
    label = fields.String(RDFS.label)

    class Meta:
        rdf_type = ML_SCHEMA.Algorithm
        model = Algorithm
コード例 #10
0
class HyperParameterSchema(JsonLDSchema):
    _id = fields.Id()
    label = fields.String(RDFS.label)

    class Meta:
        rdf_type = ML_SCHEMA.HyperParameter
        model = HyperParameter
コード例 #11
0
    class ASchema(JsonLDSchema):
        _id = fields.Id()
        name = fields.String(schema.name)

        class Meta:
            rdf_type = schema.A
            model = A
コード例 #12
0
    class AuthorSchema(JsonLDSchema):
        _id = fields.Id()
        name = fields.String(schema.name)
        organization = fields.IRI(schema.organization, reverse=True)

        class Meta:
            rdf_type = schema.Person
            model = Author
コード例 #13
0
    class BookSchema(JsonLDSchema):
        name = fields.String(schema.name)
        genre = fields.Nested(schema.genre, GenreSchema)

        class Meta:
            rdf_type = schema.Book
            model = Book
            id_generation_strategy = blank_node_id_strategy
コード例 #14
0
    class BookSchema(JsonLDSchema):
        _id = fields.Id()
        name = fields.String(schema.name)

        class Meta:
            rdf_type = schema.Book
            model = Book
            add_value_types = True
コード例 #15
0
    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
コード例 #16
0
    class AuthorSchema(JsonLDSchema):
        _id = fields.Id()
        name = fields.String(schema.name)
        book = fields.Nested(schema.books, BookSchema)

        class Meta:
            rdf_type = schema.Author
            model = Author
コード例 #17
0
class RunSchema(JsonLDSchema):
    _id = fields.Id()
    executes = fields.Nested(ML_SCHEMA.executes, ImplementationSchema)
    input_values = fields.Nested(ML_SCHEMA.hasInput,
                                 HyperParameterSettingSchema,
                                 many=True,
                                 flattened=True)
    output_values = fields.Nested(ML_SCHEMA.hasOutput,
                                  ModelEvaluationSchema,
                                  many=True)
    realizes = fields.Nested(ML_SCHEMA.implements, AlgorithmSchema)
    version = fields.String(DC_TERMS.hasVersion)
    name = fields.String(DC_TERMS.title)

    class Meta:
        rdf_type = ML_SCHEMA.Run
        model = Run
コード例 #18
0
    class AuthorSchema(JsonLDSchema):
        name = fields.String(schema.name)
        books = fields.Nested(schema.books, BookSchema, many=True)

        class Meta:
            rdf_type = schema.Author
            model = Author
            id_generation_strategy = blank_node_id_strategy
コード例 #19
0
    class AuthorSchema(JsonLDSchema):
        _id = fields.Id()
        name = fields.String(schema.name)
        books = fields.Nested(schema.author, BookSchema, reverse=True, many=True)

        class Meta:
            rdf_type = schema.Person
            model = Author
コード例 #20
0
    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
コード例 #21
0
ファイル: test_annotation.py プロジェクト: zanachka/calamus
    class Schoolbook(Book):
        course = fields.String(schema.course)

        def __init__(self, _id, name, course):
            self.course = course
            super().__init__(_id, name)

        class Meta:
            rdf_type = Book.Meta.rdf_type
コード例 #22
0
ファイル: test_annotation.py プロジェクト: zanachka/calamus
    class Schoolbook(Book, EducationMaterial):
        course = fields.String(schema.course)

        def __init__(self, _id, name, course):
            self.course = course
            super().__init__(_id, name)

        class Meta:
            rdf_type = schema.SchoolBook
コード例 #23
0
ファイル: test_annotation.py プロジェクト: zanachka/calamus
    class Biologybook(Schoolbook):
        topic = fields.String(schema.topic)

        def __init__(self, _id, name, course, topic):
            self.topic = topic
            super().__init__(_id, name, course)

        class Meta:
            rdf_type = schema.BiologyBook
            inherit_parent_types = True
コード例 #24
0
ファイル: test_annotation.py プロジェクト: zanachka/calamus
    class Schoolbook(Book):
        course = fields.String(schema.course)

        def __init__(self, _id, name, course):
            self.course = course
            super().__init__(_id, name)

        class Meta:
            rdf_type = schema.SchoolBook
            inherit_parent_types = False
コード例 #25
0
ファイル: test_annotation.py プロジェクト: zanachka/calamus
    class Book(metaclass=JsonLDAnnotation):
        _id = fields.Id()
        name = fields.String(schema.name)

        def __init__(self, _id, name):
            self._id = _id
            self.name = name

        class Meta:
            rdf_type = schema.Book
コード例 #26
0
ファイル: test_annotation.py プロジェクト: zanachka/calamus
    class EducationMaterial(metaclass=JsonLDAnnotation):
        _id = fields.Id()
        grade = fields.String(schema.grade)

        def __init__(self, _id, grade):
            self._id = _id
            self.grade = grade

        class Meta:
            rdf_type = schema.EducationMaterial
コード例 #27
0
    class CSchema(JsonLDSchema):
        _id = fields.Id()
        name = fields.String(schema.name)
        children = fields.Nested(schema.parent,
                                 BSchema,
                                 reverse=True,
                                 many=True)

        class Meta:
            rdf_type = schema.C
            model = C
コード例 #28
0
ファイル: test_annotation.py プロジェクト: zanachka/calamus
    class Author(metaclass=JsonLDAnnotation):
        _id = fields.Id()
        name = fields.String(schema.name)
        books = fields.Nested(schema.author, Book, reverse=True, many=True)

        def __init__(self, _id, name, books):
            self._id = _id
            self.name = name
            self.books = books

        class Meta:
            rdf_type = schema.Person
コード例 #29
0
ファイル: test_annotation.py プロジェクト: zanachka/calamus
    class Schoolbook(Book):
        course = fields.String(schema.course)

        def __init__(self, _id, name, course):
            self.course = course
            super().__init__(_id, name)

        class Meta(Book.Meta):
            rdf_type = Book.Meta.rdf_type

            @pre_load
            def _preload(self, in_data, **kwargs):
                super()._preload(in_data, **kwargs)
                in_data["@id"] += f"hook{y}"
                return in_data
コード例 #30
0
ファイル: test_annotation.py プロジェクト: zanachka/calamus
    class Book(metaclass=JsonLDAnnotation):
        _id = fields.Id()
        name = fields.String(schema.name)

        def __init__(self, _id, name):
            self._id = _id
            self.name = name

        class Meta:
            rdf_type = schema.Book

            @pre_load
            def _preload(self, in_data, **kwargs):
                in_data["@id"] += f"hook{x}"
                return in_data