- From: Omar <omar.holzknecht@sti2.at>
- Date: Thu, 15 Oct 2020 12:42:20 +0200
- To: public-schemaorg@w3.org
- Message-ID: <8fd61016-2e14-fe58-0a9c-7c16c61d3b40@sti2.at>
Hi Melvin,
In case you are working in a JS environment, you could use
https://www.npmjs.com/package/schema-org-adapter
It is a library that helps to handle the schema.org vocabulary (based
directly on the JSON-LD file of schema.org).
What you want to achieve could be as easy as this:
sdoAdapter.getProperty('employee').toJSON()
Here a live example for your use-case:
https://runkit.com/embed/3monml6ttk1t
If you have questions regarding the library, don't hesitate to write to
me,
cheers,
Omar
On 15.10.20 11:23, Melvin Carvalho wrote:
> On Thu, 15 Oct 2020 at 11:12, Dan Brickley <danbri@google.com> wrote:
>
> On Thu, 15 Oct 2020 at 09:00, Melvin Carvalho
> <melvincarvalho@gmail.com> wrote:
>
> On Wed, 14 Oct 2020 at 23:48, Martynas Jusevičius
> <martynas@atomgraph.com> wrote: Hi,
>
> Our Linked Data client is failing to load term descriptions from
> schema.org [1] because it looks like RDF representations are not
> served,
> or at least the content negotiation does not work and HTML is
> returned?
>
> Example:
> curl https://schema.org/employee -H "Accept:
> application/rdf+xml,application/n-triples,application/rdf+thrift,text/turtle,text/rdf+n3,application/rdf+json"
>
> Executable example: https://reqbin.com/c-vjs20ras
>
> From my experience the content negotiation pattern that you are using
> is quite hard to implement
>
> Another simpler option might be to just put it in JSON-LD in a script
> tag ie a structured data island
>
> That might be the "schema.org [1]" way of doing things ie eating your
> own dogfood, and I think is part of the JSON-LD 1.1 spec, so would play
> well with toolilng
We don't use content negotiation to serve up per-page fragments of the
RDF representation of Schema.org. The site is statically served.
You can get the whole thing from https://schema.org/docs/developers.html
in a variety of downloadable formats. We have for some years included a
few RDFa annotations in the HTML of each page, including
https://schema.org/employee but will be migrating these to JSON-LD
islands for maintainability, and for consistency with the ways
schema.org [1] markup itself is most widely used.
The current HTML has: <div id="mainContent" vocab="http://schema.org/"
typeof="rdfs:Property" resource="http://schema.org/employee">
which seems to extract ok,
https://www.w3.org/2012/pyRdfa/extract?uri=https%3A%2F%2Fschema.org%2Femployee&format=nt&rdfagraph=output&vocab_expansion=false&rdfa_lite=false&embedded_rdf=true&space_preserve=true&vocab_cache=true&vocab_cache_report=false&vocab_cache_refresh=false
...however this is fragile and makes it hard to improve the site's UI
without breaking the RDFa. There's a draft of the next release at
https://webschemas.org/employee which has embedded JSON-LD at the end of
the page content.
{
"@context": {
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"schema": "http://schema.org/",
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"@id": "schema:employee",
"@type": "rdf:Property",
"rdfs:comment": "Someone working for this organization.",
"rdfs:label": "employee",
"schema:domainIncludes": {
"@id": "schema:Organization"
},
"schema:rangeIncludes": {
"@id": "schema:Person"
}
}
LOVE this!
> cheers,
>
> Dan
>
>>
>
> Martynas
> atomgraph.com [2]
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud
service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
Links:
------
[1] http://schema.org
[2] http://atomgraph.com
Received on Thursday, 15 October 2020 10:42:37 UTC