Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jsonld context to resource #767

Open
maechler opened this issue Sep 27, 2016 · 2 comments
Open

Add jsonld context to resource #767

maechler opened this issue Sep 27, 2016 · 2 comments

Comments

@maechler
Copy link
Contributor

maechler commented Sep 27, 2016

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;
}
@Simperfit
Copy link
Contributor

@maechler This is fixed ?

@maechler
Copy link
Contributor Author

maechler commented Nov 7, 2016

@Simperfit No, that is not fixed yet. I have added support to extend the json-ld context on property level: #752
But to allow to modify the context completely, it should also be possible on an entity level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants