Did you know ... Search Documentation:
Pack prolog_rdf -- prolog/rdf_guess.pl
PublicShow source

This module heuristically guesses the RDF serialization format that is stored in the input stream In.

RDF/XML can be distinguished from Turtle-family serializations, because it is not possible to define valid RDF/XML without declaring XML namespaces.

 rdf_guess_file(+FileSpec:term, +Size:positiveInteger, -MediaType:media_type) is semidet
 rdf_guess_stream(+In:istream, +Size:nonneg, -MediaType:media_type) is semidet
Arguments:
Size- is the number of codes that is read from the input stream In, on which the guess is based. This number is doubled while backtracking, until either the end of the stream is reached or the maximum peek size, as indicated by the input stream `In', is exceeded.
MediaType- is a compound term of the form `media(Supertype/Subtype,Params)'. This is how Media Types are represented in the HTTP package (see http_parse_header_value/3).

There is one JSON-family Media Type:

  • media(application/ld+json,[]) for JSON-LD

There are two/four Turtle-family Media Types:

  • media(application/trig,[]) for TriG This includes the Media Type for Turtle, i.e., `media(text/turtle,[])'.
  • media(application/'n-nquads',[]) for N-Quads This includes the Media Type for N-Triples, i.e., `media(application/'n-triples',[])'.

There are two SGML-family Media Types that denote RDF:

  • media(application/'rdf+xml',[]) for RDF/XML
  • media(application/'xhtml+xml',[]) for RDFa
  • media(text/html,_) for RDFa
 rdf_guess_string(+String:string, -MediaType:media_type) is semidet