RDF/JSON Specification

2020.10.02 15:45

졸리운_곰 조회 수:46

 

RDF/JSON Specification

JSON (the serialisation of data in JavaScript Object Notation) is an increasingly popular data format, largely because it is easy to parse (or, in the case of JavaScript, simply evaluate) into a data structure of the consumer's programming language of choice.

This is a specification for a resource-centric serialisation of RDF in JSON. It aims to serialise RDF in a structure that is easy for developers to work with.

Syntax Specification

RDF/JSON represents a set of RDF triples as a series of nested data structures. Each unique subject in the set of triples is represented as a key in JSON object (also known as associative array, dictionary or hash table). The value of each key is a object whose keys are the URIs of the properties associated with each subject. The value of each property key is an array of objects representing the value of each property.

Blank node subjects are named using a string conforming to blank nodes in Turtle. For example: _:A1.

In general, a triple (subject S, predicate P, object O) is encoded in the following structure:

{ "S" : { "P" : [ O ] } }

The object of the triple O is a further object with the following keys:

  • type one of uriliteral or bnode (required and must be lowercase)
  • value the lexical value of the object (required, full URIs should be used, not qnames)
  • lang the language of a literal value (optional but if supplied it must not be empty)
  • datatype the datatype URI of the literal value (optional)

The lang and datatype keys should only be used if the value of the type key is "literal".

For example, the following triple:

<http://example.org/about> <http://purl.org/dc/elements/1.1/title> "Anna's Homepage" .

Here is an example of the RDF/JSON specification in the format of a JSON Schema:

{
  "version": "0.3.0",
  "id": "RDF-JSON",
  "description": "RDF/JSON definition",
  "type": "object",
  "properties": {},
  "additionalProperties": {
    "type": "object",
    "description": "subject (root object)",
    "optional": "true",
    "properties": {},
    "additionalProperties": {
      "type": "array",
      "description": "predicate (subject object)",
      "optional": "true",
      "items": {
        "type": "object",
        "description": "object (value array)",
        "properties": {
          "description": "content (value object)",
          "type": {
            "type": "string",
            "enum": ["uri", "bnode", "literal"]
          },
          "value": {
            "type": "string"
          },
          "lang": {
            "optional": true,
            "description": "See ftp://ftp.isi.edu/in-notes/bcp/bcp47.txt",
            "type": "string"
          },
          "datatype": {
            "optional": true,
            "format": "uri",
            "type": "string"
          }
        }
      }
    }
  }
}

Examples

The following RDF/XML:

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:foaf="http://xmlns.com/foaf/0.1/"
  xmlns:dc="http://purl.org/dc/elements/1.1/">
  <rdf:Description rdf:about="http://example.org/about">
    <dc:creator>Anna Wilder</dc:creator>
    <dc:title xml:lang="en">Anna's Homepage</dc:title>
    <foaf:maker rdf:nodeID="person" />
  </rdf:Description>
  <rdf:Description rdf:nodeID="person">
    <foaf:homepage rdf:resource="http://example.org/about" />
    <foaf:made rdf:resource="http://example.org/about" />
    <foaf:name>Anna Wilder</foaf:name>
    <foaf:firstName>Anna</foaf:firstName>
    <foaf:surname>Wilder</foaf:surname>
    <foaf:depiction rdf:resource="http://example.org/pic.jpg" />
    <foaf:nick>wildling</foaf:nick>
    <foaf:nick>wilda</foaf:nick>
    <foaf:mbox_sha1sum>69e31bbcf58d432950127593e292a55975bc66fd</foaf:mbox_sha1sum>
  </rdf:Description>
</rdf:RDF>

Can be represented as the following RDF/JSON structure:

경축! 아무것도 안하여 에스천사게임즈가 새로운 모습으로 재오픈 하였습니다.
어린이용이며, 설치가 필요없는 브라우저 게임입니다.
https://s1004games.com

{
  "http://example.org/about" : {
    "http://purl.org/dc/elements/1.1/creator" : [ { "value" : "Anna Wilder", "type" : "literal" } ],
    "http://purl.org/dc/elements/1.1/title"   : [ { "value" : "Anna's Homepage", "type" : "literal", "lang" : "en" } ],
    "http://xmlns.com/foaf/0.1/maker"         : [ { "value" : "_:person", "type" : "bnode" } ]
  },

  "_:person" : {
    "http://xmlns.com/foaf/0.1/homepage"    : [ { "value" : "http://example.org/about", "type" : "uri" } ],
    "http://xmlns.com/foaf/0.1/made"        : [ { "value" : "http://example.org/about", "type" : "uri" } ],
    "http://xmlns.com/foaf/0.1/name"        : [ { "value" : "Anna Wilder", "type" : "literal" } ],
    "http://xmlns.com/foaf/0.1/firstName"   : [ { "value" : "Anna", "type" : "literal" } ],
    "http://xmlns.com/foaf/0.1/surname"     : [ { "value" : "Wilder", "type" : "literal" } ],
    "http://xmlns.com/foaf/0.1/depiction"   : [ { "value" : "http://example.org/pic.jpg", "type" : "uri" } ],
    "http://xmlns.com/foaf/0.1/nick"        : [
                                                { "type" : "literal", "value" : "wildling" },
                                                { "type" : "literal", "value" : "wilda" }
                                              ],
    "http://xmlns.com/foaf/0.1/mbox_sha1sum"  : [ {  "value" : "69e31bbcf58d432950127593e292a55975bc66fd", "type" : "literal" } ]
  }
}

Serialisation Algorithm

