Skip to content

Add jsonld context to resource #767

Open
@maechler

Description

@maechler

It would be nice to have the possibility to split the property context into the namespace and the property itself. Here an example to illustrate what I mean:

Entity BibliographicResource

class BibliographicResource
{
    /**
     * @var string
     *
     * @ApiProperty(iri="http://purl.org/dc/terms/title")
     */
    private $title;
}

Current output
Context:

{
    "title": "http://purl.org/dc/terms/title"
}

Entity:

{
      "title": "some title"
}

Desired output

Context:

{
    "dct": "http://purl.org/dc/terms/"
}

Entity:

{
      "dct:title": "some title"
}

Possible implementation

One way of implementing this could probably be to add context definitions to the entity class.
e.g.

/**
 * @ApiResource(
 *     "jsonld_context"={
 *         "dct":"http://purl.org/dc/terms/"
 *     }
 * )
 */
class BibliographicResource
{
    /**
     * @var string
     *
     * @ApiProperty(iri="dct:title")
     */
    private $title;
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions