Exemplo n.º 1
0
    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
Exemplo n.º 2
0
    class GenreSchema(JsonLDSchema):
        _id = fields.Id()
        name = fields.String(schema.name)

        class Meta:
            rdf_type = schema.Genre
            model = Genre
Exemplo n.º 3
0
    class ASchema(JsonLDSchema):
        _id = fields.Id()
        url = fields.IRI(schema.url)

        class Meta:
            rdf_type = schema.A
            model = A
Exemplo n.º 4
0
    class ASchema(JsonLDSchema):
        _id = fields.Id()
        name = fields.String(schema.name)

        class Meta:
            rdf_type = schema.A
            model = A
Exemplo n.º 5
0
    class AuthorSchema(JsonLDSchema):
        _id = fields.Id()
        name = fields.String(schema.name)

        class Meta:
            rdf_type = schema.Person
            model = Author
Exemplo n.º 6
0
class AlgorithmSchema(JsonLDSchema):
    _id = fields.Id()
    label = fields.String(RDFS.label)

    class Meta:
        rdf_type = ML_SCHEMA.Algorithm
        model = Algorithm
Exemplo n.º 7
0
class HyperParameterSchema(JsonLDSchema):
    _id = fields.Id()
    label = fields.String(RDFS.label)

    class Meta:
        rdf_type = ML_SCHEMA.HyperParameter
        model = HyperParameter
Exemplo n.º 8
0
    class ASchema(JsonLDSchema):
        _id = fields.Id()
        url = fields.IRI(schema.url, allow_none=True)

        class Meta:
            rdf_type = schema.A
            model = A
    class BookSchema(JsonLDSchema):
        _id = fields.Id()
        name = fields.String(schema.name)

        class Meta:
            rdf_type = schema.Book
            model = Book
Exemplo n.º 10
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
Exemplo n.º 11
0
    class ASchema(JsonLDSchema):
        _id = fields.Id()
        simple = fields.RawJsonLD("http://www.w3.org/ns/oa#hasBody")
        nested = fields.RawJsonLD("http://www.w3.org/ns/oa#hasBody2")

        class Meta:
            rdf_type = schema.A
            model = A
Exemplo n.º 12
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
Exemplo n.º 13
0
    class BookSchema(JsonLDSchema):
        _id = fields.Id()
        name = fields.String(schema.name)
        author = fields.Nested(schema.author, AuthorSchema)

        class Meta:
            rdf_type = schema.Book
            model = Book
Exemplo n.º 14
0
    class BookSchema(JsonLDSchema):
        _id = fields.Id()
        name = fields.String(schema.name)
        genre = fields.Nested(schema.genre, GenreSchema)

        class Meta:
            rdf_type = schema.Book
            model = Book
Exemplo n.º 15
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
Exemplo n.º 16
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
Exemplo n.º 17
0
class ModelEvaluationSchema(JsonLDSchema):
    _id = fields.Id()
    value = ParameterValue(ML_SCHEMA.hasValue)
    specified_by = fields.Nested(ML_SCHEMA.specifiedBy,
                                 EvaluationMeasureSchema)

    class Meta:
        rdf_type = ML_SCHEMA.ModelEvaluation
        model = ModelEvaluation
Exemplo n.º 18
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
Exemplo n.º 19
0
    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
Exemplo n.º 20
0
    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
Exemplo n.º 21
0
class HyperParameterSettingSchema(JsonLDSchema):
    _id = fields.Id()
    value = ParameterValue(ML_SCHEMA.hasValue)
    specified_by = fields.Nested(ML_SCHEMA.specifiedBy,
                                 HyperParameterSchema,
                                 only=("_id", ))

    class Meta:
        rdf_type = ML_SCHEMA.HyperParameterSetting
        model = HyperParameterSetting
        add_value_types = True
Exemplo n.º 22
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
Exemplo n.º 23
0
    class ASchema(JsonLDSchema):
        _id = fields.Id()
        dt = fields.DateTime(schema.dateTime)
        naive_dt = fields.NaiveDateTime(schema.naiveDateTime)
        aware_dt = fields.AwareDateTime(schema.awareDateTime)
        date = fields.Date(schema.date)
        time = fields.Time(schema.time)

        class Meta:
            rdf_type = schema.A
            model = A
Exemplo n.º 24
0
    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
Exemplo n.º 25
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
Exemplo n.º 26
0
    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
Exemplo n.º 27
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
Exemplo n.º 28
0
class EvaluationMeasureSchema(JsonLDSchema):
    _id = fields.Id()

    class Meta:
        rdf_type = ML_SCHEMA.EvaluationMeasure
        model = EvaluationMeasure
Exemplo n.º 29
0
    class EntitySchema(JsonLDSchema):
        _id = fields.Id()

        class Meta:
            rdf_type = [prov.Entity, prov.Location]
            model = Entity