z_rdf_props (zotonic_core v1.0.0-rc.14)

Extract properties from a compact RDF document encoded by zotonic_rdf.

Link to this section Summary

Functions

Extract standard Zotonic edges from an RDF document. The document is a "compact" document returned by zotonic_rdf. This collects the @id attributes in the top-level predicates of the document.
Extract standard Zotonic properties from an RDF document. The document is a "compact" document returned by zotonic_rdf. All predicates in the document are of the form "namespace:term", for example: "dc:title". The namespaces are the ones defined in zotonic_rdf.
Extract standard Zotonic src import from an RDF document. The document is a "compact" document returned by zotonic_rdf.
Map all values in the RDF doc to values we can handle in the system
Check if a property can be mapped to a standard property. This is used in m_rsc:p/3 for fetching namespaced properties.
Translate the given value to a simpler value

Link to this section Functions

Link to this function

extract_edges(RDFDoc, Context)

-spec extract_edges(RDFDoc, Context) -> Edges
                 when
                     RDFDoc :: map(),
                     Edges :: #{Predicate := [Edge]},
                     Predicate :: binary(),
                     Edge :: map(),
                     Context :: z:context().
Extract standard Zotonic edges from an RDF document. The document is a "compact" document returned by zotonic_rdf. This collects the @id attributes in the top-level predicates of the document.
Link to this function

extract_props(RDFDoc)

-spec extract_props(RDFDoc) -> Props when RDFDoc :: map(), Props :: map().
Extract standard Zotonic properties from an RDF document. The document is a "compact" document returned by zotonic_rdf. All predicates in the document are of the form "namespace:term", for example: "dc:title". The namespaces are the ones defined in zotonic_rdf.
Link to this function

extract_resource(RDFDoc, Context)

-spec extract_resource(RDFDoc, z:context()) -> {ok, Import} | {error, term()}
                    when RDFDoc :: map(), Import :: map().
Extract standard Zotonic src import from an RDF document. The document is a "compact" document returned by zotonic_rdf.
Map all values in the RDF doc to values we can handle in the system
-spec mapping(binary()) -> binary() | undefined.
Check if a property can be mapped to a standard property. This is used in m_rsc:p/3 for fetching namespaced properties.
Link to this function

to_simple_value(V)

-spec to_simple_value(map()) -> error | term().
Translate the given value to a simpler value