Nice programing

마이크로 데이터 대 RDFa

nicepro 2020. 11. 20. 09:38
반응형

마이크로 데이터 대 RDFa


RDFa 및 Microdata에 대한 간단한 질문이 있습니다.

내 현재 이해는 RDFa가 HTML로 구현 된 RDF이지만 저와 같은 새로운 개발자에게는 복잡하며 Microdata는 구현하기가 정말 쉽고 빠르다는 것입니다.

이 두 가지 의미 형식의 다른 장점과 단점은 무엇입니까?


Microdata와 RDFa의 차이점

(기술적, 작은) 차이점이 많지만 중요하다고 생각하는 것들 중 일부는 다음과 같습니다 (웹 마스터에 대한 제 답변을 기반으로 사용).

명세서

적용 가능성

  • 마이크로 데이터는 (X) HTML5 ( 각각 WHATWG에서 정의한 HTML )에서만 사용할 수 있습니다 .

  • RDFa는 다양한 호스트 언어, 즉 여러 (X) HTML 변형 및 XML (따라서 SVG, MathML, Atom 등에서도 사용 가능)에서 사용할 수 있습니다.

    RDFa Core는 "모든 마크 업 언어로 구조화 된 데이터를 표현하기위한 속성 사양"이므로 새로운 호스트 언어를 지원할 수 있습니다 .

여러 어휘 사용

  • Microdata에서는 동일한 콘텐츠에 대해 여러 어휘를 사용하는 것이 더 어렵고 때로는 불가능합니다.

  • 접두사 사용 덕분에 RDFa는 어휘를 혼합 할 수 있습니다.

역 속성 사용

  • Microdata는 역 속성을 사용하는 방법을 제공하지 않습니다. 역 속성을 정의하지 않는 어휘에 필요합니다 (예 : & parent대신 정의 만 정의 함 ). 인기있는 Schema.org는 그러한 어휘입니다 (몇 가지 오래된 예외 만 있음).parentchild

    W3C Note Microdata to RDF 는 실험적을 정의하지만 itemprop-reverse이 속성은 W3C 나 WHATWG의 Microdata의 일부가 아닙니다.

  • RDFa는 역 속성 사용을 지원합니다 ( rev속성 사용 ).

시맨틱 웹

  • Microdata를 사용하면 Semantic Web에서 직접 참여하지 않습니다 (그리고 AFAIK Microdata는 의도하지 않음). 대부분은 RDF 직렬화로 정의되지 않았기 때문입니다 ( Microdata에서 RDF추출 하는 방법이 있음 ).

  • RDFa는 RDF 직렬화이며 RDF는 W3C의 Semantic Web 의 기초입니다 .


RDFa CoreHTML + RDFa 사양 HTML Microdata 보다 더 복잡 할 수 있지만 더 많은 기능을 제공하기 때문에 "공정한"비교는 아닙니다.

Microdata와 유사한 RDFa Lite ( "대부분의 일상적인 요구 사항에 적합")가 있으며,이 사양은 적어도 제 생각에는 Microdata보다 덜 복잡합니다.

무엇을해야합니까?

특정 소비자 (예 : 검색 엔진 및 브라우저 추가 기능)를 지원하려면 지원되는 구문에 대한 설명서를 확인해야합니다.

하나의 구문 만 배우고 싶고 특정 소비자를 염두에 두지 않으려면 ( 주의, 주관적인 의견! ) RDFa를 사용하십시오. 왜?

  • RDFa는 수년에 걸쳐 성숙했으며 W3C Rec 인 반면 Microdata는 상대적으로 새로운 발명품이며 W3C에 의해 표준화되지 않았습니다.
  • RDFa는 HTML5뿐만 아니라 다양한 언어로 사용할 수 있습니다.
  • RDFa는 동일한 콘텐츠에 대해 어휘를 혼합하여 사용할 수 있으며 기본적으로 리버스 속성 사용을 지원합니다.

결정할 수 없습니까? 둘 다 사용하십시오.

참고 당신은 또한 몇 가지 구문을 사용할 수 있습니다 당신은 마이크로 데이터 가질 수 있도록, 동일한 내용에 대한 (RDFa를 하고 마이크로 포맷, JSON-LD를, 그리고 최대의 호환성을 위해 ...).

  • 다음은 간단한 Microdata 스 니펫입니다.

    <p itemscope itemtype="http://schema.org/Person">
      <span itemprop="name">John Doe</span> is his name.
    </p>
    
  • 다음은 RDFa (Lite)를 사용하는 동일한 스 니펫입니다.

    <p typeof="schema:Person">
      <span property="schema:name">John Doe</span> is his name.
    </p>
    
  • 그리고 여기서 두 구문이 함께 사용됩니다.

    <p itemscope itemtype="http://schema.org/Person" typeof="schema:Person">
      <span itemprop="name" property="schema:name">John Doe</span> is his name.
    </p>
    

그러나 일반적으로이 경로를 따라가는 것이 필요 / 권장되지는 않습니다.


The main advantage you get from any semantic format is the ability for consumers to reuse your data.

For example, search engines like Google are consumers that reuse your data to display Rich Snippets, such as this one:

Recipe Rich Snippet

In order to decide which format is best, you need to know which consumers you want to target. For example, Google says in their FAQ that they will only process microdata (though the testing tool does now work with RDFa, so it is possible that they accept RDFa).

Unless you know that your target consumer only accepts RDFa, you are probably best going with microdata. While many RDFa-consuming services (such as the semantic search engine Sindice) also accept microdata, microdata-consuming services are less likely to accept RDFa.


It's long, but one of the most comprehensive answers you'll get to this question is this blog post by Jeni Tennison: Microdata and RDFa Living Together in Harmony


I'm not certain if unor's suggestion to use both Microdata and RDFa is a good idea. If you use Google's Structured Data Testing Tool (or other similar tools) on his example it shows duplicate data which seems to imply that the Google bot would pick up two people named John Doe on the webpage instead of one which was the original intention.

I'm assuming therefore that using one syntax for a given item is a better idea (you should still be able to mix syntaxes as long as they describe separate entities).

Though I would be happy to be proven wrong on this.

참고URL : https://stackoverflow.com/questions/8957902/microdata-vs-rdfa

반응형