z_rdf_props (zotonic_core v1.0.0-rc.17)

Extract properties from a compact RDF document encoded by zotonic_rdf.

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

Functions

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.

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.

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_values(V)

Map all values in the RDF doc to values we can handle in the system

mapping(Prop)

-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.

to_simple_value(V)

-spec to_simple_value(map()) -> error | term().

Translate the given value to a simpler value