Class: RDF::RDFa::Format
- Inherits:
-
Format
- Object
- Format
- RDF::RDFa::Format
- Defined in:
- lib/rdf/rdfa/format.rb
Overview
RDFa format specification.
Class Method Summary (collapse)
-
+ (Boolean) detect(sample)
Sample detection to see if it matches RDFa (not RDF/XML or Microdata).
Class Method Details
+ (Boolean) detect(sample)
Sample detection to see if it matches RDFa (not RDF/XML or Microdata)
Use a text sample to detect the format of an input file. Sub-classes implement a matcher sufficient to detect probably format matches, including disambiguating between other similar formats.
35 36 37 38 39 |
# File 'lib/rdf/rdfa/format.rb', line 35 def self.detect(sample) (sample.match(/<[^>]*(about|resource|prefix|typeof|property|vocab)\s*="[^>]*>/m) || sample.match(/<[^>]*DOCTYPE\s+html[^>]*>.*xmlns:/im) ) && !sample.match(/<(\w+:)?(RDF)/) end |