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/
- 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.
- detect_bom(+In, +Close0, -Close) is det[private]
- We may be loading a binary stream. In that case we want to do
BOM detection.
- 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, ...)
- rdfa_evaluation_context(+DOM, -Context, +Options)[private]
- 7.5.0: Create the initial evaluation context
- To be done
- - : derive markup from DOM
- default_prefixes(+Markup, -Dict)[private]
- Create a default prefix map. Which prefixes are supposed to be
in this map?
- 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
- rdfa_local_context(EvalContext, LocalContext)[private]
- 7.5.1: Create the local context
- update_vocab(+DOM, +Context) is det[private]
- 7.5.2. Handle @vocab
- update_prefixes(+DOM, +Context) is det[private]
- 7.5.3: Update prefix map using @prefix and @xmlns. First
processes xmlns:Prefix=IRI.
- update_lang(+DOM, +Context) is det[private]
- 7.5.4: Update lang
- update_subject(+DOM, +Context) is det[private]
- 7.5.5 and 7.5.6: establish a value for new subject
- emit_typeof(+DOM, +LocalContext) is det[private]
- 7.5.7: emit triples for @typeof value.
- update_list_mapping(+DOM, +Context) is det[private]
- 7.5.8: Create a list mapping if appropriate
- empty_list_mapping(-Mapping) is det[private]
- empty_list_mapping(+Mapping) is semidet[private]
- get_list_mapping(+IRI, +Mapping, -List) is semidet[private]
- 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.
- step_7_5_9(+DOM, +Context)[private]
- step_7_5_10(+DOM, +Context)[private]
- Similar to step_7_5_9, but adding to incomplete triples.
- update_property_value(+DOM, +Context) is det[private]
- 7.5.11: establish current property value.
- complete_triples(+Context)[private]
- 7.5.12: Complete incomplete triples
- descent(DOM, Context)[private]
- 7.5.13: Descent into the children
- complete_lists(+Context) is det[private]
- 7.5.14: Complete possibly pending lists
- has_attribute(+Name, +Attrs, +Context) is semidet[private]
- 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.
- iri_attr(+AttName, +Attrs, -IRI, +Context) is semidet[private]
- 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.
- iri_list(+Spec, -IRIs, +Context) is det[private]
- True when IRIs is a list of fulfy qualified IRIs from Spec
- iri(+Spec, -IRI, +Context)[private]
- Used for @href and @src attributes
- 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
- term_or_curie_or_absiri(+Spec, -IRI, +Context) is det[private]
- Used for @datatype and @property, @typeof, @rel and @rev
- term_iri(?Term, ?Markup, ?IRI)[private]
-
- See also
- - http://www.w3.org/2011/rdfa-context/xhtml-rdfa-1.1
- term(-Term)//[private]
- 7.4.3
- date_time_type(+DateTime, -DataType) is semidet[private]
- True when DataType is the xsd type that matches the lexical
representation of DateTime
- 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.
- 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:
- find patterns from
rdf(_,rdfa:copy,Pattern)
- collect the properties for these patterns and delete
patterns that do not have rdf:type rdfa:Pattern.
- Actually copy the patterns and delete the patterns themselves.
- 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?