322 |
323 |
324 |
325 | HTML ALPS Contact Representation
326 |
327 | HTML representations implement most ALPS elements using HTML's
328 | "class" attribute. The "collection" ID has become the CSS class of
329 | an HTML form's submit button. The "contact" ID has become the CSS
330 | class of the TR elements in an HTML table. The subordinate
331 | descriptors "fullname","email", and "phone" are rendered as the TD
332 | elements of each TR.
333 |
334 |
335 |
336 | Amundsen, et al. Expires March 6, 2015 [Page 6]
337 |
338 | Internet-Draft Application-Level Profile Semantics September 2014
339 |
340 |
341 | This HAL document uses the same profile to express the same
342 | application-level semantics as the HTML document.
343 |
344 |
345 |
347 |
350 |
351 |
353 | Ann Arbuckle
354 | aa@example.org
355 | 123.456.7890
356 |
357 |
358 |
360 | Zelda Zackney
361 | zz@example.org
362 | 987.664.3210
363 |
364 |
365 |
366 | HAL XML Contacts Representation
367 |
368 | In a HAL representation, all state transitions ("collection" and
369 | "item", in this case) are represented as link relations. All data
370 | descriptors ("fullName", "email", and "phone") are represented as XML
371 | tags named after the descriptors.
372 |
373 | This Collection+JSON document uses the ALPS profile to express the
374 | same application-level semantics as the HTML and HAL documents.
375 |
376 | {
377 | "collection" : {
378 | "version" : "1.0",
379 | "href" : "http://example.org/contacts/",
380 |
381 | "links" : [
382 | {
383 | "rel" : "profile",
384 | "href" : "http://alps.io/profiles/contacts"
385 | },
386 | {
387 | "rel" : "type",
388 | "href" : "http://alps.io/profiles/contacts#contact"
389 |
390 |
391 |
392 | Amundsen, et al. Expires March 6, 2015 [Page 7]
393 |
394 | Internet-Draft Application-Level Profile Semantics September 2014
395 |
396 |
397 | }
398 | ],
399 |
400 | "queries" : [
401 | {
402 | "rel" : "collection",
403 | "rt" : "contact",
404 | "href" : "http://example.org/contacts/",
405 | "data" : [
406 | {
407 | "name" : "nameSearch",
408 | "value" : "",
409 | "prompt" : "Search Name"
410 | }
411 | ]
412 | }
413 | ],
414 |
415 | "items" : [
416 | {
417 | "href" : "http://example.org/contacts/1",
418 | "rel" : "item",
419 | "rt" : "contact",
420 | "data" : [
421 | {"name" : "fullName", "value" : "Ann Arbuckle"},
422 | {"name" : "email", "value" : "aa@example.org"},
423 | {"name" : "phone", "value" : "123.456.7890"}
424 | ],
425 | "links" : [
426 | {
427 | "rel" : "type",
428 | "href" : "http://alps.io/profiles/contacts#contact"
429 | }
430 | ]
431 | },
432 | {
433 | "href" : "http://example.org/contacts/100",
434 | "rel" : "item",
435 | "rt" : "contact",
436 | "data" : [
437 | {
438 | "name" : "fullName",
439 | "value" : "Zelda Zackney"
440 | },
441 | {
442 | "name" : "email",
443 | "value" : "zz@example.org"
444 | },
445 |
446 |
447 |
448 | Amundsen, et al. Expires March 6, 2015 [Page 8]
449 |
450 | Internet-Draft Application-Level Profile Semantics September 2014
451 |
452 |
453 | {
454 | "name" : "phone",
455 | "value" : "987.654.3210"
456 | }
457 | ],
458 | "links" : [
459 | {
460 | "rel" : "type",
461 | "href" : "http://alps.io/profiles/contacts#contact"
462 | }
463 | ]
464 | }
465 | ]
466 | }
467 | }
468 |
469 |
470 | Collection+JSON Contacts Representation
471 |
472 | The descriptor "collection" has become the link relation associated
473 | with a Collection+JSON query. The descriptors "fullName", "email",
474 | and "phone" have become the names of key-value pairs in the items in
475 | a Collection+JSON collection.
476 |
477 | 1.4. Identifying an ALPS Document
478 |
479 | An ALPS vocabulary is identified by a unique URL. This URL SHOULD be
480 | assumed to be dereferencable. All ALPS URLs MUST be unique and all
481 | ALPS documents intended for public consumption SHOULD be registered
482 | in an ALPS Registry [TK: add text on where/how to find registries
483 | -mamund].
484 |
485 | In order to reduce load on servers responding to ALPS document
486 | requests, it is RECOMMENDED that servers use cache control directives
487 | that instruct client apps to locally cache the results. Clients
488 | making these ALPS document requests SHOULD honor the server's caching
489 | directives.
490 |
491 | 2. ALPS Documents
492 |
493 | An ALPS document contains a machine-readable collection of
494 | identifying strings and their human-readable explanations. An ALPS
495 | document can be represented in either XML or JSON format. This
496 | section identifies the general elements and properties of an ALPS
497 | document, their meaning, and their use, independent of how the
498 | document is represented. Section 2.3 provides specific details on
499 | constructing a valid ALPS document in XML and in JSON format.
500 |
501 |
502 |
503 |
504 | Amundsen, et al. Expires March 6, 2015 [Page 9]
505 |
506 | Internet-Draft Application-Level Profile Semantics September 2014
507 |
508 |
509 | 2.1. Compliance
510 |
511 | An implementation is not compliant if it fails to satisfy one or more
512 | of the MUST or REQUIRED level requirements. An implementation that
513 | satisfies all the MUST or REQUIRED level and all the SHOULD level
514 | requirements is said to be "unconditionally compliant"; one that
515 | satisfies all the MUST level requirements but not all the SHOULD
516 | level requirements is said to be "conditionally compliant."
517 |
518 | 2.2. ALPS Document Properties
519 |
520 | The ALPS media type defines a small set of properties. These
521 | properties appear in both the XML and JSON formats. Below is a list
522 | of the properties that can appear in an ALPS document.
523 |
524 | 2.2.1. 'alps'
525 |
526 | Indicates the root of the ALPS document. This property is REQUIRED,
527 | and it SHOULD have one or more 'descriptor' (Section 2.2.3) child
528 | properties.
529 |
530 | Examples:
531 |
532 | XML: ...
533 |
534 | JSON: { "alps" : ... }
535 |
536 | 2.2.2. 'doc'
537 |
538 | A text field that contains free-form, usually human-readable, text.
539 | The 'doc' element MAY have two properties: 'href' (Section 2.2.6) and
540 | 'format' (Section 2.2.5). If the 'href' property appears it SHOULD
541 | contain a dereferencable URL that points to human-readable text. If
542 | the 'format' property appears it SHOULD contain one of the following
543 | values:
544 |
545 | 1. "text"
546 |
547 | 2. "html"
548 |
549 | 3. "asciidoc"
550 |
551 | Any program processing "doc" elements SHOULD honor the "format"
552 | directive and parse/render the content appropriately. If the value
553 | in the "format" property is not recognized and/or supported, the
554 | processing program MUST treat the content as plain text. If no
555 | 'format' property is present, the content SHOULD be treated as plain
556 | text.
557 |
558 |
559 |
560 | Amundsen, et al. Expires March 6, 2015 [Page 10]
561 |
562 | Internet-Draft Application-Level Profile Semantics September 2014
563 |
564 |
565 | XML:
Date of Birth
...
566 |
567 | JSON: { "doc" : { "format" : "text" : "value" : "Date of Birth ..."
568 | } }
569 |
570 | A 'doc' element SHOULD appear as a child of 'descriptor'
571 | (Section 2.2.3). When present, it describes the meaning and use of
572 | the related 'descriptor'.
573 |
574 | XML: ...
575 |
576 | JSON: { "descriptor" : { { "doc" : { "value" : "..." } ... } }
577 |
578 | The 'doc' element MAY appear as a child of 'alps' (Section 2.2.1).
579 | When present, it describes the purpose of the ALPS document as a
580 | whole.
581 |
582 | XML: ... ...
583 |
584 | JSON: { "alps : "doc" : { "value" : "..." }, ... }
585 |
586 | 2.2.3. 'descriptor'
587 |
588 | A 'descriptor' element defines the semantics of specific data
589 | elements or state transitions that MAY exist in an associated
590 | representation.
591 |
592 | One or more 'descriptor' elements SHOULD appear as children of 'alps'
593 | (Section 2.2.1). It may also appear as a child of itself; that is,
594 | the 'descriptor' property may be nested.
595 |
596 | The 'descriptor' property SHOULD have either an 'id' (Section 2.2.7)
597 | or 'href' (Section 2.2.6) attribute. It MAY have both.
598 | Additionally, the 'descriptor' MAY have any of the following
599 | attributes:
600 |
601 | 1. 'doc' (Section 2.2.2)
602 |
603 | 2. 'ext' (Section 2.2.4)
604 |
605 | 3. 'name' (Section 2.2.9)
606 |
607 | 4. 'type' (Section 2.2.12)
608 |
609 | If present, the 'href' property MUST be a dereferenceable URL, that
610 | points to another 'descriptor' either within the current ALPS
611 | document or in another ALPS document.
612 |
613 |
614 |
615 |
616 | Amundsen, et al. Expires March 6, 2015 [Page 11]
617 |
618 | Internet-Draft Application-Level Profile Semantics September 2014
619 |
620 |
621 | If 'descriptor' has an 'href' attribute, then 'descriptor' is
622 | inheriting all the attributes and sub-properties of the descriptor
623 | pointed to by 'href'. When 'descriptor' has a property defined
624 | locally, that property value takes precedence over any inherited
625 | property value. Since there is no limit to the nesting of elements
626 | -- even ones linked remotely -- it is important to process 'all
627 | descriptor' chains starting from the bottom to make sure you have
628 | collected all the available properties and have established the
629 | correct value for each of them.
630 |
631 | If 'descriptor' is declared at the top level of an ALPS document,
632 | then a client SHOULD assume that 'descriptor' can appear anywhere in
633 | a runtime message.
634 |
635 | If 'descriptor' is nested, i.e. declared as a child of another
636 | descriptor, then:
637 |
638 | 1. A client SHOULD assume them to appear in any sibling 'descriptor'
639 | element and recursively in their child descriptors.
640 |
641 | 2. A client SHOULD NOT assume that it can appear anywhere outside of
642 | parent descriptor, unless it was explicitly referenced by another
643 | descriptor in 'href' attribute. In that case the same rules are
644 | applied to 'descriptor' containing 'href' attribute.
645 |
646 | 2.2.3.1. 'Descriptors and Link Relation Types'
647 |
648 | When a representation is generated that includes state transitions,
649 | valid values for link relation types are:
650 |
651 | 1. A registered IANA link relation type (e.g. rel="edit", a short
652 | string).
653 |
654 | 2. An extension link relation type as defined by [RFC5988] whose
655 | value is the fully-qualified URI of an associated document
656 | describing the relation type. This includes URI fragment
657 | identifiers of ALPS descriptors (e.g. rel="http://alps.io/
658 | profiles/item#purchased-by", a URI) per the conventions of
659 | Section 2.2.7.2.
660 |
661 | 3. The 'id' property of a state transition descriptor of an
662 | associated ALPS document (e.g. rel="purchased-by", a short
663 | string) per the conventions of section Section 2.2.7.1 and
664 | Section 2.2.7.3 if the representation includes an ALPS profile.
665 |
666 | 2.2.4. 'ext'
667 |
668 |
669 |
670 |
671 |
672 | Amundsen, et al. Expires March 6, 2015 [Page 12]
673 |
674 | Internet-Draft Application-Level Profile Semantics September 2014
675 |
676 |
677 | The 'ext' element can be used to extend the ALPS document with
678 | author-specific information. It provides a way to customize ALPS
679 | documents with additional properties not covered in this
680 | specification. This is an OPTIONAL element.
681 |
682 | The 'ext' element has the following properties.
683 |
684 | 1. id (Section 2.2.7)
685 |
686 | 2. href (Section 2.2.6)
687 |
688 | 3. value (Section 2.2.13)
689 |
690 | The id (Section 2.2.7) property is REQUIRED. The href
691 | (Section 2.2.6) is RECOMMENDED and it SHOULD point to documentation
692 | that explains the use and meaning of this ext (Section 2.2.4)
693 | element. The value (Section 2.2.13) property is OPTIONAL. The
694 | content is undetermined; its meaning and use SHOULD be explained by
695 | the document found by de-referencing the href (Section 2.2.6)
696 | property.
697 |
698 | Examples:
699 |
700 | XML:
702 |
703 | JSON: { "ext" : { "id" : "directions", "href" : "http://alps.io/ext/
704 | directions", value="north south east west" } }
705 |
706 | The 'ext' element MAY appear as a child of the following elements:
707 |
708 | 1. 'alps' (Section 2.2.1)
709 |
710 | 2. 'descriptor' (Section 2.2.3)
711 |
712 | Since the 'ext' element has no specific meaning within this
713 | specification, it MUST be ignored by any application that does not
714 | understand its meaning.
715 |
716 | 2.2.5. 'format'
717 |
718 |
719 |
720 |
721 |
722 |
723 |
724 |
725 |
726 |
727 |
728 | Amundsen, et al. Expires March 6, 2015 [Page 13]
729 |
730 | Internet-Draft Application-Level Profile Semantics September 2014
731 |
732 |
733 | Indicates how the text content should be parsed and/or rendered.
734 | This version of the spec identifies three possible values for
735 | "format": "text", "html", and "asciidoc." Any other values for this
736 | attribute are undefined and SHOULD be treated as plain text. If the
737 | program does not recognize the value of the "format" property and/or
738 | the "format" property is missing, the content SHOULD be treated as
739 | plain text. This property MAY appear as an attribute of the 'doc'
740 | (Section 2.2.2) element.
741 |
742 | 2.2.6. 'href'
743 |
744 | Contains a resolvable URL.
745 |
746 | When it appears as an attribute of 'descriptor' (Section 2.2.3),
747 | 'href' points to another 'descriptor' either within the existing ALPS
748 | document or in another ALPS document.
749 |
750 | When it appears as an attribute of 'ext' (Section 2.2.4), 'href'
751 | points to an external document which provides the defintion of the
752 | extension.
753 |
754 | When it appears as an attribute of 'link' (Section 2.2.8), 'href'
755 | points to an external document whose relationship to the current
756 | document or 'descriptor' is described by the associated 'rel'
757 | (Section 2.2.10) property.
758 |
759 | When it appears as an attribute of 'doc' (Section 2.2.2), 'href'
760 | points to a document that contains human-readable text that describes
761 | the associated 'descriptor' or ALPS document.
762 |
763 | 2.2.7. 'id'
764 |
765 | A document-wide unique identifier for the related element. This
766 | SHOULD appear as an attribute of a 'descriptor' (Section 2.2.3).
767 |
768 | The value of this attribute MAY be used as an identifier in the
769 | related runtime hypermedia representation. In the example below the
770 | ALPS descriptor with an 'id' of "q" is used to identify an HTML input
771 | element:
772 |
773 | 'id' in ALPS...
774 |
775 | ...becomes the 'class' in HTML
777 |
778 |
779 |
780 |
781 |
782 |
783 |
784 | Amundsen, et al. Expires March 6, 2015 [Page 14]
785 |
786 | Internet-Draft Application-Level Profile Semantics September 2014
787 |
788 |
789 | It should be noted that the exact mapping from ALPS elements (e.g.
790 | 'id') to elements within a particular media type (HTML,
791 | Collection+JSON, etc.) is covered in separate documents (to be
792 | specified).
793 |
794 | 2.2.7.1. ALPS 'id' and 'name' Properties
795 |
796 | In some cases, media types support non-unique identifiers (e.g.
797 | HTML's 'name' property) or will allow the same identifier value for
798 | multiple elements in the same representation (e.g. and and ). In those cases, translating that
801 | representation into ALPS documents could result in multiple 'id'
802 | properties with the same value.
803 |
804 | To avoid this, ALPS document designers can add the name
805 | (Section 2.2.9) property to a 'descriptor' to hold the common value
806 | ("search") while still using the id (Section 2.2.7) property to hold
807 | a document-wide unique value. For example:
808 |
809 |
810 |
811 |
815 |
816 |
817 | HTML Representation of a Search Transition
818 |
819 |
820 |
821 |
822 |
823 |
824 |
825 |
826 | ALPS Description of the same Search Transition
827 |
828 | 2.2.7.2. Fragment Identifiers and 'id'
829 |
830 | When applied to an ALPS document, a URI fragment identifier points to
831 | the 'descriptor' whose 'id' is the value of the fragment. For
832 | example, the fragment identifier "customer" in the URI http://
833 | example.com/my-alps-document#customer refers to an ALPS 'descriptor'
834 | with 'id' set to "customer".
835 |
836 |
837 |
838 |
839 |
840 | Amundsen, et al. Expires March 6, 2015 [Page 15]
841 |
842 | Internet-Draft Application-Level Profile Semantics September 2014
843 |
844 |
845 | A relative URL with a fragment identifier (e.g. "#customer") refers
846 | to a 'descriptor' within the ALPS document containing the reference.
847 |
848 | The complete URI to an ALPS 'descriptor' (including the fragment)
849 | forms an "abstract semantic type" identifier. This is a resolvable
850 | URI (URL) that can be used to indicate the type of a resource; for
851 | instance, it can be used as the value of the IANA-registered relation
852 | type 'type'.
853 |
854 | 2.2.7.3. Link Relation Values and 'id' or 'name'
855 |
856 | Since a state transition 'descriptor' may define a relation type
857 | value, it is important to avoid creating conflicts with existing
858 | IANA-registered values. If the resulting link relation type is the
859 | same as a registered relation type, the descriptor MUST not change
860 | the meaning of the IANA relation type.
861 |
862 | Further, since the 'id' of a 'descriptor' may define a link relation
863 | value per Section 2.2.3.1, if a conflict exists in defining such a
864 | descriptor's document-wide unique 'id' with another 'descriptor', the
865 | conflicting 'descriptor' MUST define a unique 'id' and MAY specify a
866 | 'name' property to resolve the conflict.
867 |
868 | If it is unclear whether a registered link relation type in a
869 | representation document refers to a relation registered with IANA or
870 | a relation registered in an ALPS profile, the semantics of that link
871 | are undefined.
872 |
873 | 2.2.8. 'link'
874 |
875 | An element that identifies a link between the current ALPS element
876 | and some other (possibly external) resource. MAY be a child element
877 | of the 'alps' (Section 2.2.1) and the 'descriptor' (Section 2.2.3)
878 | elements.
879 |
880 | The 'link' element MUST define the two attributes 'href'
881 | (Section 2.2.6) and 'rel' (Section 2.2.10).
882 |
883 | 2.2.9. 'name'
884 |
885 | Indicates the name of the 'descriptor' (Section 2.2.3) as found in
886 | generic representations. It MAY appear as a property of
887 | 'descriptor'.
888 |
889 | This is used when the name of the 'descriptor' is used as an 'id'
890 | (Section 2.2.7) value elsewhere in the ALPS document. For instance,
891 | if a single ALPS document defines a semantic descriptor (data
892 | element) called "customer" and a safe descriptor (transition element)
893 |
894 |
895 |
896 | Amundsen, et al. Expires March 6, 2015 [Page 16]
897 |
898 | Internet-Draft Application-Level Profile Semantics September 2014
899 |
900 |
901 | also called "customer", they cannot both have 'id="customer"' in the
902 | ALPS document. One of them needs to have some other 'id', and to set
903 | 'name="customer"'.
904 |
905 | The use of the 'name' property usually indicates an ambiguity in the
906 | application semantics. Thus, it SHOULD only be used when creating an
907 | ALPS profile that describes an existing design.
908 |
909 | 2.2.10. 'rel'
910 |
911 | Contains a [RFC5988] approved value: either an extension relation
912 | type (a URI) or a registered relation type (a short string).
913 |
914 | Appears as a property oflink (Section 2.2.8).
915 |
916 | 2.2.11. 'rt'
917 |
918 | Indicates the resource type that will be returned when executing the
919 | specified network request. The 'rt' attribute SHOULD appear only on
920 | a 'descriptor' (Section 2.2.3) with a 'type' (Section 2.2.12) value
921 | of 'safe', 'unsafe', or 'idempotent.'
922 |
923 | The 'rt' attribute is OPTIONAL and is an opaque string and MAY match
924 | the 'id' (Section 2.2.7) of an existing'descriptor' (Section 2.2.3).
925 |
926 | 2.2.12. 'type'
927 |
928 | Indicates the type of hypermedia control to which the element is
929 | applied within the resulting representation. This SHOULD appear for
930 | each 'descriptor' (Section 2.2.3) element. The four valid values
931 | are:
932 |
933 | "semantic" A state element (e.g. HTML.SPAN, HTML.INPUT, etc.).
934 |
935 | "safe" A hypermedia control that triggers a safe, idempotent state
936 | transition (e.g. HTTP.GET or HTTP.HEAD).
937 |
938 | "idempotent" A hypermedia control that triggers an unsafe,
939 | idempotent state transition (e.g. HTTP.PUT or HTTP.DELETE).
940 |
941 | "unsafe" A hypermedia control that triggers an unsafe, non-
942 | idempotent state transition (e.g. HTTP.POST).
943 |
944 | If no 'type' attribute is associated with the element, then
945 | 'type="semantic"' is implied.
946 |
947 | 2.2.13. 'value'
948 |
949 |
950 |
951 |
952 | Amundsen, et al. Expires March 6, 2015 [Page 17]
953 |
954 | Internet-Draft Application-Level Profile Semantics September 2014
955 |
956 |
957 | Contains a string value. It MAY appear as an attribute of the 'doc'
958 | (Section 2.2.2) and the 'ext' (Section 2.2.4) elements.
959 |
960 | 2.2.14. 'version'
961 |
962 | Indicates the version of the ALPS specification used in the document.
963 | This SHOULD appear as a property of the 'alps' (Section 2.2.1)
964 | element. Currently the only valid value is "1.0". If no value
965 | appears, then 'version="1.0"' is implied.
966 |
967 | 2.3. ALPS Representations
968 |
969 | An ALPS document may be represented in either XML or JSON format.
970 | This section contains notes on how the ALPS elements and attributes
971 | appear in each format, along with examples to guide ALPS document
972 | authors.
973 |
974 | 2.3.1. Sample HTML
975 |
976 | Below is a simple HTML document that contains a handful of semantic
977 | descriptors and transition instructions. This document was generated
978 | from the XML and JSON ALPS documents that follow. Use this HTML
979 | document as a guide when evaluating the XML and JSON examples.
980 |
981 |
982 |
983 |
984 |
985 |
986 |
987 |
995 |
996 |
997 |
998 | HTML Sample
999 |
1000 |
1001 |
1002 |
1003 |
1004 |
1005 |
1006 |
1007 |
1008 | Amundsen, et al. Expires March 6, 2015 [Page 18]
1009 |
1010 | Internet-Draft Application-Level Profile Semantics September 2014
1011 |
1012 |
1013 | 2.3.2. XML Representation Example
1014 |
1015 | In the XML version of an ALPS document, the following ALPS properties
1016 | always appear as XML elements: 'alps' (Section 2.2.1), 'doc'
1017 | (Section 2.2.2), 'descriptor' (Section 2.2.3), and 'ext'
1018 | (Section 2.2.4). All other ALPS properties appear as XML attributes.
1019 |
1020 | 2.3.2.1. Complete XML Representation
1021 |
1022 | Below is an example of an application/alps+xml representation.
1023 |
1024 |
1025 |
1026 |
1027 |
1028 |
1029 | A search form with two inputs.
1030 |
1031 |
1032 | input for search
1033 |
1034 |
1035 |
1036 |
1037 | results format
1038 |
1041 |
1042 |
1043 |
1044 | Complete XML Representation
1045 |
1046 | 2.3.3. JSON Representation Example
1047 |
1048 | When representing ALPS documents in JSON format, the 'descriptor'
1049 | (Section 2.2.3) and 'ext' (Section 2.2.4) properties are always
1050 | expressed as arrays of anonymous objects - even when there is only
1051 | one member in the array.
1052 |
1053 | For example:
1054 |
1055 |
1056 |
1057 |
1058 |
1059 |
1060 |
1061 |
1062 |
1063 |
1064 | Amundsen, et al. Expires March 6, 2015 [Page 19]
1065 |
1066 | Internet-Draft Application-Level Profile Semantics September 2014
1067 |
1068 |
1069 | "descriptor" : [
1070 | {
1071 | "id" : "value",
1072 | "name" : "search",
1073 | "type" : "descriptor",
1074 | "doc" : { "value" : "input for search" }
1075 | },
1076 | { "href" : "#resultType" }
1077 | ]
1078 |
1079 | Arrays in ALPS+JSON
1080 |
1081 | The 'doc' (Section 2.2.2) property is always expressed as a named
1082 | object.
1083 |
1084 | For example:
1085 |
1086 | {
1087 | "doc" : {
1088 | "format" : "text",
1089 | "value" : "Rules are important"
1090 | }
1091 | }
1092 |
1093 | Descriptions in ALPS+JSON
1094 |
1095 | 2.3.3.1. Complete JSON Representation
1096 |
1097 | Below is a example of the application/alps+json representation of an
1098 | ALPS document.
1099 |
1100 | {
1101 | "alps" : {
1102 | "version" : "1.0",
1103 | "doc" : {
1104 | "href" : "http://example.org/samples/full/doc.html"
1105 | },
1106 | "descriptor" : [
1107 | {
1108 | "id" : "search",
1109 | "type" : "safe",
1110 | "doc" : {"value" :
1111 | "A search form with a two inputs"
1112 | },
1113 | "descriptor" : [
1114 | {
1115 | "id" : "value",
1116 | "name" : "search",
1117 |
1118 |
1119 |
1120 | Amundsen, et al. Expires March 6, 2015 [Page 20]
1121 |
1122 | Internet-Draft Application-Level Profile Semantics September 2014
1123 |
1124 |
1125 | "type" : "descriptor",
1126 | "doc" : { "value" : "input for search" }
1127 | },
1128 | { "href" : "#resultType" }
1129 | ]
1130 | },
1131 | {
1132 | "id" : "resultType",
1133 | "type" : "descriptor",
1134 | "description" : {"value" : "results format"},
1135 | "ext" : [
1136 | {
1137 | "href" : "http://alps.io/ext/range",
1138 | "value" : "summary,detail"
1139 | }
1140 | ]
1141 | }
1142 | ]
1143 | }
1144 | }
1145 |
1146 | Complete ALPS+JSON Representation
1147 |
1148 | 3. Applying ALPS documents to Existing Media Types
1149 |
1150 | An ALPS document can be applied to many existing media types as long
1151 | as there exists an agreed mapping between ALPS and the target media
1152 | type. Section 1.3 gave some informative examples of this.
1153 | Normative, up-to-date guidance on applying ALPS documents to existing
1154 | media types are available at the official ALPS Web site at (http://
1155 | alps.io/docs/mapping). [TK : this page does not yet exist. -mamund]
1156 |
1157 | Not all media types can faithfully represent all ALPS descriptors.
1158 | For instance, the 'application/json' media type has no standard way
1159 | of representing hyperlinks. The [details of how to apply ALPS to
1160 | such a media type will necesarily be incomplete, and it will not be
1161 | possible to represent some aspects of an ALPS profile in documents in
1162 | that media type.
1163 |
1164 | 3.1. Linking to ALPS Documents
1165 |
1166 | To indicate that an ALPS profile describes the semantics of some
1167 | representation document, the representation document SHOULD be linked
1168 | to the ALPS document. The "profile" link relation [RFC6906] MUST be
1169 | used when creating this link. If the media type of the
1170 | representation document has no native ability to link to other
1171 | resources, or no ability to express link relations, the HTTP header
1172 | 'Link' [RFC5988] MAY be used to connect the representation document
1173 |
1174 |
1175 |
1176 | Amundsen, et al. Expires March 6, 2015 [Page 21]
1177 |
1178 | Internet-Draft Application-Level Profile Semantics September 2014
1179 |
1180 |
1181 | and the ALPS profile. If the media type of the representation
1182 | document defines a parameter for linking the document to a profile,
1183 | that parameter MAY be used to connect the representation document and
1184 | the ALPS profile.
1185 |
1186 | A single representation document may be described by more than one
1187 | ALPS profile. If two ALPS profiles give conflicting semantics for
1188 | the same element, the document linked to earlier in the
1189 | representation SHOULD take precedence. A profile linked to using the
1190 | 'Link' header takes precedence over a profile linked to within the
1191 | representation document itself. A profile linked to using a media
1192 | type parameter takes precedence over a profile linked to using the
1193 | 'Link' header and a profile linked to within the representation
1194 | document itself.
1195 |
1196 | 4. IANA Considerations
1197 |
1198 | This specification establishes two media types: 'application/
1199 | alps+xml' and 'application/alps+json'
1200 |
1201 | 4.1. application/alps+xml
1202 |
1203 | Type name: application
1204 |
1205 | Subtype name: alps+xml
1206 |
1207 | Required parameters: None
1208 |
1209 | Optional parameters:
1210 |
1211 | charset This parameter has identical semantics to the charset
1212 | parameter of the 'application/xml' media type as specified
1213 | in[RFC3023].
1214 |
1215 | profile A whitespace-separated list of IRIs identifying specific
1216 | constraints or conventions that apply to an ALPS document.
1217 | A profile must not change the semantics of the resource
1218 | representation when processed without profile knowledge, so
1219 | that clients both with and without knowledge of a profiled
1220 | resource can safely use the same representation. The
1221 | profile parameter may also be used by clients to express
1222 | their preferences in the content negotiation process. It is
1223 | recommended that profile IRIs are dereferenceable and
1224 | provide useful documentation at that IRI.
1225 |
1226 | Encoding considerations:
1227 |
1228 |
1229 |
1230 |
1231 |
1232 | Amundsen, et al. Expires March 6, 2015 [Page 22]
1233 |
1234 | Internet-Draft Application-Level Profile Semantics September 2014
1235 |
1236 |
1237 | binary Same as encoding considerations of application/xml as
1238 | specified in[RFC3023].
1239 |
1240 | Security considerations: This format shares security issues common
1241 | to all XML content types. It does not provide executable content.
1242 | Information contained in ALPS documents do not require privacy or
1243 | integrity services.
1244 |
1245 | Interoperability considerations: ALPS is not described by a DTD and
1246 | applies only the well-formedness rules of XML. It should only be
1247 | parsed by a non-validating parser.
1248 |
1249 | Published specification: This Document
1250 |
1251 | Applications that use this media type: Various
1252 |
1253 | Additional information:
1254 |
1255 | magic number(s): none
1256 |
1257 | file extensions: .xml
1258 |
1259 | macintosh type file code: TEXT
1260 |
1261 | object idenfiers: none
1262 |
1263 | person to contact for further information:
1264 |
1265 | Name: Mike Amundsen
1266 |
1267 | Email: mca@amundsen.com
1268 |
1269 | Intended usage: Common
1270 |
1271 | Author/change controller: Mike Amundsen
1272 |
1273 | 4.2. application/alps+json
1274 |
1275 | Type name: application
1276 |
1277 | Subtype name: alps+json
1278 |
1279 | Required parameters: None
1280 |
1281 | Optional parameters:
1282 |
1283 | profile A whitespace-separated list of IRIs identifying specific
1284 | constraints or conventions that apply to an ALPS document.
1285 |
1286 |
1287 |
1288 | Amundsen, et al. Expires March 6, 2015 [Page 23]
1289 |
1290 | Internet-Draft Application-Level Profile Semantics September 2014
1291 |
1292 |
1293 | A profile must not change the semantics of the resource
1294 | representation when processed without profile knowledge, so
1295 | that clients both with and without knowledge of a profiled
1296 | resource can safely use the same representation. The
1297 | profile parameter may also be used by clients to express
1298 | their preferences in the content negotiation process. It is
1299 | recommended that profile IRIs are dereferenceable and
1300 | provide useful documentation at that IRI.
1301 |
1302 | Encoding considerations: binary
1303 |
1304 | Security considerations: This media type shares security issues
1305 | common to all JSON content types. See [RFC4627] Section #6 for
1306 | additional information. ALPS+JSON does not provide executable
1307 | content. Information contained in ALPS+JSON documents do not
1308 | require privacy or integrity services.
1309 |
1310 | Interoperability considerations: None
1311 |
1312 | Published specification: This Document
1313 |
1314 | Applications that use this media type: Various
1315 |
1316 | Additional information:
1317 |
1318 | magic number(s): none
1319 |
1320 | file extensions: .json
1321 |
1322 | macintosh type file code: TEXT
1323 |
1324 | object idenfiers: none
1325 |
1326 | person to contact for further information:
1327 |
1328 | Name: Mike Amundsen
1329 |
1330 | Email: mca@amundsen.com
1331 |
1332 | Intended usage: Common
1333 |
1334 | Author/change controller: Mike Amundsen
1335 |
1336 |
1337 |
1338 |
1339 |
1340 |
1341 |
1342 |
1343 |
1344 | Amundsen, et al. Expires March 6, 2015 [Page 24]
1345 |
1346 | Internet-Draft Application-Level Profile Semantics September 2014
1347 |
1348 |
1349 | 5. Internationalization Considerations
1350 |
1351 | [TK]
1352 |
1353 | [[insert text (consider rfc 5987)]]
1354 |
1355 | 6. Acknowledgements
1356 |
1357 | The following people made contributions to this specification:
1358 |
1359 | 7. References
1360 |
1361 | 7.1. Normative References
1362 |
1363 | [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
1364 | Requirement Levels", BCP 14, RFC 2119, March 1997.
1365 |
1366 | [RFC3023] Murata, M., St. Laurent, S., and D. Kohn, "XML Media
1367 | Types", RFC 3023, January 2001.
1368 |
1369 | [RFC4627] Crockford, D., "The application/json Media Type for
1370 | JavaScript Object Notation (JSON)", RFC 4627, July 2006.
1371 |
1372 | [RFC5988] Nottingham, M., "Web Linking", RFC 5988, October 2010.
1373 |
1374 | [RFC6906] Wilde, E., "The 'profile' Link Relation Type", RFC 6906,
1375 | March 2013.
1376 |
1377 | 7.2. Informative References
1378 |
1379 | [draft-ietf-appsawg-uri-get-off-my-lawn-05]
1380 | Nottingham, M., "Standardising Structure in URIs", I-D
1381 | draft-ietf-appsawg-uri-get-off-my-lawn-05, September 2013.
1382 |
1383 | Appendix A. Frequently Asked Questions
1384 |
1385 | A.1. Why are there no URLs in ALPS?
1386 |
1387 | ALPS is meant to describe a service in a universal way. The same
1388 | ALPS description document can be used by many ALPS-compliant servers.
1389 | Since each service implementation is in charge of their own URL
1390 | space, ALPS descriptions do not include URLs. See Standardising
1391 | Structure in URIs [draft-ietf-appsawg-uri-get-off-my-lawn-05] for
1392 | more on this principle.
1393 |
1394 | When implementing ALPS-compliant servers, implementors are free to
1395 | use any URL design they wish. All that is required is that
1396 | implementors use the same ALPS profile descriptor 'id' and 'name'
1397 |
1398 |
1399 |
1400 | Amundsen, et al. Expires March 6, 2015 [Page 25]
1401 |
1402 | Internet-Draft Application-Level Profile Semantics September 2014
1403 |
1404 |
1405 | properties in the representations. When implementing ALPS-compliant
1406 | client applications, the URLs will be supplied at runtime by the
1407 | server represetentations. Client apps only need to recognize the
1408 | descriptor 'id' and 'name' values from the referenced ALPS profile
1409 | document.
1410 |
1411 | A.2. Why is there no workflow component in the ALPS specification?
1412 |
1413 | ALPS is not designed to describe workflows or execution paths for a
1414 | service. Instead, ALPS is designed to describe a shared set of data
1415 | and actions elements that server MAY implement in order to create a
1416 | service. Each action descriptor (where the descriptor's type
1417 | property is set to "safe", "unsafe", or "idemponent") SHOULD describe
1418 | a state transition that a ALPS-compliant client application can
1419 | invoke when it is available. Servers are free to implement the
1420 | transitions they find useful and to arrange them in any order they
1421 | wish. ALPS-compliant client applications SHOULD be able to recognize
1422 | these descriptors when they appear and are free to act upon them
1423 | directly, render them for humans to invoke, or ignore/hide them
1424 | completely.
1425 |
1426 | A.3. Why is there no way to indicate ranges for semantic descriptors?
1427 |
1428 | For most all service implementations, there are cases where it would
1429 | be helpful to document a range of possible values for a semantic
1430 | element. For example, when implementing the descriptor {"id":"size",
1431 | ...}, one service might want to indicate the list of supported values
1432 | such as: "small", "meduim", "large", etc. However, another service
1433 | might have a very different list of possible values such as
1434 | "standard", "oversized", "undersized", etc. And there may be a
1435 | service that only supports a single value here and will always supply
1436 | it ("onesie").
1437 |
1438 | Since ALPS is meant to provide a single description that can be used
1439 | by multiple services, establishing ranges within the ALPS description
1440 | is considered over-constraining service implementations. Services
1441 | are free to supply this information within representations at run
1442 | time. But including them in the global ALPS profile is discouraged.
1443 |
1444 | Authors' Addresses
1445 |
1446 | Mike Amundsen
1447 | CA Technologies, Inc.
1448 |
1449 | EMail: mca@amundsen.com
1450 | URI: http://amundsen.com
1451 |
1452 |
1453 |
1454 |
1455 |
1456 | Amundsen, et al. Expires March 6, 2015 [Page 26]
1457 |
1458 | Internet-Draft Application-Level Profile Semantics September 2014
1459 |
1460 |
1461 | Leonard Richardson
1462 |
1463 | EMail: leonardr@segfault.org
1464 | URI: http://crummy.com
1465 |
1466 |
1467 | Mark W. Foster
1468 | Fingi, Inc.
1469 |
1470 | EMail: mwf@fosrias.com
1471 |
1472 |
1473 |
1474 |
1475 |
1476 |
1477 |
1478 |
1479 |
1480 |
1481 |
1482 |
1483 |
1484 |
1485 |
1486 |
1487 |
1488 |
1489 |
1490 |
1491 |
1492 |
1493 |
1494 |
1495 |
1496 |
1497 |
1498 |
1499 |
1500 |
1501 |
1502 |
1503 |
1504 |
1505 |
1506 |
1507 |
1508 |
1509 |
1510 |
1511 |
1512 | Amundsen, et al. Expires March 6, 2015 [Page 27]
1513 |
--------------------------------------------------------------------------------
/draft-01/draft-01.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Network Working Group M. Amundsen
6 | Internet-Draft CA Technologies, Inc.
7 | Expires: September 1, 2015 L. Richardson
8 |
9 | M. Foster
10 | Apiary
11 | February 28, 2015
12 |
13 |
14 | Application-Level Profile Semantics (ALPS)
15 | draft-amundsen-richardson-foster-alps-01
16 |
17 | Abstract
18 |
19 | This document describes ALPS, a data format for defining simple
20 | descriptions of application-level semantics, similar in complexity to
21 | HTML microformats. An ALPS document can be used as a profile to
22 | explain the application semantics of a document with an application-
23 | agnostic media type (such as HTML, HAL, Collection+JSON, Siren,
24 | etc.). This increases the reusability of profile documents across
25 | media types.
26 |
27 | Editorial Note (To be removed by RFC Editor)
28 |
29 | Distribution of this document is unlimited. Comments should be sent
30 | to the IETF Media-Types mailing list (see [1]).
31 |
32 | Status of This Memo
33 |
34 | This Internet-Draft is submitted in full conformance with the
35 | provisions of BCP 78 and BCP 79.
36 |
37 | Internet-Drafts are working documents of the Internet Engineering
38 | Task Force (IETF). Note that other groups may also distribute
39 | working documents as Internet-Drafts. The list of current Internet-
40 | Drafts is at http://datatracker.ietf.org/drafts/current/.
41 |
42 | Internet-Drafts are draft documents valid for a maximum of six months
43 | and may be updated, replaced, or obsoleted by other documents at any
44 | time. It is inappropriate to use Internet-Drafts as reference
45 | material or to cite them other than as "work in progress."
46 |
47 | This Internet-Draft will expire on September 1, 2015.
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | Amundsen, et al. Expires September 1, 2015 [Page 1]
57 |
58 | Internet-Draft Application-Level Profile Semantics February 2015
59 |
60 |
61 | Copyright Notice
62 |
63 | Copyright (c) 2015 IETF Trust and the persons identified as the
64 | document authors. All rights reserved.
65 |
66 | This document is subject to BCP 78 and the IETF Trust's Legal
67 | Provisions Relating to IETF Documents
68 | (http://trustee.ietf.org/license-info) in effect on the date of
69 | publication of this document. Please review these documents
70 | carefully, as they describe your rights and restrictions with respect
71 | to this document. Code Components extracted from this document must
72 | include Simplified BSD License text as described in Section 4.e of
73 | the Trust Legal Provisions and are provided without warranty as
74 | described in the Simplified BSD License.
75 |
76 | Table of Contents
77 |
78 | 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
79 | 1.1. Notational Conventions . . . . . . . . . . . . . . . . . 3
80 | 1.2. Motivation . . . . . . . . . . . . . . . . . . . . . . . 4
81 | 1.2.1. Describing Domain-Specific Semantics . . . . . . . . 4
82 | 1.2.2. ALPS-based Server Implementations . . . . . . . . . . 4
83 | 1.2.3. ALPS-based Client Implementations . . . . . . . . . . 4
84 | 1.3. A Simple ALPS Example . . . . . . . . . . . . . . . . . . 5
85 | 1.4. Identifying an ALPS Document . . . . . . . . . . . . . . 9
86 | 2. ALPS Documents . . . . . . . . . . . . . . . . . . . . . . . 10
87 | 2.1. Compliance . . . . . . . . . . . . . . . . . . . . . . . 10
88 | 2.2. ALPS Document Properties . . . . . . . . . . . . . . . . 10
89 | 2.2.1. 'alps' . . . . . . . . . . . . . . . . . . . . . . . 10
90 | 2.2.2. 'doc' . . . . . . . . . . . . . . . . . . . . . . . . 10
91 | 2.2.3. 'descriptor' . . . . . . . . . . . . . . . . . . . . 11
92 | 2.2.4. 'ext' . . . . . . . . . . . . . . . . . . . . . . . . 13
93 | 2.2.5. 'format' . . . . . . . . . . . . . . . . . . . . . . 13
94 | 2.2.6. 'href' . . . . . . . . . . . . . . . . . . . . . . . 14
95 | 2.2.7. 'id' . . . . . . . . . . . . . . . . . . . . . . . . 14
96 | 2.2.8. 'link' . . . . . . . . . . . . . . . . . . . . . . . 16
97 | 2.2.9. 'name' . . . . . . . . . . . . . . . . . . . . . . . 16
98 | 2.2.10. 'rel' . . . . . . . . . . . . . . . . . . . . . . . . 17
99 | 2.2.11. 'rt' . . . . . . . . . . . . . . . . . . . . . . . . 17
100 | 2.2.12. 'type' . . . . . . . . . . . . . . . . . . . . . . . 17
101 | 2.2.13. 'value' . . . . . . . . . . . . . . . . . . . . . . . 18
102 | 2.2.14. 'version' . . . . . . . . . . . . . . . . . . . . . . 18
103 | 2.3. ALPS Representations . . . . . . . . . . . . . . . . . . 18
104 | 2.3.1. Sample HTML . . . . . . . . . . . . . . . . . . . . . 18
105 | 2.3.2. XML Representation Example . . . . . . . . . . . . . 19
106 | 2.3.3. JSON Representation Example . . . . . . . . . . . . . 19
107 | 3. Applying ALPS documents to Existing Media Types . . . . . . . 21
108 | 3.1. Linking to ALPS Documents . . . . . . . . . . . . . . . . 22
109 |
110 |
111 |
112 | Amundsen, et al. Expires September 1, 2015 [Page 2]
113 |
114 | Internet-Draft Application-Level Profile Semantics February 2015
115 |
116 |
117 | 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 22
118 | 4.1. application/alps+xml . . . . . . . . . . . . . . . . . . 22
119 | 4.2. application/alps+json . . . . . . . . . . . . . . . . . . 24
120 | 5. Internationalization Considerations . . . . . . . . . . . . . 25
121 | 6. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 25
122 | 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 25
123 | 7.1. Normative References . . . . . . . . . . . . . . . . . . 25
124 | 7.2. Informative References . . . . . . . . . . . . . . . . . 25
125 | Appendix A. Frequently Asked Questions . . . . . . . . . . . . . 26
126 | A.1. Why are there no URLs in ALPS? . . . . . . . . . . . . . 26
127 | A.2. Why is there no workflow component in the ALPS
128 | specification? . . . . . . . . . . . . . . . . . . . . . 26
129 | A.3. Why is there no way to indicate ranges for semantic
130 | descriptors? . . . . . . . . . . . . . . . . . . . . . . 26
131 |
132 | 1. Introduction
133 |
134 | This document describes ALPS, a media type for defining simple
135 | descriptions of application-level semantics, similar in complexity to
136 | HTML microformats. These descriptions contain both human-readable
137 | and machine-readable explanations of the semantics. An ALPS document
138 | can be used as a profile to explain the application semantics of a
139 | document with an application-agnostic media type (such as HTML, HAL,
140 | Collection+JSON, Siren. etc.).
141 |
142 | This document identifies a registry for ALPS documents, (The ALPS
143 | Profile Registry or APR). The details of this registry, its goals,
144 | and operations are covered in a separate document (TBD).
145 |
146 | This document also identifies a process for authoring, publishing,
147 | and sharing normative human-readable instructions on applying an ALPS
148 | document as a profile to responses of a given media type. For
149 | example, a document that describes how to apply the semantics of an
150 | ALPS profile to an HTML document.
151 |
152 | This document registers two media-type identifiers with the IANA:
153 | 'application/alps+xml' ('ALPS+XML') and 'application/alps+json'
154 | ('ALPS+JSON').
155 |
156 | 1.1. Notational Conventions
157 |
158 | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
159 | "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
160 | document are to be interpreted as described in[RFC2119].
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 | Amundsen, et al. Expires September 1, 2015 [Page 3]
169 |
170 | Internet-Draft Application-Level Profile Semantics February 2015
171 |
172 |
173 | 1.2. Motivation
174 |
175 | When implementing a hypermedia client/server application using a
176 | general media type (HTML, Atom, Collection+JSON, etc.), client and
177 | server instances need to share an understanding of domain-specific
178 | information such as data element names, link relation values, and
179 | state transfer parameters. This information is directly related to
180 | the application being implemented (e.g. accounting, contact
181 | management, etc.) rather than the media type used in the
182 | representations.
183 |
184 | 1.2.1. Describing Domain-Specific Semantics
185 |
186 | Instead of creating and registering an entirely new media type (i.e.
187 | 'application/accounting'), representation authors can create an ALPS
188 | document that describes a 'profile' of the target domain; one that
189 | explains the vital domain-specific semantic descriptors and state
190 | transitions. This profile can then be consistently applied to a wide
191 | range of media types by server implementors and successfully consumed
192 | by client applications. The focus on defining application-level
193 | semantics, independent of transfer protocol or media type, makes it
194 | possible to serve application-specific representations using an
195 | application-agnostic media type.
196 |
197 | 1.2.2. ALPS-based Server Implementations
198 |
199 | Server implementors can use ALPS documents as a basis for building
200 | domain-specific solutions without having to create their own custom
201 | media type or re-invent the vocabulary and transition set for a
202 | common domain (e.g. accounting, microblogging, etc.). Using a
203 | preexisting ALPS profile as a guide, servers can map internal data to
204 | commonly-understood semantic descriptors and state transitions,
205 | increasing the likelihood that existing client applications (those
206 | who share the same understanding of the ALPS document) will be able
207 | to successfully interact with that server.
208 |
209 | 1.2.3. ALPS-based Client Implementations
210 |
211 | Armed with a document's ALPS profile, client applications can
212 | associate the ALPS descriptor 'id' and/or 'name' attribute values
213 | with the appropriate elements within the document. Client
214 | applications can 'code for the profile' and better adjust to detailed
215 | changes to the response layout, or even the wholesale replacement of
216 | one media type with another.
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 | Amundsen, et al. Expires September 1, 2015 [Page 4]
225 |
226 | Internet-Draft Application-Level Profile Semantics February 2015
227 |
228 |
229 | 1.3. A Simple ALPS Example
230 |
231 | Below is an ALPS document that describes elements of a simple
232 | request/response interaction in a contact management application.
233 | The profile defines a semantic descriptor called 'contact', and three
234 | subordinate descriptors ('fullName', 'email', and 'phone').
235 |
236 | The ALPS document also defines a single, safe state transition, to be
237 | represented by a hypermedia control (e.g. HTML.GET form) with the
238 | 'id' value of 'collection.' This hypermedia control has one input
239 | value ('nameSearch'). When executed, the response will contain one
240 | or more 'contact' type items.
241 |
242 |
243 | A contact list.
244 |
245 |
246 |
247 |
248 | A simple link/form for getting a list of contacts.
249 |
250 |
251 | Input for a search form.
252 |
253 |
254 |
255 |
256 |
257 |
258 | A link to an individual contact.
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 | ALPS Contact Profile document
267 |
268 | Implementing the ALPS profile above requires implementing the
269 | descriptors defined by the ALPS document. In this case, there are
270 | two 'top level' descriptors: the safe state transition ('collection')
271 | and the semantic descriptor 'contact'. Below is a single HTML
272 | document that shows both these elements in a representation.
273 |
274 |
275 |
276 |
286 |
288 |
289 |
290 |
297 |
298 |
329 |
330 |
331 |
332 | HTML ALPS Contact Representation
333 |
334 |
335 |
336 | Amundsen, et al. Expires September 1, 2015 [Page 6]
337 |
338 | Internet-Draft Application-Level Profile Semantics February 2015
339 |
340 |
341 | HTML representations implement most ALPS elements using HTML's
342 | 'class' attribute. The 'collection' ID has become the CSS class of
343 | an HTML form's submit button. The 'contact' ID has become the CSS
344 | class of the TR elements in an HTML table. The subordinate
345 | descriptors 'fullname','email', and 'phone' are rendered as the TD
346 | elements of each TR.
347 |
348 | This HAL document uses the same profile to express the same
349 | application-level semantics as the HTML document.
350 |
351 |
352 |
354 |
357 |
358 |
360 | Ann Arbuckle
361 | aa@example.org
362 | 123.456.7890
363 |
364 |
365 |
367 | Zelda Zackney
368 | zz@example.org
369 | 987.664.3210
370 |
371 |
372 |
373 | HAL XML Contacts Representation
374 |
375 | In a HAL representation, all state transitions ('collection' and
376 | 'item', in this case) are represented as link relations. All data
377 | descriptors ('fullName', 'email', and 'phone') are represented as XML
378 | tags named after the descriptors.
379 |
380 | This Collection+JSON document uses the ALPS profile to express the
381 | same application-level semantics as the HTML and HAL documents.
382 |
383 | {
384 | "collection" : {
385 | "version" : "1.0",
386 | "href" : "http://example.org/contacts/",
387 |
388 | "links" : [
389 |
390 |
391 |
392 | Amundsen, et al. Expires September 1, 2015 [Page 7]
393 |
394 | Internet-Draft Application-Level Profile Semantics February 2015
395 |
396 |
397 | {
398 | "rel" : "profile",
399 | "href" : "http://alps.io/profiles/contacts"
400 | },
401 | {
402 | "rel" : "type",
403 | "href" : "http://alps.io/profiles/contacts#contact"
404 | }
405 | ],
406 |
407 | "queries" : [
408 | {
409 | "rel" : "collection",
410 | "rt" : "contact",
411 | "href" : "http://example.org/contacts/",
412 | "data" : [
413 | {
414 | "name" : "nameSearch",
415 | "value" : "",
416 | "prompt" : "Search Name"
417 | }
418 | ]
419 | }
420 | ],
421 |
422 | "items" : [
423 | {
424 | "href" : "http://example.org/contacts/1",
425 | "rel" : "item",
426 | "rt" : "contact",
427 | "data" : [
428 | {"name" : "fullName", "value" : "Ann Arbuckle"},
429 | {"name" : "email", "value" : "aa@example.org"},
430 | {"name" : "phone", "value" : "123.456.7890"}
431 | ],
432 | "links" : [
433 | {
434 | "rel" : "type",
435 | "href" : "http://alps.io/profiles/contacts#contact"
436 | }
437 | ]
438 | },
439 | {
440 | "href" : "http://example.org/contacts/100",
441 | "rel" : "item",
442 | "rt" : "contact",
443 | "data" : [
444 | {
445 |
446 |
447 |
448 | Amundsen, et al. Expires September 1, 2015 [Page 8]
449 |
450 | Internet-Draft Application-Level Profile Semantics February 2015
451 |
452 |
453 | "name" : "fullName",
454 | "value" : "Zelda Zackney"
455 | },
456 | {
457 | "name" : "email",
458 | "value" : "zz@example.org"
459 | },
460 | {
461 | "name" : "phone",
462 | "value" : "987.654.3210"
463 | }
464 | ],
465 | "links" : [
466 | {
467 | "rel" : "type",
468 | "href" : "http://alps.io/profiles/contacts#contact"
469 | }
470 | ]
471 | }
472 | ]
473 | }
474 | }
475 |
476 |
477 | Collection+JSON Contacts Representation
478 |
479 | The descriptor 'collection' has become the link relation associated
480 | with a Collection+JSON query. The descriptors 'fullName', 'email',
481 | and 'phone' have become the names of key-value pairs in the items in
482 | a Collection+JSON collection.
483 |
484 | 1.4. Identifying an ALPS Document
485 |
486 | An ALPS vocabulary is identified by a unique URL. This URL SHOULD be
487 | assumed to be dereferencable. All ALPS URLs MUST be unique and all
488 | ALPS documents intended for public consumption SHOULD be registered
489 | in an ALPS Registry [TK: add text on where/how to find registries
490 | -mamund].
491 |
492 | In order to reduce load on servers responding to ALPS document
493 | requests, it is RECOMMENDED that servers use cache control directives
494 | that instruct client apps to locally cache the results. Clients
495 | making these ALPS document requests SHOULD honor the server's caching
496 | directives.
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 | Amundsen, et al. Expires September 1, 2015 [Page 9]
505 |
506 | Internet-Draft Application-Level Profile Semantics February 2015
507 |
508 |
509 | 2. ALPS Documents
510 |
511 | An ALPS document contains a machine-readable collection of
512 | identifying strings and their human-readable explanations. An ALPS
513 | document can be represented in either XML or JSON format. This
514 | section identifies the general elements and properties of an ALPS
515 | document, their meaning, and their use, independent of how the
516 | document is represented. Section 2.3 provides specific details on
517 | constructing a valid ALPS document in XML and in JSON format.
518 |
519 | 2.1. Compliance
520 |
521 | An implementation is not compliant if it fails to satisfy one or more
522 | of the MUST or REQUIRED level requirements. An implementation that
523 | satisfies all the MUST or REQUIRED level and all the SHOULD level
524 | requirements is said to be 'unconditionally compliant'; one that
525 | satisfies all the MUST level requirements but not all the SHOULD
526 | level requirements is said to be 'conditionally compliant.'
527 |
528 | 2.2. ALPS Document Properties
529 |
530 | The ALPS media type defines a small set of properties. These
531 | properties appear in both the XML and JSON formats. Below is a list
532 | of the properties that can appear in an ALPS document.
533 |
534 | 2.2.1. 'alps'
535 |
536 | Indicates the root of the ALPS document. This property is REQUIRED,
537 | and it SHOULD have one or more 'descriptor' child properties.
538 |
539 | Examples:
540 |
541 | XML: ...
542 |
543 | JSON: { "alps" : ... }
544 |
545 | 2.2.2. 'doc'
546 |
547 | A text field that contains free-form, usually human-readable, text.
548 | The 'doc' element MAY have two properties: 'href' and 'format'. If
549 | the 'href' property appears it SHOULD contain a dereferencable URL
550 | that points to human-readable text. If the 'format' property appears
551 | it SHOULD contain one of the following values: 'text', 'html',
552 | 'asciidoc', or 'markdown'. Any program processing 'doc' elements
553 | SHOULD honor the 'format' directive and parse/render the content
554 | appropriately. If the value in the 'format' property is not
555 | recognized and/or supported, the processing program MUST treat the
556 |
557 |
558 |
559 |
560 | Amundsen, et al. Expires September 1, 2015 [Page 10]
561 |
562 | Internet-Draft Application-Level Profile Semantics February 2015
563 |
564 |
565 | content as plain text. If no 'format' property is present, the
566 | content SHOULD be treated as plain text.
567 |
568 | XML:
Date of Birth
...
569 |
570 | JSON: { "doc" : { "format" : "text" : "value" : "Date of Birth ..."
571 | } }
572 |
573 | A 'doc' element SHOULD appear as a child of 'descriptor'. When
574 | present, it describes the meaning and use of the related
575 | 'descriptor'.
576 |
577 | XML: ...
578 |
579 | JSON: { "descriptor" : { { "doc" : { "value" : "..." } ... } }
580 |
581 | The 'doc' element MAY appear as a child of 'alps'. When present, it
582 | describes the purpose of the ALPS document as a whole.
583 |
584 | XML: ... ...
585 |
586 | JSON: { "alps : "doc" : { "value" : "..." }, ... }
587 |
588 | 2.2.3. 'descriptor'
589 |
590 | A 'descriptor' element defines the semantics of specific data
591 | elements or state transitions that MAY exist in an associated
592 | representation.
593 |
594 | One or more 'descriptor' elements SHOULD appear as children of
595 | 'alps'. It may also appear as a child of itself; that is, the
596 | 'descriptor' property may be nested.
597 |
598 | The 'descriptor' property SHOULD have either an 'id' or 'href'
599 | attribute. It MAY have both. Additionally, the 'descriptor' MAY
600 | have any of the following attributes:
601 |
602 | 1. 'doc'
603 |
604 | 2. 'ext'
605 |
606 | 3. 'name'
607 |
608 | 4. 'type'
609 |
610 | If present, the 'href' property MUST be a dereferenceable URL, that
611 | points to another 'descriptor' either within the current ALPS
612 | document or in another ALPS document.
613 |
614 |
615 |
616 | Amundsen, et al. Expires September 1, 2015 [Page 11]
617 |
618 | Internet-Draft Application-Level Profile Semantics February 2015
619 |
620 |
621 | If 'descriptor' has an 'href' attribute, then 'descriptor' is
622 | inheriting all the attributes and sub-properties of the descriptor
623 | pointed to by 'href'. When 'descriptor' has a property defined
624 | locally, that property value takes precedence over any inherited
625 | property value. Since there is no limit to the nesting of elements
626 | -- even ones linked remotely -- it is important to process 'all
627 | descriptor' chains starting from the bottom to make sure you have
628 | collected all the available properties and have established the
629 | correct value for each of them.
630 |
631 | If 'descriptor' is declared at the top level of an ALPS document,
632 | then a client SHOULD assume that 'descriptor' can appear anywhere in
633 | a runtime message.
634 |
635 | If 'descriptor' is nested, i.e. declared as a child of another
636 | descriptor, then:
637 |
638 | 1. A client SHOULD assume them to appear in any sibling 'descriptor'
639 | element and recursively in their child descriptors.
640 |
641 | 2. A client SHOULD NOT assume that it can appear anywhere outside of
642 | parent descriptor, unless it was explicitly referenced by another
643 | descriptor in 'href' attribute. In that case the same rules are
644 | applied to 'descriptor' containing 'href' attribute.
645 |
646 | 2.2.3.1. 'Descriptors and Link Relation Types'
647 |
648 | When a representation is generated that includes state transitions,
649 | valid values for link relation types are:
650 |
651 | 1. A registered IANA link relation type (e.g. rel="edit", a short
652 | string).
653 |
654 | 2. An extension link relation type as defined by [RFC5988] whose
655 | value is the fully-qualified URI of an associated document
656 | describing the relation type. This includes URI fragment
657 | identifiers of ALPS descriptors (e.g.
658 | rel="http://alps.io/profiles/item#purchased-by", a URI) per the
659 | conventions of Section 2.2.7.2.
660 |
661 | 3. The 'id' property of a state transition descriptor of an
662 | associated ALPS document (e.g. rel="purchased-by", a short
663 | string) per the conventions of section Section 2.2.7.1 and
664 | Section 2.2.7.3 if the representation includes an ALPS profile.
665 |
666 |
667 |
668 |
669 |
670 |
671 |
672 | Amundsen, et al. Expires September 1, 2015 [Page 12]
673 |
674 | Internet-Draft Application-Level Profile Semantics February 2015
675 |
676 |
677 | 2.2.4. 'ext'
678 |
679 | The 'ext' element can be used to extend the ALPS document with
680 | author-specific information. It provides a way to customize ALPS
681 | documents with additional properties not covered in this
682 | specification. This is an OPTIONAL element.
683 |
684 | The 'ext' element has the following properties.
685 |
686 | 1. 'id'
687 |
688 | 2. 'href'
689 |
690 | 3. 'value'
691 |
692 | The 'id' property is REQUIRED. The 'href' is RECOMMENDED and it
693 | SHOULD point to documentation that explains the use and meaning of
694 | this 'ext' element. The 'value' property is OPTIONAL. The content
695 | is undetermined; its meaning and use SHOULD be explained by the
696 | document found by de-referencing the 'href' property.
697 |
698 | Examples:
699 |
700 | XML:
702 |
703 | JSON: { "ext" : { "id" : "directions", "href" : "http://alps.io/ext/
704 | directions", value="north south east west" } }
705 |
706 | The 'ext' element MAY appear as a child of the following elements:
707 |
708 | 1. 'alps'
709 |
710 | 2. 'descriptor'
711 |
712 | Since the 'ext' element has no specific meaning within this
713 | specification, it MUST be ignored by any application that does not
714 | understand its meaning.
715 |
716 | 2.2.5. 'format'
717 |
718 | Indicates how the text content should be parsed and/or rendered.
719 | This specification identifies a range of possible values for
720 | 'format':
721 |
722 | o 'text', for plain text, MUST be supported.
723 |
724 | o 'html', for HTML, SHOULD be supported.
725 |
726 |
727 |
728 | Amundsen, et al. Expires September 1, 2015 [Page 13]
729 |
730 | Internet-Draft Application-Level Profile Semantics February 2015
731 |
732 |
733 | o 'asciidoc', for AsciiDoc, MAY be supported.
734 |
735 | o 'markdown', per The text/markdown Media Type
736 | [I-D.ietf-appsawg-text-markdown], MAY be supported.
737 |
738 | Any other values for this attribute are undefined and SHOULD be
739 | treated as plain text. If the program does not recognize the value
740 | of the 'format' property and/or the 'format' property is missing, the
741 | content SHOULD be treated as plain text.
742 |
743 | This property MAY appear as an attribute of the 'doc' element.
744 |
745 | 2.2.6. 'href'
746 |
747 | Contains a resolvable URL.
748 |
749 | When it appears as an attribute of a 'descriptor', 'href' points to
750 | another 'descriptor' either within the existing ALPS document as a
751 | fragment or in another ALPS document as an absolute URL. The URL
752 | MUST contain a fragment per Section 2.2.7.2 referencing the related
753 | 'descriptor'.
754 |
755 | When it appears as an attribute of 'ext', 'href' points to an
756 | external document which provides the defintion of the extension.
757 |
758 | When it appears as an attribute of 'link', 'href' points to an
759 | external document whose relationship to the current document or
760 | 'descriptor' is described by the associated 'rel' property.
761 |
762 | When it appears as an attribute of 'doc', 'href' points to a document
763 | that contains human-readable text that describes the associated
764 | 'descriptor' or ALPS document.
765 |
766 | 2.2.7. 'id'
767 |
768 | A document-wide unique identifier for the related element. This
769 | SHOULD appear as an attribute of a 'descriptor'.
770 |
771 | The value of this attribute MAY be used as an identifier in the
772 | related runtime hypermedia representation. In the example below the
773 | ALPS descriptor with an 'id' of 'q' is used to identify an HTML input
774 | element:
775 |
776 | 'id' in ALPS...
777 |
778 | ...becomes the 'class' in HTML
780 |
781 |
782 |
783 |
784 | Amundsen, et al. Expires September 1, 2015 [Page 14]
785 |
786 | Internet-Draft Application-Level Profile Semantics February 2015
787 |
788 |
789 | It should be noted that the exact mapping from ALPS elements (e.g.
790 | 'id') to elements within a particular media type (HTML,
791 | Collection+JSON, etc.) is covered in separate documents (to be
792 | specified).
793 |
794 | 2.2.7.1. ALPS 'id' and 'name' Properties
795 |
796 | In some cases, media types support non-unique identifiers (e.g.
797 | HTML's 'name' property) or will allow the same identifier value for
798 | multiple elements in the same representation (e.g. and and ). In those cases, translating that
801 | representation into ALPS documents could result in multiple 'id'
802 | properties with the same value.
803 |
804 | To avoid this, ALPS document designers can add the 'name' property to
805 | a 'descriptor' to hold the common value ('search') while still using
806 | the 'id' property to hold a document-wide unique value. For example:
807 |
808 |
809 |
810 |
814 |
815 |
816 | HTML Representation of a Search Transition
817 |
818 |
819 |
820 |
821 |
822 |
823 |
824 |
825 | ALPS Description of the same Search Transition
826 |
827 | 2.2.7.2. Fragment Identifiers and 'id'
828 |
829 | When applied to an ALPS document, a URI fragment identifier points to
830 | the 'descriptor' whose 'id' is the value of the fragment. For
831 | example, the fragment identifier 'customer' in the URI
832 | http://example.com/my-alps-document#customer refers to an ALPS
833 | 'descriptor' with 'id' set to 'customer'.
834 |
835 |
836 |
837 |
838 |
839 |
840 | Amundsen, et al. Expires September 1, 2015 [Page 15]
841 |
842 | Internet-Draft Application-Level Profile Semantics February 2015
843 |
844 |
845 | A relative URL with a fragment identifier within an ALPS document
846 | (e.g. href="#customer") refers to a local 'descriptor' within the
847 | document containing the reference.
848 |
849 | The complete URI to an ALPS 'descriptor' (including the fragment)
850 | forms an 'abstract semantic type' identifier. This is a resolvable
851 | URI (URL) that can be used to indicate the type of a resource; for
852 | instance, it can be used as the value of the IANA-registered relation
853 | type 'type'.
854 |
855 | 2.2.7.3. Link Relation Values and 'id' or 'name'
856 |
857 | Since a state transition 'descriptor' may define a relation type
858 | value, it is important to avoid creating conflicts with existing
859 | IANA-registered values. If the resulting link relation type is the
860 | same as a registered relation type, the descriptor MUST not change
861 | the meaning of the IANA relation type.
862 |
863 | Further, since the 'id' of a 'descriptor' may define a link relation
864 | value per Section 2.2.3.1, if a conflict exists in defining such a
865 | descriptor's document-wide unique 'id' with another 'descriptor', the
866 | conflicting 'descriptor' MUST define a unique 'id' and MAY specify a
867 | 'name' property to resolve the conflict.
868 |
869 | If it is unclear whether a registered link relation type in a
870 | representation document refers to a relation registered with IANA or
871 | a relation registered in an ALPS profile, the semantics of that link
872 | are undefined.
873 |
874 | 2.2.8. 'link'
875 |
876 | An element that identifies a link between the current ALPS element
877 | and some other (possibly external) resource. MAY be a child element
878 | of the 'alps' and the 'descriptor' elements.
879 |
880 | The 'link' element MUST define the two attributes 'href' and 'rel'.
881 |
882 | 2.2.9. 'name'
883 |
884 | Indicates the name of the 'descriptor' as found in generic
885 | representations. It MAY appear as a property of 'descriptor'.
886 |
887 | This is used when the name of the 'descriptor' is used as an 'id'
888 | value elsewhere in the ALPS document. For instance, if a single ALPS
889 | document defines a semantic descriptor (data element) called
890 | 'customer' and a safe descriptor (transition element) also called
891 | 'customer', they cannot both have 'id="customer"' in the ALPS
892 |
893 |
894 |
895 |
896 | Amundsen, et al. Expires September 1, 2015 [Page 16]
897 |
898 | Internet-Draft Application-Level Profile Semantics February 2015
899 |
900 |
901 | document. One of them needs to have some other 'id', and to set
902 | 'name="customer"'.
903 |
904 | The use of the 'name' property usually indicates an ambiguity in the
905 | application semantics. Thus, it SHOULD only be used when creating an
906 | ALPS profile that describes an existing design.
907 |
908 | 2.2.10. 'rel'
909 |
910 | Contains a [RFC5988] approved value: either an extension relation
911 | type (a URI) or a registered relation type (a short string).
912 |
913 | Appears as a property of'link'.
914 |
915 | 2.2.11. 'rt'
916 |
917 | Indicates the resource type that will be returned when executing the
918 | specified network request. The 'rt' attribute SHOULD appear only on
919 | a 'descriptor' with a 'type' value of 'safe', 'unsafe', or
920 | 'idempotent.'
921 |
922 | The 'rt' attribute is OPTIONAL and is an opaque string and MAY match
923 | the 'id' of an existing'descriptor'.
924 |
925 | 2.2.12. 'type'
926 |
927 | Indicates the type of hypermedia control to which the element is
928 | applied within the resulting representation. This SHOULD appear for
929 | each 'descriptor' element. The four valid values are:
930 |
931 | 'semantic' A state element (e.g. HTML.SPAN, HTML.INPUT, etc.).
932 |
933 | 'safe' A hypermedia control that triggers a safe, idempotent state
934 | transition (e.g. HTTP.GET or HTTP.HEAD).
935 |
936 | 'idempotent' A hypermedia control that triggers an unsafe,
937 | idempotent state transition (e.g. HTTP.PUT or HTTP.DELETE).
938 |
939 | 'unsafe' A hypermedia control that triggers an unsafe, non-
940 | idempotent state transition (e.g. HTTP.POST).
941 |
942 | If no 'type' attribute is associated with the element, then
943 | 'type="semantic"' is implied.
944 |
945 |
946 |
947 |
948 |
949 |
950 |
951 |
952 | Amundsen, et al. Expires September 1, 2015 [Page 17]
953 |
954 | Internet-Draft Application-Level Profile Semantics February 2015
955 |
956 |
957 | 2.2.13. 'value'
958 |
959 | Contains a string value. It MAY appear as an attribute of the 'doc'
960 | and the 'ext' elements.
961 |
962 | 2.2.14. 'version'
963 |
964 | Indicates the version of the ALPS specification used in the document.
965 | This SHOULD appear as a property of the 'alps' element. Currently
966 | the only valid value is '1.0'. If no value appears, then
967 | 'version="1.0"' is implied.
968 |
969 | 2.3. ALPS Representations
970 |
971 | An ALPS document may be represented in either XML or JSON format.
972 | This section contains notes on how the ALPS elements and attributes
973 | appear in each format, along with examples to guide ALPS document
974 | authors.
975 |
976 | 2.3.1. Sample HTML
977 |
978 | Below is a simple HTML document that contains a handful of semantic
979 | descriptors and transition instructions. This document was generated
980 | from the XML and JSON ALPS documents that follow. Use this HTML
981 | document as a guide when evaluating the XML and JSON examples.
982 |
983 |
984 |
985 |
986 |
987 |
988 |
989 |
997 |
998 |
999 |
1000 | HTML Sample
1001 |
1002 |
1003 |
1004 |
1005 |
1006 |
1007 |
1008 | Amundsen, et al. Expires September 1, 2015 [Page 18]
1009 |
1010 | Internet-Draft Application-Level Profile Semantics February 2015
1011 |
1012 |
1013 | 2.3.2. XML Representation Example
1014 |
1015 | In the XML version of an ALPS document, the following ALPS properties
1016 | always appear as XML elements: 'alps', 'doc', 'descriptor', and
1017 | 'ext'. All other ALPS properties appear as XML attributes.
1018 |
1019 | 2.3.2.1. Complete XML Representation
1020 |
1021 | Below is an example of an application/alps+xml representation.
1022 |
1023 |
1024 |
1025 |
1026 |
1027 |
1028 | A search form with two inputs.
1029 |
1030 |
1031 | input for search
1032 |
1033 |
1034 |
1035 |
1036 | results format
1037 |
1040 |
1041 |
1042 |
1043 | Complete XML Representation
1044 |
1045 | 2.3.3. JSON Representation Example
1046 |
1047 | When representing ALPS documents in JSON format, the 'descriptor' and
1048 | 'ext' properties are always expressed as arrays of anonymous objects
1049 | - even when there is only one member in the array.
1050 |
1051 |
1052 |
1053 |
1054 |
1055 |
1056 |
1057 |
1058 |
1059 |
1060 |
1061 |
1062 |
1063 |
1064 | Amundsen, et al. Expires September 1, 2015 [Page 19]
1065 |
1066 | Internet-Draft Application-Level Profile Semantics February 2015
1067 |
1068 |
1069 | For example:
1070 |
1071 | "descriptor" : [
1072 | {
1073 | "id" : "value",
1074 | "name" : "search",
1075 | "type" : "descriptor",
1076 | "doc" : { "value" : "input for search" }
1077 | },
1078 | { "href" : "#resultType" }
1079 | ]
1080 |
1081 | Arrays in ALPS+JSON
1082 |
1083 | The 'doc' property is always expressed as a named object.
1084 |
1085 | For example:
1086 |
1087 | {
1088 | "doc" : {
1089 | "format" : "text",
1090 | "value" : "Rules are important"
1091 | }
1092 | }
1093 |
1094 | Descriptions in ALPS+JSON
1095 |
1096 | 2.3.3.1. Complete JSON Representation
1097 |
1098 | Below is a example of the application/alps+json representation of an
1099 | ALPS document.
1100 |
1101 |
1102 |
1103 |
1104 |
1105 |
1106 |
1107 |
1108 |
1109 |
1110 |
1111 |
1112 |
1113 |
1114 |
1115 |
1116 |
1117 |
1118 |
1119 |
1120 | Amundsen, et al. Expires September 1, 2015 [Page 20]
1121 |
1122 | Internet-Draft Application-Level Profile Semantics February 2015
1123 |
1124 |
1125 | {
1126 | "alps" : {
1127 | "version" : "1.0",
1128 | "doc" : {
1129 | "href" : "http://example.org/samples/full/doc.html"
1130 | },
1131 | "descriptor" : [
1132 | {
1133 | "id" : "search",
1134 | "type" : "safe",
1135 | "doc" : {"value" :
1136 | "A search form with a two inputs"
1137 | },
1138 | "descriptor" : [
1139 | {
1140 | "id" : "value",
1141 | "name" : "search",
1142 | "type" : "descriptor",
1143 | "doc" : { "value" : "input for search" }
1144 | },
1145 | { "href" : "#resultType" }
1146 | ]
1147 | },
1148 | {
1149 | "id" : "resultType",
1150 | "type" : "descriptor",
1151 | "description" : {"value" : "results format"},
1152 | "ext" : [
1153 | {
1154 | "href" : "http://alps.io/ext/range",
1155 | "value" : "summary,detail"
1156 | }
1157 | ]
1158 | }
1159 | ]
1160 | }
1161 | }
1162 |
1163 | Complete ALPS+JSON Representation
1164 |
1165 | 3. Applying ALPS documents to Existing Media Types
1166 |
1167 | An ALPS document can be applied to many existing media types as long
1168 | as there exists an agreed mapping between ALPS and the target media
1169 | type. Section 1.3 gave some informative examples of this.
1170 | Normative, up-to-date guidance on applying ALPS documents to existing
1171 | media types are available at the official ALPS Web site at
1172 |
1173 |
1174 |
1175 |
1176 | Amundsen, et al. Expires September 1, 2015 [Page 21]
1177 |
1178 | Internet-Draft Application-Level Profile Semantics February 2015
1179 |
1180 |
1181 | (http://alps.io/docs/mapping). [TK : this page does not yet exist.
1182 | -mamund]
1183 |
1184 | Not all media types can faithfully represent all ALPS descriptors.
1185 | For instance, the 'application/json' media type has no standard way
1186 | of representing hyperlinks. The [details of how to apply ALPS to
1187 | such a media type will necesarily be incomplete, and it will not be
1188 | possible to represent some aspects of an ALPS profile in documents in
1189 | that media type.
1190 |
1191 | 3.1. Linking to ALPS Documents
1192 |
1193 | To indicate that an ALPS profile describes the semantics of some
1194 | representation document, the representation document SHOULD be linked
1195 | to the ALPS document. The 'profile' link relation [RFC6906] MUST be
1196 | used when creating this link. If the media type of the
1197 | representation document has no native ability to link to other
1198 | resources, or no ability to express link relations, the HTTP header
1199 | 'Link' [RFC5988] MAY be used to connect the representation document
1200 | and the ALPS profile. If the media type of the representation
1201 | document defines a parameter for linking the document to a profile,
1202 | that parameter MAY be used to connect the representation document and
1203 | the ALPS profile.
1204 |
1205 | A single representation document may be described by more than one
1206 | ALPS profile. If two ALPS profiles give conflicting semantics for
1207 | the same element, the document linked to earlier in the
1208 | representation SHOULD take precedence. A profile linked to using the
1209 | 'Link' header takes precedence over a profile linked to within the
1210 | representation document itself. A profile linked to using a media
1211 | type parameter takes precedence over a profile linked to using the
1212 | 'Link' header and a profile linked to within the representation
1213 | document itself.
1214 |
1215 | 4. IANA Considerations
1216 |
1217 | This specification establishes two media types: 'application/
1218 | alps+xml' and 'application/alps+json'
1219 |
1220 | 4.1. application/alps+xml
1221 |
1222 | Type name: application
1223 |
1224 | Subtype name: alps+xml
1225 |
1226 | Required parameters: None
1227 |
1228 | Optional parameters:
1229 |
1230 |
1231 |
1232 | Amundsen, et al. Expires September 1, 2015 [Page 22]
1233 |
1234 | Internet-Draft Application-Level Profile Semantics February 2015
1235 |
1236 |
1237 | charset This parameter has identical semantics to the charset
1238 | parameter of the 'application/xml' media type as specified
1239 | in[RFC3023].
1240 |
1241 | profile A whitespace-separated list of IRIs identifying specific
1242 | constraints or conventions that apply to an ALPS document. A
1243 | profile must not change the semantics of the resource
1244 | representation when processed without profile knowledge, so
1245 | that clients both with and without knowledge of a profiled
1246 | resource can safely use the same representation. The profile
1247 | parameter may also be used by clients to express their
1248 | preferences in the content negotiation process. It is
1249 | recommended that profile IRIs are dereferenceable and provide
1250 | useful documentation at that IRI.
1251 |
1252 | Encoding considerations:
1253 |
1254 | binary Same as encoding considerations of application/xml as
1255 | specified in[RFC3023].
1256 |
1257 | Security considerations: This format shares security issues common
1258 | to all XML content types. It does not provide executable content.
1259 | Information contained in ALPS documents do not require privacy or
1260 | integrity services.
1261 |
1262 | Interoperability considerations: ALPS is not described by a DTD and
1263 | applies only the well-formedness rules of XML. It should only be
1264 | parsed by a non-validating parser.
1265 |
1266 | Published specification: This Document
1267 |
1268 | Applications that use this media type: Various
1269 |
1270 | Additional information:
1271 |
1272 | magic number(s): none
1273 |
1274 | file extensions: .xml
1275 |
1276 | macintosh type file code: TEXT
1277 |
1278 | object idenfiers: none
1279 |
1280 | person to contact for further information:
1281 |
1282 | Name: Mike Amundsen
1283 |
1284 | Email: mca@amundsen.com
1285 |
1286 |
1287 |
1288 | Amundsen, et al. Expires September 1, 2015 [Page 23]
1289 |
1290 | Internet-Draft Application-Level Profile Semantics February 2015
1291 |
1292 |
1293 | Intended usage: Common
1294 |
1295 | Author/change controller: Mike Amundsen
1296 |
1297 | 4.2. application/alps+json
1298 |
1299 | Type name: application
1300 |
1301 | Subtype name: alps+json
1302 |
1303 | Required parameters: None
1304 |
1305 | Optional parameters:
1306 |
1307 | profile A whitespace-separated list of IRIs identifying specific
1308 | constraints or conventions that apply to an ALPS document. A
1309 | profile must not change the semantics of the resource
1310 | representation when processed without profile knowledge, so
1311 | that clients both with and without knowledge of a profiled
1312 | resource can safely use the same representation. The profile
1313 | parameter may also be used by clients to express their
1314 | preferences in the content negotiation process. It is
1315 | recommended that profile IRIs are dereferenceable and provide
1316 | useful documentation at that IRI.
1317 |
1318 | Encoding considerations: binary
1319 |
1320 | Security considerations: This media type shares security issues
1321 | common to all JSON content types. See [RFC4627] Section #6 for
1322 | additional information. ALPS+JSON does not provide executable
1323 | content. Information contained in ALPS+JSON documents do not
1324 | require privacy or integrity services.
1325 |
1326 | Interoperability considerations: None
1327 |
1328 | Published specification: This Document
1329 |
1330 | Applications that use this media type: Various
1331 |
1332 | Additional information:
1333 |
1334 | magic number(s): none
1335 |
1336 | file extensions: .json
1337 |
1338 | macintosh type file code: TEXT
1339 |
1340 | object idenfiers: none
1341 |
1342 |
1343 |
1344 | Amundsen, et al. Expires September 1, 2015 [Page 24]
1345 |
1346 | Internet-Draft Application-Level Profile Semantics February 2015
1347 |
1348 |
1349 | person to contact for further information:
1350 |
1351 | Name: Mike Amundsen
1352 |
1353 | Email: mca@amundsen.com
1354 |
1355 | Intended usage: Common
1356 |
1357 | Author/change controller: Mike Amundsen
1358 |
1359 | 5. Internationalization Considerations
1360 |
1361 | [TK]
1362 |
1363 | [[CREF1: insert text (consider rfc 5987)]]
1364 |
1365 | 6. Acknowledgements
1366 |
1367 | The following people made contributions to this specification:
1368 |
1369 | 7. References
1370 |
1371 | 7.1. Normative References
1372 |
1373 | [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
1374 | Requirement Levels", BCP 14, RFC 2119, March 1997.
1375 |
1376 | [RFC3023] Murata, M., St. Laurent, S., and D. Kohn, "XML Media
1377 | Types", RFC 3023, January 2001.
1378 |
1379 | [RFC4627] Crockford, D., "The application/json Media Type for
1380 | JavaScript Object Notation (JSON)", RFC 4627, July 2006.
1381 |
1382 | [RFC5988] Nottingham, M., "Web Linking", RFC 5988, October 2010.
1383 |
1384 | [RFC6906] Wilde, E., "The 'profile' Link Relation Type", RFC 6906,
1385 | March 2013.
1386 |
1387 | [RFC7320] Nottingham, M., "URI Design and Ownership", BCP 190, RFC
1388 | 7320, July 2014.
1389 |
1390 | 7.2. Informative References
1391 |
1392 | [I-D.ietf-appsawg-text-markdown]
1393 | Leonard, S., "The text/markdown Media Type", draft-ietf-
1394 | appsawg-text-markdown-05 (work in progress), December
1395 | 2014.
1396 |
1397 |
1398 |
1399 |
1400 | Amundsen, et al. Expires September 1, 2015 [Page 25]
1401 |
1402 | Internet-Draft Application-Level Profile Semantics February 2015
1403 |
1404 |
1405 | Appendix A. Frequently Asked Questions
1406 |
1407 | A.1. Why are there no URLs in ALPS?
1408 |
1409 | ALPS is meant to describe a service in a universal way. The same
1410 | ALPS description document can be used by many ALPS-compliant servers.
1411 | Since each service implementation is in charge of their own URL
1412 | space, ALPS descriptions do not include URLs. See URI Design and
1413 | Ownership [RFC7320] for more on this principle.
1414 |
1415 | When implementing ALPS-compliant servers, implementors are free to
1416 | use any URL design they wish. All that is required is that
1417 | implementors use the same ALPS profile descriptor 'id' and 'name'
1418 | properties in the representations. When implementing ALPS-compliant
1419 | client applications, the URLs will be supplied at runtime by the
1420 | server represetentations. Client apps only need to recognize the
1421 | descriptor 'id' and 'name' values from the referenced ALPS profile
1422 | document.
1423 |
1424 | A.2. Why is there no workflow component in the ALPS specification?
1425 |
1426 | ALPS is not designed to describe workflows or execution paths for a
1427 | service. Instead, ALPS is designed to describe a shared set of data
1428 | and actions elements that server MAY implement in order to create a
1429 | service. Each action descriptor (where the descriptor's type
1430 | property is set to 'safe', 'unsafe', or 'idemponent') SHOULD describe
1431 | a state transition that a ALPS-compliant client application can
1432 | invoke when it is available. Servers are free to implement the
1433 | transitions they find useful and to arrange them in any order they
1434 | wish. ALPS-compliant client applications SHOULD be able to recognize
1435 | these descriptors when they appear and are free to act upon them
1436 | directly, render them for humans to invoke, or ignore/hide them
1437 | completely.
1438 |
1439 | A.3. Why is there no way to indicate ranges for semantic descriptors?
1440 |
1441 | For most all service implementations, there are cases where it would
1442 | be helpful to document a range of possible values for a semantic
1443 | element. For example, when implementing the descriptor {"id":"size",
1444 | ...}, one service might want to indicate the list of supported values
1445 | such as: 'small', 'meduim', 'large', etc. However, another service
1446 | might have a very different list of possible values such as
1447 | 'standard', 'oversized', 'undersized', etc. And there may be a
1448 | service that only supports a single value here and will always supply
1449 | it ('onesize').
1450 |
1451 | Since ALPS is meant to provide a single description that can be used
1452 | by multiple services, establishing ranges within the ALPS description
1453 |
1454 |
1455 |
1456 | Amundsen, et al. Expires September 1, 2015 [Page 26]
1457 |
1458 | Internet-Draft Application-Level Profile Semantics February 2015
1459 |
1460 |
1461 | is considered over-constraining service implementations. Services
1462 | are free to supply this information within representations at run
1463 | time. But including them in the global ALPS profile is discouraged.
1464 |
1465 | Authors' Addresses
1466 |
1467 | Mike Amundsen
1468 | CA Technologies, Inc.
1469 |
1470 | EMail: mca@amundsen.com
1471 | URI: http://amundsen.com
1472 |
1473 |
1474 | Leonard Richardson
1475 |
1476 | EMail: leonardr@segfault.org
1477 | URI: http://crummy.com
1478 |
1479 |
1480 | Mark W. Foster
1481 | Apiary
1482 |
1483 | EMail: mwf@fosrias.com
1484 |
1485 |
1486 |
1487 |
1488 |
1489 |
1490 |
1491 |
1492 |
1493 |
1494 |
1495 |
1496 |
1497 |
1498 |
1499 |
1500 |
1501 |
1502 |
1503 |
1504 |
1505 |
1506 |
1507 |
1508 |
1509 |
1510 |
1511 |
1512 | Amundsen, et al. Expires September 1, 2015 [Page 27]
1513 |
--------------------------------------------------------------------------------
/draft-03/draft-03.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Network Working Group M. Amundsen
6 | Internet-Draft
7 | Intended status: Informational L. Richardson
8 | Expires: February 25, 2021
9 | M. Foster
10 | August 24, 2020
11 |
12 |
13 | Application-Level Profile Semantics (ALPS)
14 | draft-amundsen-richardson-foster-alps-03
15 |
16 | Abstract
17 |
18 | This document describes ALPS, a data format for defining simple
19 | descriptions of application-level semantics, similar in complexity to
20 | HTML microformats. An ALPS document can be used as a profile to
21 | explain the application semantics of a document with an application-
22 | agnostic media type (such as HTML, HAL, Collection+JSON, Siren,
23 | etc.). This increases the reusability of profile documents across
24 | media types.
25 |
26 | Editorial Note (To be removed by RFC Editor)
27 |
28 | Distribution of this document is unlimited. Comments should be sent
29 | to the IETF Media-Types mailing list (see
30 | ).
31 |
32 | Status of This Memo
33 |
34 | This Internet-Draft is submitted in full conformance with the
35 | provisions of BCP 78 and BCP 79.
36 |
37 | Internet-Drafts are working documents of the Internet Engineering
38 | Task Force (IETF). Note that other groups may also distribute
39 | working documents as Internet-Drafts. The list of current Internet-
40 | Drafts is at https://datatracker.ietf.org/drafts/current/.
41 |
42 | Internet-Drafts are draft documents valid for a maximum of six months
43 | and may be updated, replaced, or obsoleted by other documents at any
44 | time. It is inappropriate to use Internet-Drafts as reference
45 | material or to cite them other than as "work in progress."
46 |
47 | This Internet-Draft will expire on February 25, 2021.
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | Amundsen, et al. Expires February 25, 2021 [Page 1]
57 |
58 | Internet-Draft Application-Level Profile Semantics August 2020
59 |
60 |
61 | Copyright Notice
62 |
63 | Copyright (c) 2020 IETF Trust and the persons identified as the
64 | document authors. All rights reserved.
65 |
66 | This document is subject to BCP 78 and the IETF Trust's Legal
67 | Provisions Relating to IETF Documents
68 | (https://trustee.ietf.org/license-info) in effect on the date of
69 | publication of this document. Please review these documents
70 | carefully, as they describe your rights and restrictions with respect
71 | to this document. Code Components extracted from this document must
72 | include Simplified BSD License text as described in Section 4.e of
73 | the Trust Legal Provisions and are provided without warranty as
74 | described in the Simplified BSD License.
75 |
76 | Table of Contents
77 |
78 | 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
79 | 1.1. Notational Conventions . . . . . . . . . . . . . . . . . 3
80 | 1.2. Motivation . . . . . . . . . . . . . . . . . . . . . . . 4
81 | 1.2.1. Describing Domain-Specific Semantics . . . . . . . . 4
82 | 1.2.2. ALPS-based Server Implementations . . . . . . . . . . 4
83 | 1.2.3. ALPS-based Client Implementations . . . . . . . . . . 4
84 | 1.3. A Simple ALPS Example . . . . . . . . . . . . . . . . . . 5
85 | 1.4. Identifying an ALPS Document . . . . . . . . . . . . . . 9
86 | 2. ALPS Documents . . . . . . . . . . . . . . . . . . . . . . . 10
87 | 2.1. Compliance . . . . . . . . . . . . . . . . . . . . . . . 10
88 | 2.2. ALPS Document Properties . . . . . . . . . . . . . . . . 10
89 | 2.2.1. 'alps' . . . . . . . . . . . . . . . . . . . . . . . 10
90 | 2.2.2. 'doc' . . . . . . . . . . . . . . . . . . . . . . . . 10
91 | 2.2.3. 'descriptor' . . . . . . . . . . . . . . . . . . . . 11
92 | 2.2.4. 'ext' . . . . . . . . . . . . . . . . . . . . . . . . 13
93 | 2.2.5. 'format' . . . . . . . . . . . . . . . . . . . . . . 13
94 | 2.2.6. 'href' . . . . . . . . . . . . . . . . . . . . . . . 14
95 | 2.2.7. 'id' . . . . . . . . . . . . . . . . . . . . . . . . 14
96 | 2.2.8. 'link' . . . . . . . . . . . . . . . . . . . . . . . 16
97 | 2.2.9. 'name' . . . . . . . . . . . . . . . . . . . . . . . 16
98 | 2.2.10. 'rel' . . . . . . . . . . . . . . . . . . . . . . . . 17
99 | 2.2.11. 'rt' . . . . . . . . . . . . . . . . . . . . . . . . 17
100 | 2.2.12. 'type' . . . . . . . . . . . . . . . . . . . . . . . 17
101 | 2.2.13. 'value' . . . . . . . . . . . . . . . . . . . . . . . 18
102 | 2.2.14. 'version' . . . . . . . . . . . . . . . . . . . . . . 18
103 | 2.3. ALPS Representations . . . . . . . . . . . . . . . . . . 18
104 | 2.3.1. Sample HTML . . . . . . . . . . . . . . . . . . . . . 18
105 | 2.3.2. XML Representation Example . . . . . . . . . . . . . 19
106 | 2.3.3. JSON Representation Example . . . . . . . . . . . . . 20
107 | 3. Applying ALPS documents to Existing Media Types . . . . . . . 22
108 | 3.1. Linking to ALPS Documents . . . . . . . . . . . . . . . . 23
109 |
110 |
111 |
112 | Amundsen, et al. Expires February 25, 2021 [Page 2]
113 |
114 | Internet-Draft Application-Level Profile Semantics August 2020
115 |
116 |
117 | 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 23
118 | 4.1. application/alps+xml . . . . . . . . . . . . . . . . . . 23
119 | 4.2. application/alps+json . . . . . . . . . . . . . . . . . . 25
120 | 5. Internationalization Considerations . . . . . . . . . . . . . 26
121 | 6. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 26
122 | 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 26
123 | 7.1. Normative References . . . . . . . . . . . . . . . . . . 26
124 | 7.2. Informative References . . . . . . . . . . . . . . . . . 27
125 | Appendix A. Frequently Asked Questions . . . . . . . . . . . . . 28
126 | A.1. Why are there no URLs in ALPS? . . . . . . . . . . . . . 28
127 | A.2. Why is there no workflow component in the ALPS
128 | specification? . . . . . . . . . . . . . . . . . . . . . 28
129 | A.3. Why is there no way to indicate ranges for semantic
130 | descriptors? . . . . . . . . . . . . . . . . . . . . . . 28
131 | Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 29
132 |
133 | 1. Introduction
134 |
135 | This document describes ALPS, a media type for defining simple
136 | descriptions of application-level semantics, similar in complexity to
137 | HTML microformats. These descriptions contain both human-readable
138 | and machine-readable explanations of the semantics. An ALPS document
139 | can be used as a profile to explain the application semantics of a
140 | document with an application-agnostic media type (such as HTML, HAL,
141 | Collection+JSON, Siren. etc.).
142 |
143 | This document identifies a registry for ALPS documents, (The ALPS
144 | Profile Registry or APR). The details of this registry, its goals,
145 | and operations are covered in a separate document (TBD).
146 |
147 | This document also identifies a process for authoring, publishing,
148 | and sharing normative human-readable instructions on applying an ALPS
149 | document as a profile to responses of a given media type. For
150 | example, a document that describes how to apply the semantics of an
151 | ALPS profile to an HTML document.
152 |
153 | This document registers two media-type identifiers with the IANA:
154 | 'application/alps+xml' ('ALPS+XML') and 'application/alps+json'
155 | ('ALPS+JSON').
156 |
157 | 1.1. Notational Conventions
158 |
159 | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
160 | "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
161 | document are to be interpreted as described in[RFC2119].
162 |
163 |
164 |
165 |
166 |
167 |
168 | Amundsen, et al. Expires February 25, 2021 [Page 3]
169 |
170 | Internet-Draft Application-Level Profile Semantics August 2020
171 |
172 |
173 | 1.2. Motivation
174 |
175 | When implementing a hypermedia client/server application using a
176 | general media type (HTML, Atom, Collection+JSON, etc.), client and
177 | server instances need to share an understanding of domain-specific
178 | information such as data element names, link relation values, and
179 | state transfer parameters. This information is directly related to
180 | the application being implemented (e.g. accounting, contact
181 | management, etc.) rather than the media type used in the
182 | representations.
183 |
184 | 1.2.1. Describing Domain-Specific Semantics
185 |
186 | Instead of creating and registering an entirely new media type (i.e.
187 | 'application/accounting'), representation authors can create an ALPS
188 | document that describes a 'profile' of the target domain; one that
189 | explains the vital domain-specific semantic descriptors and state
190 | transitions. This profile can then be consistently applied to a wide
191 | range of media types by server implementors and successfully consumed
192 | by client applications. The focus on defining application-level
193 | semantics, independent of transfer protocol or media type, makes it
194 | possible to serve application-specific representations using an
195 | application-agnostic media type.
196 |
197 | 1.2.2. ALPS-based Server Implementations
198 |
199 | Server implementors can use ALPS documents as a basis for building
200 | domain-specific solutions without having to create their own custom
201 | media type or re-invent the vocabulary and transition set for a
202 | common domain (e.g. accounting, microblogging, etc.). Using a
203 | preexisting ALPS profile as a guide, servers can map internal data to
204 | commonly-understood semantic descriptors and state transitions,
205 | increasing the likelihood that existing client applications (those
206 | who share the same understanding of the ALPS document) will be able
207 | to successfully interact with that server.
208 |
209 | 1.2.3. ALPS-based Client Implementations
210 |
211 | Armed with a document's ALPS profile, client applications can
212 | associate the ALPS descriptor 'id' and/or 'name' attribute values
213 | with the appropriate elements within the document. Client
214 | applications can 'code for the profile' and better adjust to detailed
215 | changes to the response layout, or even the wholesale replacement of
216 | one media type with another.
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 | Amundsen, et al. Expires February 25, 2021 [Page 4]
225 |
226 | Internet-Draft Application-Level Profile Semantics August 2020
227 |
228 |
229 | 1.3. A Simple ALPS Example
230 |
231 | Below is an ALPS document that describes elements of a simple
232 | request/response interaction in a contact management application.
233 | The profile defines a semantic descriptor called 'contact', and three
234 | subordinate descriptors ('fullName', 'email', and 'phone').
235 |
236 | The ALPS document also defines a single, safe state transition, to be
237 | represented by a hypermedia control (e.g. HTML.GET form) with the
238 | 'id' value of 'collection.' This hypermedia control has one input
239 | value ('nameSearch'). When executed, the response will contain one
240 | or more 'contact' type items.
241 |
242 |
243 | A contact list.
244 |
245 |
246 |
247 |
248 |
249 | A simple link/form for getting a list of contacts.
250 |
251 |
252 | Input for a search form.
253 |
254 |
255 |
256 |
257 |
258 |
259 | A link to an individual contact.
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 | ALPS Contact Profile document
268 |
269 | Implementing the ALPS profile above requires implementing the
270 | descriptors defined by the ALPS document. In this case, there are
271 | two 'top level' descriptors: the safe state transition ('collection')
272 | and the semantic descriptor 'contact'. Below is a single HTML
273 | document that shows both these elements in a representation.
274 |
275 |
276 |
277 |
278 |
279 |
280 | Amundsen, et al. Expires February 25, 2021 [Page 5]
281 |
282 | Internet-Draft Application-Level Profile Semantics August 2020
283 |
284 |
285 |
287 |
289 |
291 |
292 |
293 |
300 |
301 |
332 |
333 |
334 |
335 |
336 | Amundsen, et al. Expires February 25, 2021 [Page 6]
337 |
338 | Internet-Draft Application-Level Profile Semantics August 2020
339 |
340 |
341 |
342 |
343 | HTML ALPS Contact Representation
344 |
345 | HTML representations implement most ALPS elements using HTML's
346 | 'class' attribute. The 'collection' ID has become the CSS class of
347 | an HTML form's submit button. The 'contact' ID has become the CSS
348 | class of the TR elements in an HTML table. The subordinate
349 | descriptors 'fullname','email', and 'phone' are rendered as the TD
350 | elements of each TR.
351 |
352 | This HAL document uses the same profile to express the same
353 | application-level semantics as the HTML document.
354 |
355 |
356 |
358 |
360 |
363 |
364 |
366 | Ann Arbuckle
367 | aa@example.org
368 | 123.456.7890
369 |
370 |
371 |
373 | Zelda Zackney
374 | zz@example.org
375 | 987.664.3210
376 |
377 |
378 |
379 | HAL XML Contacts Representation
380 |
381 | In a HAL representation, all state transitions ('collection' and
382 | 'item', in this case) are represented as link relations. All data
383 | descriptors ('fullName', 'email', and 'phone') are represented as XML
384 | tags named after the descriptors.
385 |
386 | This Collection+JSON document uses the ALPS profile to express the
387 | same application-level semantics as the HTML and HAL documents.
388 |
389 |
390 |
391 |
392 | Amundsen, et al. Expires February 25, 2021 [Page 7]
393 |
394 | Internet-Draft Application-Level Profile Semantics August 2020
395 |
396 |
397 | {
398 | "collection" : {
399 | "version" : "1.0",
400 | "href" : "http://example.org/contacts/",
401 |
402 | "links" : [
403 | {
404 | "rel" : "profile",
405 | "href" : "http://alps.io/profiles/contacts"
406 | },
407 | {
408 | "rel" : "help",
409 | "href" : "http://example.org/help/contacts.html"
410 | },
411 | {
412 | "rel" : "type",
413 | "href" : "http://alps.io/profiles/contacts#contact"
414 | }
415 | ],
416 |
417 | "queries" : [
418 | {
419 | "rel" : "collection",
420 | "rt" : "contact",
421 | "href" : "http://example.org/contacts/",
422 | "data" : [
423 | {
424 | "name" : "nameSearch",
425 | "value" : "",
426 | "prompt" : "Search Name"
427 | }
428 | ]
429 | }
430 | ],
431 |
432 | "items" : [
433 | {
434 | "href" : "http://example.org/contacts/1",
435 | "rel" : "item",
436 | "rt" : "contact",
437 | "data" : [
438 | {"name" : "fullName", "value" : "Ann Arbuckle"},
439 | {"name" : "email", "value" : "aa@example.org"},
440 | {"name" : "phone", "value" : "123.456.7890"}
441 | ],
442 | "links" : [
443 | {
444 | "rel" : "type",
445 |
446 |
447 |
448 | Amundsen, et al. Expires February 25, 2021 [Page 8]
449 |
450 | Internet-Draft Application-Level Profile Semantics August 2020
451 |
452 |
453 | "href" : "http://alps.io/profiles/contacts#contact"
454 | }
455 | ]
456 | },
457 | {
458 | "href" : "http://example.org/contacts/100",
459 | "rel" : "item",
460 | "rt" : "contact",
461 | "data" : [
462 | {
463 | "name" : "fullName",
464 | "value" : "Zelda Zackney"
465 | },
466 | {
467 | "name" : "email",
468 | "value" : "zz@example.org"
469 | },
470 | {
471 | "name" : "phone",
472 | "value" : "987.654.3210"
473 | }
474 | ],
475 | "links" : [
476 | {
477 | "rel" : "type",
478 | "href" : "http://alps.io/profiles/contacts#contact"
479 | }
480 | ]
481 | }
482 | ]
483 | }
484 | }
485 |
486 |
487 | Collection+JSON Contacts Representation
488 |
489 | The descriptor 'collection' has become the link relation associated
490 | with a Collection+JSON query. The descriptors 'fullName', 'email',
491 | and 'phone' have become the names of key-value pairs in the items in
492 | a Collection+JSON collection.
493 |
494 | 1.4. Identifying an ALPS Document
495 |
496 | An ALPS vocabulary is identified by a unique URL. This URL SHOULD be
497 | dereferencable. All ALPS URLs MUST be unique and all ALPS documents
498 | intended for public consumption SHOULD be registered in an ALPS
499 | Registry [TK: add text on where/how to find registries -mamund].
500 |
501 |
502 |
503 |
504 | Amundsen, et al. Expires February 25, 2021 [Page 9]
505 |
506 | Internet-Draft Application-Level Profile Semantics August 2020
507 |
508 |
509 | In order to reduce load on servers responding to ALPS document
510 | requests, it is RECOMMENDED that servers use cache control directives
511 | that instruct client apps to locally cache the results. Clients
512 | making these ALPS document requests SHOULD honor the server's caching
513 | directives.
514 |
515 | 2. ALPS Documents
516 |
517 | An ALPS document contains a machine-readable collection of
518 | identifying strings and their human-readable explanations. An ALPS
519 | document can be represented in either XML or JSON format. This
520 | section identifies the general elements and properties of an ALPS
521 | document, their meaning, and their use, independent of how the
522 | document is represented. Section 2.3 provides specific details on
523 | constructing a valid ALPS document in XML and in JSON format.
524 |
525 | 2.1. Compliance
526 |
527 | An implementation is not compliant if it fails to satisfy one or more
528 | of the MUST or REQUIRED level requirements. An implementation that
529 | satisfies all the MUST or REQUIRED level and all the SHOULD level
530 | requirements is said to be 'unconditionally compliant'; one that
531 | satisfies all the MUST level requirements but not all the SHOULD
532 | level requirements is said to be 'conditionally compliant.'
533 |
534 | 2.2. ALPS Document Properties
535 |
536 | The ALPS media type defines a small set of properties. These
537 | properties appear in both the XML and JSON formats. Below is a list
538 | of the properties that can appear in an ALPS document.
539 |
540 | 2.2.1. 'alps'
541 |
542 | Indicates the root of the ALPS document. This property is REQUIRED,
543 | and it SHOULD have one or more 'descriptor' child properties.
544 |
545 | Examples:
546 |
547 | XML: ...
548 |
549 | JSON: { "alps" : ... }
550 |
551 | 2.2.2. 'doc'
552 |
553 | A text field that contains free-form, usually human-readable, text.
554 | The 'doc' element MAY have two properties: 'href' and 'format'. If
555 | the 'href' property appears it SHOULD contain a dereferencable URL
556 | that points to human-readable text. If the 'format' property appears
557 |
558 |
559 |
560 | Amundsen, et al. Expires February 25, 2021 [Page 10]
561 |
562 | Internet-Draft Application-Level Profile Semantics August 2020
563 |
564 |
565 | it SHOULD contain one of the following values: 'text', 'html',
566 | 'asciidoc', or 'markdown'. Any program processing 'doc' elements
567 | SHOULD honor the 'format' directive and parse/render the content
568 | appropriately. If the value in the 'format' property is not
569 | recognized and/or supported, the processing program MUST treat the
570 | content as plain text. If no 'format' property is present, the
571 | content SHOULD be treated as plain text.
572 |
573 | XML:
Date of Birth
...
574 |
575 | JSON: { "doc" : { "format" : "text" : "value" : "Date of Birth ..."
576 | } }
577 |
578 | A 'doc' element SHOULD appear as a child of 'descriptor'. When
579 | present, it describes the meaning and use of the related
580 | 'descriptor'.
581 |
582 | XML: ...
583 |
584 | JSON: { "descriptor" : { { "doc" : { "value" : "..." } ... } }
585 |
586 | The 'doc' element MAY appear as a child of 'alps'. When present, it
587 | describes the purpose of the ALPS document as a whole.
588 |
589 | XML: ... ...
590 |
591 | JSON: { "alps : { "doc" : { "value" : "..." }, ... } }
592 |
593 | 2.2.3. 'descriptor'
594 |
595 | A 'descriptor' element defines the semantics of specific data
596 | elements or state transitions that MAY exist in an associated
597 | representation.
598 |
599 | One or more 'descriptor' elements SHOULD appear as children of
600 | 'alps'. It may also appear as a child of itself; that is, the
601 | 'descriptor' property may be nested.
602 |
603 | The 'descriptor' property SHOULD have either an 'id' or 'href'
604 | attribute. It MAY have both. Additionally, the 'descriptor' MAY
605 | have any of the following attributes:
606 |
607 | 1. 'doc'
608 |
609 | 2. 'ext'
610 |
611 | 3. 'name'
612 |
613 |
614 |
615 |
616 | Amundsen, et al. Expires February 25, 2021 [Page 11]
617 |
618 | Internet-Draft Application-Level Profile Semantics August 2020
619 |
620 |
621 | 4. 'type'
622 |
623 | If present, the 'href' property MUST be a dereferenceable URL, that
624 | points to another 'descriptor' either within the current ALPS
625 | document or in another ALPS document.
626 |
627 | If 'descriptor' has an 'href' attribute, then 'descriptor' is
628 | inheriting all the attributes and sub-properties of the descriptor
629 | pointed to by 'href'. When 'descriptor' has a property defined
630 | locally, that property value takes precedence over any inherited
631 | property value. Since there is no limit to the nesting of elements
632 | -- even ones linked remotely -- it is important to process 'all
633 | descriptor' chains starting from the bottom to make sure you have
634 | collected all the available properties and have established the
635 | correct value for each of them.
636 |
637 | If 'descriptor' is declared at the top level of an ALPS document,
638 | then a client SHOULD assume that 'descriptor' can appear anywhere in
639 | a runtime message.
640 |
641 | If 'descriptor' is nested, i.e. declared as a child of another
642 | descriptor, then:
643 |
644 | 1. A client SHOULD assume them to appear in any sibling 'descriptor'
645 | element and recursively in their child descriptors.
646 |
647 | 2. A client SHOULD NOT assume that it can appear anywhere outside of
648 | parent descriptor, unless it was explicitly referenced by another
649 | descriptor in 'href' attribute. In that case the same rules are
650 | applied to 'descriptor' containing 'href' attribute.
651 |
652 | 2.2.3.1. 'Descriptors and Link Relation Types'
653 |
654 | When a representation is generated that includes state transitions,
655 | valid values for link relation types are:
656 |
657 | 1. A registered IANA link relation type (e.g. rel="edit", a short
658 | string).
659 |
660 | 2. An extension link relation type as defined by [RFC5988] whose
661 | value is the fully-qualified URI of an associated document
662 | describing the relation type. This includes URI fragment
663 | identifiers of ALPS descriptors (e.g.
664 | rel="http://alps.io/profiles/item#purchased-by", a URI) per the
665 | conventions of Section 2.2.7.2.
666 |
667 | 3. The 'id' property of a state transition descriptor of an
668 | associated ALPS document (e.g. rel="purchased-by", a short
669 |
670 |
671 |
672 | Amundsen, et al. Expires February 25, 2021 [Page 12]
673 |
674 | Internet-Draft Application-Level Profile Semantics August 2020
675 |
676 |
677 | string) per the conventions of section Section 2.2.7.1 and
678 | Section 2.2.7.3 if the representation includes an ALPS profile.
679 |
680 | 2.2.4. 'ext'
681 |
682 | The 'ext' element can be used to extend the ALPS document with
683 | author-specific information. It provides a way to customize ALPS
684 | documents with additional properties not covered in this
685 | specification. This is an OPTIONAL element.
686 |
687 | The 'ext' element has the following properties.
688 |
689 | 1. 'id'
690 |
691 | 2. 'href'
692 |
693 | 3. 'value'
694 |
695 | The 'id' property is REQUIRED. The 'href' is RECOMMENDED and it
696 | SHOULD point to documentation that explains the use and meaning of
697 | this 'ext' element. The 'value' property is OPTIONAL. The content
698 | is undetermined; its meaning and use SHOULD be explained by the
699 | document found by de-referencing the 'href' property.
700 |
701 | Examples:
702 |
703 | XML:
705 |
706 | JSON: { "ext" : { "id" : "directions", "href" : "http://alps.io/ext/
707 | directions", value="north south east west" } }
708 |
709 | The 'ext' element MAY appear as a child of the following elements:
710 |
711 | 1. 'alps'
712 |
713 | 2. 'descriptor'
714 |
715 | Since the 'ext' element has no specific meaning within this
716 | specification, it MUST be ignored by any application that does not
717 | understand its meaning.
718 |
719 | 2.2.5. 'format'
720 |
721 | Indicates how the text content should be parsed and/or rendered.
722 | This specification identifies a range of possible values for
723 | 'format':
724 |
725 |
726 |
727 |
728 | Amundsen, et al. Expires February 25, 2021 [Page 13]
729 |
730 | Internet-Draft Application-Level Profile Semantics August 2020
731 |
732 |
733 | o 'text', for plain text, MUST be supported.
734 |
735 | o 'html', for HTML, SHOULD be supported.
736 |
737 | o 'asciidoc', for AsciiDoc, MAY be supported.
738 |
739 | o 'markdown', per The text/markdown Media Type
740 | [I-D.ietf-appsawg-text-markdown], MAY be supported.
741 |
742 | Any other values for this attribute are undefined and SHOULD be
743 | treated as plain text. If the program does not recognize the value
744 | of the 'format' property and/or the 'format' property is missing, the
745 | content SHOULD be treated as plain text.
746 |
747 | This property MAY appear as an attribute of the 'doc' element.
748 |
749 | 2.2.6. 'href'
750 |
751 | Contains a resolvable URL.
752 |
753 | When it appears as an attribute of a 'descriptor', 'href' points to
754 | another 'descriptor' either within the existing ALPS document as a
755 | fragment or in another ALPS document as an absolute URL. The URL
756 | MUST contain a fragment per Section 2.2.7.2 referencing the related
757 | 'descriptor'.
758 |
759 | When it appears as an attribute of 'ext', 'href' points to an
760 | external document which provides the definition of the extension.
761 |
762 | When it appears as an attribute of 'link', 'href' points to an
763 | external document whose relationship to the current document or
764 | 'descriptor' is described by the associated 'rel' property.
765 |
766 | When it appears as an attribute of 'doc', 'href' points to a document
767 | that contains human-readable text that describes the associated
768 | 'descriptor' or ALPS document.
769 |
770 | 2.2.7. 'id'
771 |
772 | A document-wide unique identifier for the related element. This
773 | SHOULD appear as an attribute of a 'descriptor'. It SHOULD be an
774 | opaque string that does not contain any URL unsafe characters per
775 | [RFC1738].
776 |
777 | The value of this attribute MAY be used as an identifier in the
778 | related runtime hypermedia representation. In the example below the
779 | ALPS descriptor with an 'id' of 'q' is used to identify an HTML input
780 | element:
781 |
782 |
783 |
784 | Amundsen, et al. Expires February 25, 2021 [Page 14]
785 |
786 | Internet-Draft Application-Level Profile Semantics August 2020
787 |
788 |
789 | 'id' in ALPS...
790 |
791 | ...becomes the 'class' in HTML
793 |
794 | It should be noted that the exact mapping from ALPS elements (e.g.
795 | 'id') to elements within a particular media type (HTML,
796 | Collection+JSON, etc.) is covered in separate documents (to be
797 | specified).
798 |
799 | 2.2.7.1. ALPS 'id' and 'name' Properties
800 |
801 | In some cases, media types support non-unique identifiers (e.g.
802 | HTML's 'name' property) or will allow the same identifier value for
803 | multiple elements in the same representation (e.g. and and ). In those cases, translating that
806 | representation into ALPS documents could result in multiple 'id'
807 | properties with the same value.
808 |
809 | To avoid this, ALPS document designers can add the 'name' property to
810 | a 'descriptor' to hold the common value ('search') while still using
811 | the 'id' property to hold a document-wide unique value. For example:
812 |
813 |
814 |
815 |
819 |
820 |
821 | HTML Representation of a Search Transition
822 |
823 |
824 |
825 |
826 |
827 |
828 |
829 |
830 | ALPS Description of the same Search Transition
831 |
832 | 2.2.7.2. Fragment Identifiers and 'id'
833 |
834 | When applied to an ALPS document, a URI fragment identifier points to
835 | the 'descriptor' whose 'id' is the value of the fragment. For
836 | example, the fragment identifier 'customer' in the URI
837 |
838 |
839 |
840 | Amundsen, et al. Expires February 25, 2021 [Page 15]
841 |
842 | Internet-Draft Application-Level Profile Semantics August 2020
843 |
844 |
845 | http://example.com/my-alps-document#customer refers to an ALPS
846 | 'descriptor' with 'id' set to 'customer'. If the 'id' contains URL
847 | unsafe characters per [RFC1738], the fragment referencing the 'id'
848 | MUST be URL escaped.
849 |
850 | A relative URL with a fragment identifier within an ALPS document
851 | (e.g. href="#customer") refers to a local 'descriptor' within the
852 | document containing the reference.
853 |
854 | The complete URI to an ALPS 'descriptor' (including the fragment)
855 | forms an 'abstract semantic type' identifier. This is a resolvable
856 | URI (URL) that can be used to indicate the type of a resource; for
857 | instance, it can be used as the value of the IANA-registered relation
858 | type 'type'.
859 |
860 | 2.2.7.3. Link Relation Values and 'id' or 'name'
861 |
862 | Since a state transition 'descriptor' may define a relation type
863 | value, it is important to avoid creating conflicts with existing
864 | IANA-registered values. If the resulting link relation type is the
865 | same as a registered relation type, the descriptor MUST not change
866 | the meaning of the IANA relation type.
867 |
868 | Further, since the 'id' of a 'descriptor' may define a link relation
869 | value per Section 2.2.3.1, if a conflict exists in defining such a
870 | descriptor's document-wide unique 'id' with another 'descriptor', the
871 | conflicting 'descriptor' MUST define a unique 'id' and MAY specify a
872 | 'name' property to resolve the conflict.
873 |
874 | If it is unclear whether a registered link relation type in a
875 | representation document refers to a relation registered with IANA or
876 | a relation registered in an ALPS profile, the semantics of that link
877 | are undefined.
878 |
879 | 2.2.8. 'link'
880 |
881 | An element that identifies a link between the current ALPS element
882 | and some other (possibly external) resource. MAY be a child element
883 | of the 'alps' and the 'descriptor' elements.
884 |
885 | The 'link' element MUST define the two attributes 'href' and 'rel'.
886 |
887 | 2.2.9. 'name'
888 |
889 | Indicates the name of the 'descriptor' as found in generic
890 | representations. It MAY appear as a property of 'descriptor'.
891 |
892 |
893 |
894 |
895 |
896 | Amundsen, et al. Expires February 25, 2021 [Page 16]
897 |
898 | Internet-Draft Application-Level Profile Semantics August 2020
899 |
900 |
901 | This is used when the name of the 'descriptor' is used as an 'id'
902 | value elsewhere in the ALPS document. For instance, if a single ALPS
903 | document defines a semantic descriptor (data element) called
904 | 'customer' and a safe descriptor (transition element) also called
905 | 'customer', they cannot both have 'id="customer"' in the ALPS
906 | document. One of them needs to have some other 'id', and to set
907 | 'name="customer"'.
908 |
909 | The use of the 'name' property usually indicates an ambiguity in the
910 | application semantics. Thus, it SHOULD only be used when creating an
911 | ALPS profile that describes an existing design.
912 |
913 | 2.2.10. 'rel'
914 |
915 | Contains a [RFC5988] approved value: either an extension relation
916 | type (a URI) or a registered relation type (a short string).
917 |
918 | Appears as a property of'link'.
919 |
920 | 2.2.11. 'rt'
921 |
922 | Indicates the kind of resource that will be returned when executing
923 | the specified network request. The 'rt' attribute SHOULD appear only
924 | on a 'descriptor' with a 'type' value of 'safe', 'unsafe', or
925 | 'idempotent.'
926 |
927 | The 'rt' attribute is OPTIONAL and, when it appears, it MUST point to
928 | the 'id' of an existing 'descriptor' using one of two methods:
929 |
930 | 1. A fragment identifier (e.g. rt="#friend") which points to the
931 | 'id' of an existing 'descriptor' in the current ALPS document.
932 |
933 | 2. A resolvable URL with a fragment identifier (e.g.
934 | rt="http://example.org/profiles/people#friend") which points to
935 | the 'id' of an existing 'descriptor' in any valid ALPS document.
936 |
937 | 2.2.12. 'type'
938 |
939 | Indicates the type of hypermedia control to which the element is
940 | applied within the resulting representation. This SHOULD appear for
941 | each 'descriptor' element. The four valid values are:
942 |
943 | 'semantic' A state element (e.g. HTML.SPAN, HTML.INPUT, etc.).
944 |
945 | 'safe' A hypermedia control that triggers a safe, idempotent state
946 | transition (e.g. HTTP.GET or HTTP.HEAD).
947 |
948 |
949 |
950 |
951 |
952 | Amundsen, et al. Expires February 25, 2021 [Page 17]
953 |
954 | Internet-Draft Application-Level Profile Semantics August 2020
955 |
956 |
957 | 'idempotent' A hypermedia control that triggers an unsafe,
958 | idempotent state transition (e.g. HTTP.PUT or HTTP.DELETE).
959 |
960 | 'unsafe' A hypermedia control that triggers an unsafe, non-
961 | idempotent state transition (e.g. HTTP.POST).
962 |
963 | If no 'type' attribute is associated with the element, then
964 | 'type="semantic"' is implied.
965 |
966 | 2.2.13. 'value'
967 |
968 | Contains a string value. It MAY appear as an attribute of the 'doc'
969 | and the 'ext' elements.
970 |
971 | 2.2.14. 'version'
972 |
973 | Indicates the version of the ALPS specification used in the document.
974 | This SHOULD appear as a property of the 'alps' element. Currently
975 | the only valid value is '1.0'. If no value appears, then
976 | 'version="1.0"' is implied.
977 |
978 | 2.3. ALPS Representations
979 |
980 | An ALPS document may be represented in either XML or JSON format.
981 | This section contains notes on how the ALPS elements and attributes
982 | appear in each format, along with examples to guide ALPS document
983 | authors.
984 |
985 | 2.3.1. Sample HTML
986 |
987 | Below is a simple HTML document that contains a handful of semantic
988 | descriptors and transition instructions. This document was generated
989 | from the XML and JSON ALPS documents that follow. Use this HTML
990 | document as a guide when evaluating the XML and JSON examples.
991 |
992 |
993 |
994 |
995 |
996 |
997 |
998 |
999 |
1000 |
1001 |
1002 |
1003 |
1004 |
1005 |
1006 |
1007 |
1008 | Amundsen, et al. Expires February 25, 2021 [Page 18]
1009 |
1010 | Internet-Draft Application-Level Profile Semantics August 2020
1011 |
1012 |
1013 |
1014 |
1015 |
1016 |
1017 |
1018 |
1019 |
1027 |
1028 |
1029 |
1030 | HTML Sample
1031 |
1032 | 2.3.2. XML Representation Example
1033 |
1034 | In the XML version of an ALPS document, the following ALPS properties
1035 | always appear as XML elements: 'alps', 'doc', 'descriptor', and
1036 | 'ext'. All other ALPS properties appear as XML attributes.
1037 |
1038 | 2.3.2.1. Complete XML Representation
1039 |
1040 | Below is an example of an application/alps+xml representation.
1041 |
1042 |
1043 |
1044 |
1045 |
1046 |
1047 |
1048 |
1049 |
1050 |
1051 |
1052 |
1053 |
1054 |
1055 |
1056 |
1057 |
1058 |
1059 |
1060 |
1061 |
1062 |
1063 |
1064 | Amundsen, et al. Expires February 25, 2021 [Page 19]
1065 |
1066 | Internet-Draft Application-Level Profile Semantics August 2020
1067 |
1068 |
1069 |
1070 |
1071 |
1072 |
1073 |
1074 | A search form with two inputs.
1075 |
1076 |
1077 | input for search
1078 |
1079 |
1080 |
1081 |
1082 | results format
1083 |
1086 |
1087 |
1088 |
1089 | Complete XML Representation
1090 |
1091 | 2.3.3. JSON Representation Example
1092 |
1093 | When representing ALPS documents in JSON format, the 'descriptor' and
1094 | 'ext' properties are always expressed as arrays of anonymous objects
1095 | - even when there is only one member in the array.
1096 |
1097 | For example:
1098 |
1099 | "descriptor" : [
1100 | {
1101 | "id" : "value",
1102 | "name" : "search",
1103 | "type" : "semantic",
1104 | "doc" : { "value" : "input for search" }
1105 | },
1106 | { "href" : "#resultType" }
1107 | ]
1108 |
1109 | Arrays in ALPS+JSON
1110 |
1111 | The 'doc' property is always expressed as a named object.
1112 |
1113 |
1114 |
1115 |
1116 |
1117 |
1118 |
1119 |
1120 | Amundsen, et al. Expires February 25, 2021 [Page 20]
1121 |
1122 | Internet-Draft Application-Level Profile Semantics August 2020
1123 |
1124 |
1125 | For example:
1126 |
1127 | {
1128 | "doc" : {
1129 | "format" : "text",
1130 | "value" : "Rules are important"
1131 | }
1132 | }
1133 |
1134 | Descriptions in ALPS+JSON
1135 |
1136 | 2.3.3.1. Complete JSON Representation
1137 |
1138 | Below is a example of the application/alps+json representation of an
1139 | ALPS document.
1140 |
1141 |
1142 |
1143 |
1144 |
1145 |
1146 |
1147 |
1148 |
1149 |
1150 |
1151 |
1152 |
1153 |
1154 |
1155 |
1156 |
1157 |
1158 |
1159 |
1160 |
1161 |
1162 |
1163 |
1164 |
1165 |
1166 |
1167 |
1168 |
1169 |
1170 |
1171 |
1172 |
1173 |
1174 |
1175 |
1176 | Amundsen, et al. Expires February 25, 2021 [Page 21]
1177 |
1178 | Internet-Draft Application-Level Profile Semantics August 2020
1179 |
1180 |
1181 | {
1182 | "alps" : {
1183 | "version" : "1.0",
1184 | "doc" : {
1185 | "href" : "http://example.org/samples/full/doc.html"
1186 | },
1187 | "descriptor" : [
1188 | {
1189 | "id" : "search",
1190 | "type" : "safe",
1191 | "doc" : { "value" :
1192 | "A search form with a two inputs"
1193 | },
1194 | "descriptor" : [
1195 | {
1196 | "id" : "value",
1197 | "name" : "search",
1198 | "type" : "semantic",
1199 | "doc" : { "value" : "input for search" }
1200 | },
1201 | { "href" : "#resultType" }
1202 | ]
1203 | },
1204 | {
1205 | "id" : "resultType",
1206 | "type" : "semantic",
1207 | "doc" : { "value" : "results format"},
1208 | "ext" : [
1209 | {
1210 | "href" : "http://alps.io/ext/range",
1211 | "value" : "summary,detail"
1212 | }
1213 | ]
1214 | }
1215 | ]
1216 | }
1217 | }
1218 |
1219 | Complete ALPS+JSON Representation
1220 |
1221 | 3. Applying ALPS documents to Existing Media Types
1222 |
1223 | An ALPS document can be applied to many existing media types as long
1224 | as there exists an agreed mapping between ALPS and the target media
1225 | type. Section 1.3 gave some informative examples of this.
1226 | Normative, up-to-date guidance on applying ALPS documents to existing
1227 | media types are available at the official ALPS Web site at
1228 |
1229 |
1230 |
1231 |
1232 | Amundsen, et al. Expires February 25, 2021 [Page 22]
1233 |
1234 | Internet-Draft Application-Level Profile Semantics August 2020
1235 |
1236 |
1237 | (http://alps.io/docs/mapping). [TK : this page does not yet exist.
1238 | -mamund]
1239 |
1240 | Not all media types can faithfully represent all ALPS descriptors.
1241 | For instance, the 'application/json' media type has no standard way
1242 | of representing hyperlinks. The details of how to apply ALPS to such
1243 | a media type will necesarily be incomplete, and it will not be
1244 | possible to represent some aspects of an ALPS profile in documents in
1245 | that media type.
1246 |
1247 | 3.1. Linking to ALPS Documents
1248 |
1249 | To indicate that an ALPS profile describes the semantics of some
1250 | representation document, the representation document SHOULD be linked
1251 | to the ALPS document. The 'profile' link relation [RFC6906] MUST be
1252 | used when creating this link. If the media type of the
1253 | representation document has no native ability to link to other
1254 | resources, or no ability to express link relations, the HTTP header
1255 | 'Link' [RFC5988] MAY be used to connect the representation document
1256 | and the ALPS profile. If the media type of the representation
1257 | document defines a parameter for linking the document to a profile,
1258 | that parameter MAY be used to connect the representation document and
1259 | the ALPS profile.
1260 |
1261 | A single representation document may be described by more than one
1262 | ALPS profile. If two ALPS profiles give conflicting semantics for
1263 | the same element, the document linked to earlier in the
1264 | representation SHOULD take precedence. A profile linked to using the
1265 | 'Link' header takes precedence over a profile linked to within the
1266 | representation document itself. A profile linked to using a media
1267 | type parameter takes precedence over a profile linked to using the
1268 | 'Link' header and a profile linked to within the representation
1269 | document itself.
1270 |
1271 | 4. IANA Considerations
1272 |
1273 | This specification establishes two media types: 'application/
1274 | alps+xml' and 'application/alps+json'
1275 |
1276 | 4.1. application/alps+xml
1277 |
1278 | Type name: application
1279 |
1280 | Subtype name: alps+xml
1281 |
1282 | Required parameters: None
1283 |
1284 | Optional parameters:
1285 |
1286 |
1287 |
1288 | Amundsen, et al. Expires February 25, 2021 [Page 23]
1289 |
1290 | Internet-Draft Application-Level Profile Semantics August 2020
1291 |
1292 |
1293 | charset This parameter has identical semantics to the charset
1294 | parameter of the 'application/xml' media type as specified
1295 | in[RFC3023].
1296 |
1297 | profile A whitespace-separated list of IRIs identifying specific
1298 | constraints or conventions that apply to an ALPS document. A
1299 | profile must not change the semantics of the resource
1300 | representation when processed without profile knowledge, so
1301 | that clients both with and without knowledge of a profiled
1302 | resource can safely use the same representation. The profile
1303 | parameter may also be used by clients to express their
1304 | preferences in the content negotiation process. It is
1305 | recommended that profile IRIs are dereferenceable and provide
1306 | useful documentation at that IRI.
1307 |
1308 | Encoding considerations:
1309 |
1310 | binary Same as encoding considerations of application/xml as
1311 | specified in[RFC3023].
1312 |
1313 | Security considerations: This format shares security issues common
1314 | to all XML content types. It does not provide executable content.
1315 | Information contained in ALPS documents do not require privacy or
1316 | integrity services.
1317 |
1318 | Interoperability considerations: ALPS is not described by a DTD and
1319 | applies only the well-formedness rules of XML. It should only be
1320 | parsed by a non-validating parser.
1321 |
1322 | Fragment identifier considerations: Fragment identifiers used with
1323 | application/alps+xml resources are simple, opaque strings that do
1324 | not contain any URL unsafe characters per [RFC1738] which match
1325 | the 'id' in an existing 'descriptor' in the document. For
1326 | example, the fragment identifier "#user" refers to a descriptor in
1327 | the document with an id value set to "user."
1328 |
1329 | Published specification: This Document
1330 |
1331 | Applications that use this media type: Various
1332 |
1333 | Additional information:
1334 |
1335 | magic number(s): none
1336 |
1337 | file extensions: .xml
1338 |
1339 | macintosh type file code: TEXT
1340 |
1341 |
1342 |
1343 |
1344 | Amundsen, et al. Expires February 25, 2021 [Page 24]
1345 |
1346 | Internet-Draft Application-Level Profile Semantics August 2020
1347 |
1348 |
1349 | object idenfiers: none
1350 |
1351 | person to contact for further information:
1352 |
1353 | Name: Mike Amundsen
1354 |
1355 | Email: mca@amundsen.com
1356 |
1357 | Intended usage: Common
1358 |
1359 | Author/change controller: Mike Amundsen
1360 |
1361 | 4.2. application/alps+json
1362 |
1363 | Type name: application
1364 |
1365 | Subtype name: alps+json
1366 |
1367 | Required parameters: None
1368 |
1369 | Optional parameters:
1370 |
1371 | profile A whitespace-separated list of IRIs identifying specific
1372 | constraints or conventions that apply to an ALPS document. A
1373 | profile must not change the semantics of the resource
1374 | representation when processed without profile knowledge, so
1375 | that clients both with and without knowledge of a profiled
1376 | resource can safely use the same representation. The profile
1377 | parameter may also be used by clients to express their
1378 | preferences in the content negotiation process. It is
1379 | recommended that profile IRIs are dereferenceable and provide
1380 | useful documentation at that IRI.
1381 |
1382 | Encoding considerations: binary
1383 |
1384 | Security considerations: This media type shares security issues
1385 | common to all JSON content types. See [RFC4627] Section #6 for
1386 | additional information. ALPS+JSON does not provide executable
1387 | content. Information contained in ALPS+JSON documents do not
1388 | require privacy or integrity services.
1389 |
1390 | Interoperability considerations: None
1391 |
1392 | Fragment identifier considerations: Fragment identifiers used with
1393 | application/alps+json resources are simple, opaque strings that do
1394 | not contain any URL unsafe characters per [RFC1738] which match
1395 | the 'id' in an existing 'descriptor' in the document. For
1396 |
1397 |
1398 |
1399 |
1400 | Amundsen, et al. Expires February 25, 2021 [Page 25]
1401 |
1402 | Internet-Draft Application-Level Profile Semantics August 2020
1403 |
1404 |
1405 | example, the fragment identifier "#user" refers to a descriptor in
1406 | the document with an id value set to "user."
1407 |
1408 | Published specification: This Document
1409 |
1410 | Applications that use this media type: Various
1411 |
1412 | Additional information:
1413 |
1414 | magic number(s): none
1415 |
1416 | file extensions: .json
1417 |
1418 | macintosh type file code: TEXT
1419 |
1420 | object idenfiers: none
1421 |
1422 | person to contact for further information:
1423 |
1424 | Name: Mike Amundsen
1425 |
1426 | Email: mca@amundsen.com
1427 |
1428 | Intended usage: Common
1429 |
1430 | Author/change controller: Mike Amundsen
1431 |
1432 | 5. Internationalization Considerations
1433 |
1434 | [TK]
1435 |
1436 | [[CREF1: insert text (consider rfc 5987)]]
1437 |
1438 | 6. Acknowledgements
1439 |
1440 | The authors gratefully acknowledge the following people who made
1441 | contributions to this specification:
1442 |
1443 | Glenn Block, Christopher Harrison, Steve Klabnik, Graham Klyne,
1444 | Dmitry Pavlov, Remon (Ray) Sinnema.
1445 |
1446 | 7. References
1447 |
1448 | 7.1. Normative References
1449 |
1450 | [RFC1738] Berners-Lee, T., Masinter, L., and M. McCahill, "Uniform
1451 | Resource Locators (URL)", RFC 1738, DOI 10.17487/RFC1738,
1452 | December 1994, .
1453 |
1454 |
1455 |
1456 | Amundsen, et al. Expires February 25, 2021 [Page 26]
1457 |
1458 | Internet-Draft Application-Level Profile Semantics August 2020
1459 |
1460 |
1461 | [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
1462 | Requirement Levels", BCP 14, RFC 2119,
1463 | DOI 10.17487/RFC2119, March 1997,
1464 | .
1465 |
1466 | [RFC3023] Murata, M., St. Laurent, S., and D. Kohn, "XML Media
1467 | Types", RFC 3023, DOI 10.17487/RFC3023, January 2001,
1468 | .
1469 |
1470 | [RFC4627] Crockford, D., "The application/json Media Type for
1471 | JavaScript Object Notation (JSON)", RFC 4627,
1472 | DOI 10.17487/RFC4627, July 2006,
1473 | .
1474 |
1475 | [RFC5988] Nottingham, M., "Web Linking", RFC 5988,
1476 | DOI 10.17487/RFC5988, October 2010,
1477 | .
1478 |
1479 | [RFC6906] Wilde, E., "The 'profile' Link Relation Type", RFC 6906,
1480 | DOI 10.17487/RFC6906, March 2013,
1481 | .
1482 |
1483 | [RFC7320] Nottingham, M., "URI Design and Ownership", RFC 7320,
1484 | DOI 10.17487/RFC7320, July 2014,
1485 | .
1486 |
1487 | 7.2. Informative References
1488 |
1489 | [I-D.ietf-appsawg-text-markdown]
1490 | Leonard, S., "The text/markdown Media Type", draft-ietf-
1491 | appsawg-text-markdown-12 (work in progress), October 2015.
1492 |
1493 |
1494 |
1495 |
1496 |
1497 |
1498 |
1499 |
1500 |
1501 |
1502 |
1503 |
1504 |
1505 |
1506 |
1507 |
1508 |
1509 |
1510 |
1511 |
1512 | Amundsen, et al. Expires February 25, 2021 [Page 27]
1513 |
1514 | Internet-Draft Application-Level Profile Semantics August 2020
1515 |
1516 |
1517 | Appendix A. Frequently Asked Questions
1518 |
1519 | A.1. Why are there no URLs in ALPS?
1520 |
1521 | ALPS is meant to describe a service in a universal way. The same
1522 | ALPS description document can be used by many ALPS-compliant servers.
1523 | Since each service implementation is in charge of their own URL
1524 | space, ALPS descriptions do not include URLs. See URI Design and
1525 | Ownership [RFC7320] for more on this principle.
1526 |
1527 | When implementing ALPS-compliant servers, implementors are free to
1528 | use any URL design they wish. All that is required is that
1529 | implementors use the same ALPS profile descriptor 'id' and 'name'
1530 | properties in the representations. When implementing ALPS-compliant
1531 | client applications, the URLs will be supplied at runtime by the
1532 | server representations. Client apps only need to recognize the
1533 | descriptor 'id' and 'name' values from the referenced ALPS profile
1534 | document.
1535 |
1536 | A.2. Why is there no workflow component in the ALPS specification?
1537 |
1538 | ALPS is not designed to describe workflows or execution paths for a
1539 | service. Instead, ALPS is designed to describe a shared set of data
1540 | and actions elements that server MAY implement in order to create a
1541 | service. Each action descriptor (where the descriptor's type
1542 | property is set to 'safe', 'unsafe', or 'idemponent') SHOULD describe
1543 | a state transition that a ALPS-compliant client application can
1544 | invoke when it is available. Servers are free to implement the
1545 | transitions they find useful and to arrange them in any order they
1546 | wish. ALPS-compliant client applications SHOULD be able to recognize
1547 | these descriptors when they appear and are free to act upon them
1548 | directly, render them for humans to invoke, or ignore/hide them
1549 | completely.
1550 |
1551 | A.3. Why is there no way to indicate ranges for semantic descriptors?
1552 |
1553 | For most all service implementations, there are cases where it would
1554 | be helpful to document a range of possible values for a semantic
1555 | element. For example, when implementing the descriptor {"id":"size",
1556 | ...}, one service might want to indicate the list of supported values
1557 | such as: 'small', 'meduim', 'large', etc. However, another service
1558 | might have a very different list of possible values such as
1559 | 'standard', 'oversized', 'undersized', etc. And there may be a
1560 | service that only supports a single value here and will always supply
1561 | it ('onesize').
1562 |
1563 | Since ALPS is meant to provide a single description that can be used
1564 | by multiple services, establishing ranges within the ALPS description
1565 |
1566 |
1567 |
1568 | Amundsen, et al. Expires February 25, 2021 [Page 28]
1569 |
1570 | Internet-Draft Application-Level Profile Semantics August 2020
1571 |
1572 |
1573 | is considered over-constraining service implementations. Services
1574 | are free to supply this information within representations at run
1575 | time. But including them in the global ALPS profile is discouraged.
1576 |
1577 | Authors' Addresses
1578 |
1579 | Mike Amundsen
1580 |
1581 | EMail: mca@amundsen.com
1582 | URI: http://amundsen.com
1583 |
1584 |
1585 | Leonard Richardson
1586 |
1587 | EMail: leonardr@segfault.org
1588 | URI: http://crummy.com
1589 |
1590 |
1591 | Mark W. Foster
1592 |
1593 | EMail: mwf@fosrias.com
1594 |
1595 |
1596 |
1597 |
1598 |
1599 |
1600 |
1601 |
1602 |
1603 |
1604 |
1605 |
1606 |
1607 |
1608 |
1609 |
1610 |
1611 |
1612 |
1613 |
1614 |
1615 |
1616 |
1617 |
1618 |
1619 |
1620 |
1621 |
1622 |
1623 |
1624 | Amundsen, et al. Expires February 25, 2021 [Page 29]
1625 |
--------------------------------------------------------------------------------
/ex/contact-alps.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | A list of contacts
6 |
7 |
8 |
9 |
13 |
14 | simple link/form for getting a list of contacts
15 |
16 |
20 |
21 | input for search form
22 |
23 |
24 |
25 |
26 |
27 |
31 |
34 |
35 | link to individual contact
36 |
37 |
38 |
41 |
44 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/ex/contact-cj.js:
--------------------------------------------------------------------------------
1 | {
2 | "collection" : {
3 | "version" : "1.0",
4 | "href" : "http://example.org/contacts/",
5 |
6 | "links" : [
7 | {
8 | "rel" : "profile",
9 | "href" : "http://alps.io/profiles/contacts"
10 | },
11 | {
12 | "rel" : "type",
13 | "href" : "http://alps.io/profiles/contacts#contact"
14 | }
15 | ],
16 |
17 | "queries" : [
18 | {
19 | "rel" : "collection",
20 | "rt" : "contact",
21 | "href" : "http://example.org/contacts/",
22 | "data" : [
23 | {
24 | "name" : "nameSearch",
25 | "value" : "",
26 | "prompt" : "Search Name"
27 | }
28 | ]
29 | }
30 | ],
31 |
32 | "items" : [
33 | {
34 | "href" : "http://example.org/contacts/1",
35 | "rel" : "item",
36 | "rt" : "contact",
37 | "data" : [
38 | {"name" : "fullName", "value" : "Ann Arbuckle" },
39 | {"name" : "email", "value" : "aa@example.org" },
40 | {"name" : "email", "value" : "123.456.7890" }
41 | ],
42 | "links" : [
43 | {
44 | "rel" : "type",
45 | "href" : "http://alps.io/profiles/contacts#contact"
46 | }
47 | ]
48 | },
49 | {
50 | "href" : "http://example.org/contacts/100",
51 | "rel" : "item",
52 | "rt" : "contact",
53 | "data" : [
54 | {"name" : "fullName", "value" : "Zelda Zackney" },
55 | {"name" : "email", "value" : "zz@example.org" },
56 | {"name" : "email", "value" : "987.654.3210" }
57 | ],
58 | "links" : [
59 | {
60 | "rel" : "type",
61 | "href" : "http://alps.io/profiles/contacts#contact"
62 | }
63 | ]
64 | }
65 | ]
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/ex/contact-hal.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 | Ann Arbuckle
9 | aa@example.org
10 | 123.456.7890
11 |
12 |
13 |
14 | Zelda Zackney
15 | zz@example.org
16 | 987.664.3210
17 |
18 |
19 |
--------------------------------------------------------------------------------
/ex/contact.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
14 |
15 |