-
Notifications
You must be signed in to change notification settings - Fork 152
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
Native support for schema:ListItem #595
Comments
Is there any reason to explicitly add that functionality for Schema itemLists, as opposed to, say, ORE Aggregations with ordered proxies or ActivityStream OrderedCollections? We've got lots of different patterns for ordering RDF sets across many ontologies, and I worry that blessing more than one (which we have with |
Aside from the politics of gaining support for a WG, most current use of JSON-LD on the web is for schema.org. There are certainly other useful ontologies, and if someone shows up with a compelling use case and evidence of the impact it would make, we would likely consider. However, this is a valid concern. |
Seems like you could do something more general like: "itemListElement": {
"@container": {
"@type": "@itemList",
"@itemType": "http://schema.org/ListItem",
"@itemProperty": "http://schema.org/itemListElement"
"@itemPosition": "http://schema.org/position"
}
} Provided that there's a common pattern for these types of "item list" containers. |
@dlongley is on to something, although more generic keywords might be useful, basically support common patterns in indirect containers, such as Examining Turtle representations of these lists: schema:ItemList@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix schema: <http://schema.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<https://example.com/dresses> schema:name "Dresses" .
<https://example.com/dresses/real> schema:name "Real Dresses" .
[
a schema:BreadcrumbList;
schema:itemListElement [
a schema:ListItem;
schema:item <https://example.com/dresses>;
schema:position 1
], [
a schema:ListItem;
schema:item <https://example.com/dresses/real>;
schema:position 2
]
] . This uses an indirection to a Interestingly, each Ordered List Ontology@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix olo: <http://purl.org/ontology/olo/core#> .
@prefix mo: <http://purl.org/ontology/mo/> .
@prefix ex: <http://example.org/> .
ex:FunkyPlaylist a olo:OrderedList ;
dc:title "Funky Playlist" ;
dc:description "A playlist full of funky legends" ;
dc:creator <http://foaf.me/zazi#me> ;
olo:length 2 ;
olo:slot [
olo:index 1 ;
olo:item ex:SexMachine
] ;
olo:slot [
olo:index 2 ;
olo:item ex:GoodFoot
] .
ex:SexMachine a mo:Track ;
dc:title "Sex Machine" ;
dc:creator <http://dbpedia.org/resource/James_Brown> .
ex:GoodFoot a mo:Track ;
dc:title "Good Foot" . This uses an indirection to a ORE SpecificationORE defines a Proxy type, which can serve as an intermediary between resources. While it doesn't define an ordering directly, a hypothetical @prefix ore: <http://www.openarchives.org/ore/terms/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xyz: <http://example/xyz/> .
<ReM-1> a ore:ResourceMap ;
ore:describes <A-1> .
<A-1> a ore:Aggregation ;
ore:isDescribedBy <ReM-1> ;
ore:aggregates <AR-1>, <AR-2> .
<P-1> a ore:Proxy ;
ore:proxyFor <AR-1> ;
ore:proxyIn <A-1> ;
xyz:hasNext <P-2> .
<P-2> a ore:Proxy ;
ore:proxyFor <AR-2> ;
ore:proxyIn <A-1> .
<AR-1> a rdf:Resource .
<AR-2> a rdf:Resource . Note that the proxies have an inverse relationship to their aggregation, and that the Aggregation is an additional intermediate object from the ResourceMap. Ordering between proxies is not directly defined, and this describes a form of reification similar to ActivityStream Ordered CollectionsThe Ordered Collection is done using existing JSON-LD {
"@context": "https://www.w3.org/ns/activitystreams",
"summary": "Object history",
"type": "OrderedCollection",
"totalItems": 2,
"orderedItems": [
{
"type": "Create",
"actor": "http://www.test.example/sally",
"object": "http://example.org/foo"
},
{
"type": "Like",
"actor": "http://www.test.example/joe",
"object": "http://example.org/foo"
}
]
} @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix as: <https://www.w3.org/ns/activitystreams#> .
[
a as:OrderedCollection;
as:items ([
a as:Create;
as:actor <http://www.test.example/sally>;
as:object <http://example.org/foo>
] [
a as:Like;
as:actor <http://www.test.example/joe>;
as:object <http://example.org/foo>
]);
as:summary "Object history";
as:totalItems "2"^^xsd:nonNegativeInteger
] . Consequently, the ActivityStreams Ordered Collection doesn't introduce any new intervening resources. ConclusionsBoth ItemList and OLO use similar paradigms with intermediaries used to describe ordered relationships, however given common authorship (@danbri), that's not too unusual. But, this does offer a generalizable mechanism for describing such relationships, without binding directly to any particular vocabulary. @dlongley's example might be re-stated with more generic keywords: "itemListElement": {
"@container": {
"@type": "http://schema.org/ListItem",
"@item": "http://schema.org/item"
"@position": "http://schema.org/position",
"@next": "http://schema.org/nextItem",
"@previous": "http://schema.org/previousItem"
}
} In this case, the fact that |
(fwiw I didn't work on OLO) Baking in just schema.org feels a bit off. But it is certainly true that JSON-LD's use of JSON arrays for property repetition confuses audiences who don't simultaneously understand JSON's initial flaws regarding field repetition and also RDF's need for explicit order. |
Deferred to WG due to https://json-ld.org/minutes/2018-04-10/#resolution-3. |
Closed in favor of w3c/json-ld-syntax#15. |
Per a suggestion by @danbri, we may want to add a container type, similar to
@list
for encodingschema:ItemList
serializations, when the values areschema:ListItem
and order is set throughschema:position
.ItemList
can be used with text values as well, but this is already reasonably supported natively.Markup might look like the following:
This would expand to the following:
Otherwise, it works like
@list
.When compacting, the processor will re-order items based on
position
, and ignore anynextItem
orpreviousItem
entries.Expansion shows 1-base position, but could be 0-base as well. Note that specific
position
values are lost when compacting, and duplicate values may lead to undefined relative ordering.The text was updated successfully, but these errors were encountered: