RDF/JSON Specification

2020.10.02 15:45

졸리운_곰 조회 수:15

 

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

 

 

 

본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
번호 제목 글쓴이 날짜 조회 수
1075 [ 一日30分 인생승리의 학습법] Visual Basic application on linux 졸리운_곰 2022.02.22 16
1074 [ 一日30分 인생승리의 학습법] Truffle을 이용한 DApp 개발환경 구성 file 졸리운_곰 2022.02.20 86
1073 [ 一日30分 인생승리의 학습법]LaTeX 활용해서 논문쓰장 file 졸리운_곰 2022.02.17 20
1072 [ 一日30分 인생승리의 학습법] LaTeX 초보자가 감을 잡는 것을 돕는 몇가지 팁 졸리운_곰 2022.02.17 279
1071 [ 一日30分 인생승리의 학습법] 수식 입력이 가능한 마인드맵 프로그램, 프리플레인(freeplane) file 졸리운_곰 2022.02.16 37
1070 [ 一日30分 인생승리의 학습법] Awesome Metaverse Awesome 짱!~ 메티버스 오픈소스 file 졸리운_곰 2022.02.13 11
1069 [ 一日30分 인생승리의 학습법] 제 NAS의 Docker 목록 file 졸리운_곰 2022.01.31 105
1068 [ 一日30分 인생승리의 학습법] gw basic 튜터리얼, 메뉴얼, A GW-BASIC Tutorial 졸리운_곰 2022.01.22 21
1067 [ 一日30分 인생승리의 학습법] Web Search Engine : 웹 검색 엔진 google/ naver 만들기 file 졸리운_곰 2022.01.17 28
1066 [ 一日30分 인생승리의 학습법] AILog 2 A logic programming language with probabilities and logical explanation and debugging faculities file 졸리운_곰 2022.01.16 12
1065 [ 一日30分 인생승리의 학습법] 소스 인사이트( source insight ) 사용법 file 졸리운_곰 2022.01.13 19
1064 [ 一日30分 인생승리의 학습법][메타버스란 무엇인가?] The Metaverse Has Already Arrived. Here’s What That Actually Means file 졸리운_곰 2021.12.29 22
1063 [ 一日30分 인생승리의 학습법] English to Logic, Truth-Functional Propositional Logic 졸리운_곰 2021.12.15 16
1062 [ 一日30分 인생승리의 학습법][실무행정] 기안문 공문서 기안문 작성법, 행정안전부 지침 및 시행 file 졸리운_곰 2021.12.11 42
1061 [ 一日30分 인생승리의 학습법][실무행정] 기안문 작성하기 졸리운_곰 2021.12.11 17
1060 [ 一日30分 인생승리의 학습법] 셀레니움 헤드리스 테스트를 위한 HTMLUnitDriver 및 PhantomJS file 졸리운_곰 2021.11.26 24
1059 [ 一日30分 인생승리의 학습법] 메타버스로 날개 단 오픈소스 프로젝트 file 졸리운_곰 2021.11.23 230
1058 [ 一日30分 인생승리의 학습법] Best JavaScript machine learning libraries in 2021 file 졸리운_곰 2021.11.20 8
1057 [ 一日30分 인생승리의 학습법] 프로그래밍 언어별 딥러닝 라이브러리 정리 file 졸리운_곰 2021.11.19 30
1056 [오픈소스 라이센스 상용화 라이센스 검토] [Software] 공개 SW 라이센스(GPL, LGPL, BSD) 졸리운_곰 2021.11.18 10
대표 김성준 주소 : 경기 용인 분당수지 U타워 등록번호 : 142-07-27414
통신판매업 신고 : 제2012-용인수지-0185호 출판업 신고 : 수지구청 제 123호 개인정보보호최고책임자 : 김성준 sjkim70@stechstar.com
대표전화 : 010-4589-2193 [fax] 02-6280-1294 COPYRIGHT(C) stechstar.com ALL RIGHTS RESERVED