Refer to JSON for definitions of terminology.

  1. Start a JSON object (called the root object)
  2. Group all the triples by subject
  3. For each subject:
    1. Create a JSON object for the subject (called the subject object)
    2. Group all triples having the current subject by predicate
    3. For each predicate:
      1. Create a JSON array (called the value array)
      2. Select all triples having the current subject and current predicate
      3. For each value:
        1. Create a JSON object (called the value object)
        2. Add a key/value pair to the value object with the key being the string value and the value being the lexical value of the triple value
        3. Add a key/value pair to the value object with the key being the string type and the value being one of literaluri or bnode depending on the type of the triple's value
        4. If the triple's value is a plain literal and has a language then add a key/value pair to the value object with the key being the string lang and the value being the language token
        5. If the triple's value is a typed literal then add a key/value pair to the value object with the key being the string datatype and value being the URI of the datatype
        6. Push the value object onto the end of the value array
      4. Add a key/value pair to the subject object with the key being the predicate URI and the value being the value array
  4. Add a key/value pair to the root object with the key being the URI or blank node identifier of the subject and the value being the subject object created in the previous step

Publishing RDF/JSON on the web

If doing content-negotiation, respond to, and send the content-type as application/json. An empty graph (ie: no triples) should be served as an empty object: {}.

References

  1. Tags for the Identification of Languages
  2. RDF/JSON Brainstorming
  3. Uniform Resource Identifier (URI): Generic Syntax
  4. RDF/JSON schema

History

The RDF/JSON Specification was written/edited 2007, 2008 by Keith Alexander, Danny Ayers, Sam Tunnicliffe, Fellahst, Ian Davis and Robman; originally published at http://n2.talis.com/wiki/RDF_JSON_Specification, which is no-longer available.

The content of this specification has been taken from the following locations:

The last edit of the RDF_JSON wiki page was to take in updates from an RDF_JSON 0.3.0 schema edited by Toby Inkster.

This specification is a work of its own right and is licensed under Creative Commons Attribution-ShareAlike 3.0 Unported (CC-BY-SA-3.0).

 

[출처] https://www.easyrdf.org/docs/rdf-formats-json

 

 

 

본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
번호 제목 글쓴이 날짜 조회 수
1100 [ 一日30分 인생승리의 학습법 ] REST API URL 규칙 졸리운_곰 2022.11.26 37
1099 [ 一日30分 인생승리의 학습법 ] prolog 문법 : Prolog Syntax 졸리운_곰 2022.11.21 89
1098 [ 一日30分 인생승리의 학습법 ] noVNC 작동원리 file 졸리운_곰 2022.11.16 39
1097 [ 一日30分 인생승리의 학습법 ] 프로젝트 만들고 GitHub에 첫 Commit하고 Push하기 file 졸리운_곰 2022.11.15 30
1096 [ 一日30分 인생승리의 학습법 ] 우분투(리눅스) 에서 EBS 라디오 자동녹음 만들기 졸리운_곰 2022.11.11 37
1095 [ 一日30分 인생승리의 학습법 ] EBS FM 라디오, rtmp 서비스 중단 졸리운_곰 2022.11.11 32
1094 [ 一日30分 인생승리의 학습법 ] 악보 읽는 방법 file 졸리운_곰 2022.11.08 97
1093 [ 一日30分 인생승리의 학습법 ] 13가지 주요 오픈소스 프로젝트 file 졸리운_곰 2022.10.09 44
1092 [ 一日30分 인생승리의 학습법 ] 극상의 학습 난이도로 입문자 울리는 프로그래밍 언어 Top 10 졸리운_곰 2022.09.03 45
1091 [빅데이터의 활용의 오해] 데이터가 당신을 스마트하게 만들고 있을까? 졸리운_곰 2022.09.01 36
1090  [ 一日30分 인생승리의 학습법 ] [Git] Git 명령어 정리 졸리운_곰 2022.08.16 46
1089 [ 一日30分 인생승리의 학습법 ] LLVM이란 file 졸리운_곰 2022.08.13 48
1088 [ 一日30分 인생승리의 학습법 ] Build Your Own Remote Desktop Application using Javascript, Python & WebRTC — Part 2 file 졸리운_곰 2022.08.05 56
1087 [ 一日30分 인생승리의 학습법 ] Build Your Own Remote Desktop Application using Javascript, Python & WebRTC — Part 1 file 졸리운_곰 2022.08.05 61
1086 [ 一日30分 인생승리의 학습법 ] REST API 규칙 졸리운_곰 2022.08.03 56
1085 [ 一日30分 인생승리의 학습법 ]REST API 설계 (네이밍) 졸리운_곰 2022.08.03 48
1084 [ 一日30分 인생승리의 학습법] [2탄!!] KrakenD Demo 면을 알아보죠! file 졸리운_곰 2022.08.01 66
1083 [ 一日30分 인생승리의 학습법] [1탄!!]KrakenD가 무엇인가? 과연 Api Gateway로 으뜸인가요? file 졸리운_곰 2022.08.01 37
1082 [ 一日30分 인생승리의 학습법] 오픈소스 라이선스 별 의무사항 졸리운_곰 2022.07.29 50
1081 [ 一日30分 인생승리의 학습법] The complete guide to (external) Domain Specific Languages file 졸리운_곰 2022.07.08 54
대표 김성준 주소 : 경기 용인 분당수지 U타워 등록번호 : 142-07-27414
통신판매업 신고 : 제2012-용인수지-0185호 출판업 신고 : 수지구청 제 123호 개인정보보호최고책임자 : 김성준 sjkim70@stechstar.com
대표전화 : 010-4589-2193 [fax] 02-6280-1294 COPYRIGHT(C) stechstar.com ALL RIGHTS RESERVED