The task of this module is to do some simple manipulations on RDF graphs
represented as lists of
rdf(S,P,O). Supported operations:
- merge_sameas_graph(+GraphIn, -GraphOut, +Options)
- Merge nodes by owl:sameAs
- bagify_graph(+GraphIn, -GraphOut, -Bags, +Options)
- Bagify a graph, returning a new graph holding bags of resources playing a similar role in the graph.
- abstract_graph(+GraphIn, -GraphOut, +Options)
- Abstract nodes or edges using rdf:type, rdfs:subClassOf and/or rdfs:subPropertyOf
- merge_sameas_graph(GraphIn, GraphOut, +Options) is det
- Collapse nodes in GraphIn that are related through an identity
mapping. By default, owl:sameAs is the identity relation.
- Use an alternate or list of predicates that are to be treated as identity relations.
- Assoc from resources to the resource it was mapped to.
- bagify_graph(+GraphIn, -GraphOut, -Bags, +Options) is det
- If a graph contains multiple objects of the same type (class) in
the same location in the graph (i.e. all links are the same),
create a bag. The bag is represented by a generated resource
of type rdf:Bag and the RDF for the bags is put in Bags. I.e.
appending GraphOut and Bags provides a proper RDF model. Options
provides additional abstraction properties. In particular:
- Try to bundle objects under Class rather than their rdf:type. Multiple of these options may be defined
- Consider predicates that are an rdfs:subPropertyOf Property the same relations.
true(default), also try to put literals into a bag. Works well to collapse non-preferred labels.
- graph_resources(+Graph, -Resources:list(atom)) is det
- Resources is a sorted list of unique resources appearing in Graph. All resources are in Resources, regardless of the role played in the graph: node, edge (predicate) or type for a typed literal.
- graph_resources(+Graph, -Resources:list(atom), -Predicates:list(atom), -Types:list(atom)) is det
- Resources is a sorted list of unique resources appearing in Graph as subject or object of a triple. Predicates is a list of all unique predicates in Graph and Types is a list of all unique literal types in Graph.
- abstract_graph(+GraphIn, -GraphOut, +Options) is det
- Unify GraphOut with an abstracted version of GraphIn. The
abstraction is carried out triple-by-triple. Note there is no
need to abstract all triples to the same level. We do however
need to map nodes in the graph consistently. I.e. if we abstract
the object of
rdf(s,p,o), we must abstract the subject of
rdf(o, p2, o2)to the same resource.
If we want to do incremental growing we must keep track which nodes where mapped to which resources. Option?
We must also decide on the abstraction level for a node. This can be based on the weight in the search graph, the involved properties and focus such as location and time. Should we express this focus in the weight?
- If present, this is the initial resource abstraction map.
- Provide access to the final resource abstraction map.
- If provided, bagify the graph, returning the triples that define the bags in Bags. The full graph is created by appending Bags to GraphOut.
true(default), merge nodes of one is a super-concept of another.
- minimise_graph(+GraphIn, -GraphOut) is det
- Remove redudant triples from a graph. Redundant triples are
- Super-properties of another property
- Entailed transitive