Did you know ... Search Documentation:
rdfa.pl -- Extract RDF from an HTML or XML DOM
PublicShow source

This module implements extraction of RDFa triples from parsed XML or HTML documents. It has two interfaces: read_rdfa/3 to read triples from some input (stream, file, URL) and xml_rdfa/3 to extract triples from an HTML or XML document that is already parsed with load_html/3 or load_xml/3.

See also
- http://www.w3.org/TR/2013/REC-rdfa-core-20130822/
- http://www.w3.org/TR/html-rdfa/
Source read_rdfa(+Input, -Triples, +Options) is det
True when Triples is a list of rdf(S,P,O) triples extracted from Input. Input is either a stream, a file name, a URL referencing a file name or a URL that is valid for http_open/3. Options are passed to open/4, http_open/3 and xml_rdfa/3. If no base is provided in Options, a base is deduced from Input.
Source detect_bom(+In, +Close0, -Close) is det[private]
We may be loading a binary stream. In that case we want to do BOM detection.
Source xml_rdfa(+DOM, -RDF, +Options)
True when RDF is a list of rdf(S,P,O) terms extracted from DOM according to the RDFa specification. Options processed:
base(+BaseURI)
URI to use for ''. Normally set to the document URI.
anon_prefix(+AnnonPrefix)
Prefix for blank nodes.
lang(+Lang)
Default for lang
vocab(+Vocab)
Default for vocab
markup(+Markup)
Markup language processed (xhtml, xml, ...)
Source rdfa_evaluation_context(+DOM, -Context, +Options)[private]
7.5.0: Create the initial evaluation context
To be done
- : derive markup from DOM
Source default_prefixes(+Markup, -Dict)[private]
Create a default prefix map. Which prefixes are supposed to be in this map?
Source rdfa_core_prefix(?Prefix, ?URI) is nondet[private]
RDFa initial context prefix declarations.
See also
- http://www.w3.org/2011/rdfa-context/rdfa-1.1
Source rdfa_local_context(EvalContext, LocalContext)[private]
7.5.1: Create the local context
Source update_vocab(+DOM, +Context) is det[private]
7.5.2. Handle @vocab
Source update_prefixes(+DOM, +Context) is det[private]
7.5.3: Update prefix map using @prefix and @xmlns. First processes xmlns:Prefix=IRI.
Source update_lang(+DOM, +Context) is det[private]
7.5.4: Update lang
Source update_subject(+DOM, +Context) is det[private]
7.5.5 and 7.5.6: establish a value for new subject
Source emit_typeof(+DOM, +LocalContext) is det[private]
7.5.7: emit triples for @typeof value.
Source update_list_mapping(+DOM, +Context) is det[private]
7.5.8: Create a list mapping if appropriate
Source empty_list_mapping(-Mapping) is det[private]
empty_list_mapping(+Mapping) is semidet[private]
Source get_list_mapping(+IRI, +Mapping, -List) is semidet[private]
Source add_list_mapping(+IRI, !Mapping, +List) is det[private]
Manage a list mapping. Note this needs to be wrapped in a term to be able to extend the mapping while keeping its identity.
Source step_7_5_9(+DOM, +Context)[private]
Source step_7_5_10(+DOM, +Context)[private]
Similar to step_7_5_9, but adding to incomplete triples.
Source update_property_value(+DOM, +Context) is det[private]
7.5.11: establish current property value.
Source complete_triples(+Context)[private]
7.5.12: Complete incomplete triples
Source descent(DOM, Context)[private]
7.5.13: Descent into the children
Source complete_lists(+Context) is det[private]
7.5.14: Complete possibly pending lists
Source has_attribute(+Name, +Attrs, +Context) is semidet[private]
Source has_attribute(+Name, +Attrs, -Value, +Context) is semidet[private]
True if Attrs contains Name. We sometimes need to ignore Attributes if their value is invalid.
See also
- HTML+RDFa, 3.1 Additional RDFa Processing Rules, point 7.
Source iri_attr(+AttName, +Attrs, -IRI, +Context) is semidet[private]
Source new_bnode(-BNode, +Context) is det[private]
Create a new blank node. Note that the current id is kept in a term to avoid copying the counter on the descent step.
Source iri_list(+Spec, -IRIs, +Context) is det[private]
True when IRIs is a list of fulfy qualified IRIs from Spec
Source iri(+Spec, -IRI, +Context)[private]
Used for @href and @src attributes
Source safe_curie_or_curie_or_iri(+Spec, -IRI, +Context) is det[private]
Implement section 7.4, CURIE and IRI Processing. Used for @about and @resource
Source term_or_curie_or_absiri(+Spec, -IRI, +Context) is det[private]
Used for @datatype and @property, @typeof, @rel and @rev
Source term_iri(?Term, ?Markup, ?IRI)[private]
See also
- http://www.w3.org/2011/rdfa-context/xhtml-rdfa-1.1
Source term(-Term)//[private]
7.4.3
Source date_time_type(+DateTime, -DataType) is semidet[private]
True when DataType is the xsd type that matches the lexical representation of DateTime
Source add_triple(+Context, +S, +P, +O) is det[private]
Add a triple to the global evaluation context. Triples are embedded in a term, so we can use setarg/3 on the list, while the evaluation context is copied for descending the node hierarchy.
Source apply_patterns(+TriplesIn, -TriplesOut) is det[private]
Apply RDFa patterns. We need several passes do deal with ordering issues and the possibility that patterns are invalid:
  1. find patterns from rdf(_,rdfa:copy,Pattern)
  2. collect the properties for these patterns and delete patterns that do not have rdf:type rdfa:Pattern.
  3. Actually copy the patterns and delete the patterns themselves.
Source rdf_db:rdf_load_stream(+Format, +Stream, :Options)[multifile]
Register library(semweb/rdfa) as loader for HTML RDFa files.
To be done
- Which options need to be forwarded to read_rdfa/3?