Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
aMahanna committed Jan 23, 2024
1 parent ddc2edc commit c8a5e05
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 34 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ def beatles():
**Note**: RDF-to-ArangoDB functionality has been implemented using concepts described in the paper
*[Transforming RDF-star to Property Graphs: A Preliminary Analysis of Transformation Approaches](https://arxiv.org/abs/2210.05781)*. So we offer two transformation approaches:

1. RDF-Topology Preserving Transformation (RPT)
2. Property Graph Transformation (PGT)
1. [RDF-Topology Preserving Transformation (RPT)](https://arangordf.readthedocs.io/en/docs/rdf_to_arangodb_rpt.html)
2. [Property Graph Transformation (PGT)](https://arangordf.readthedocs.io/en/docs/rdf_to_arangodb_pgt.html)

```py
# 1. RDF-Topology Preserving Transformation (RPT)
Expand Down
10 changes: 6 additions & 4 deletions arango_rdf/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ class ArangoRDFController(AbstractArangoRDFController):
represents the RDF Resource in question. This local name will be
used as the ArangoDB Collection name that will store **rdf_resource**.
`Read more about how the ArangoDB Collection Mapping
Process works here <../html/mapping.html>`_.
`Read more about how the PGT ArangoDB Collection Mapping
Process works here
<../html/rdf_to_arangodb_pgt.html#arangodb-collection-mapping-process>`_.
"""

def __init__(self) -> None:
Expand All @@ -37,8 +38,9 @@ def identify_best_class(
"""Find the ideal RDFS Class among a selection of RDFS Classes. Essential
for the ArangoDB Collection Mapping Process used in RDF-to-ArangoDB (PGT).
`Read more about how the ArangoDB Collection Mapping
Process works here <../html/mapping.html>`_.
`Read more about how the PGT ArangoDB Collection Mapping
Process works here
<../html/rdf_to_arangodb_pgt.html#arangodb-collection-mapping-process>`_.
The "ideal RDFS Class" is defined as an RDFS Class whose local name best
represents the RDF Resource in question. This local name will be
Expand Down
28 changes: 13 additions & 15 deletions arango_rdf/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,12 +544,10 @@ def rdf_to_arangodb_by_rpt(
This method will store the RDF Resources of
**rdf_graph** under the following ArangoDB Collections:
```
"f{name}_URIRef" # Vertex collection for `rdflib.term.URIRef`.
"f{name}_BNode" # Vertex collection for`rdflib.term.BNode`.
"f{name}_Literal" # Vertex collection for `rdflib.term.Literal`.
"f{name}_Statement" # Edge collection for all triples/quads.
```
1. ``{Name}_URIRef``: Vertex collection for ``rdflib.term.URIRef`` resources.
2. ``{Name}_BNode``: Vertex collection for ``rdflib.term.BNode`` resources.
3. ``{Name}_Literal``: Vertex collection for ``rdflib.term.Literal`` resources.
4. ``{Name}_Statement``: Edge collection for all triples/quads.
:param name: The name of the RDF Graph
:type name: str
Expand Down Expand Up @@ -721,14 +719,16 @@ def rdf_to_arangodb_by_pgt(
the Property Graph Transformation (PGT) Algorithm.
PGT ensures that datatype property statements (i.e statements whose
objects are Literals) are mapped to document properties in the Property Graph.
`Learn more about PGT here <../html/pgt.html>`_.
objects are Literals) are mapped to document properties in the
Property Graph. `Learn more about PGT here
<../html/rdf_to_arangodb_pgt.html>`_.
Contrary to RPT, this method will rely on
the nature of the RDF Resource/Statement to determine which ArangoDB
Collection it belongs to. This process is referred to as the
ArangoDB Collection Mapping Process. `Learn more about the ArangoDB
Collection Mapping Process here <../html/mapping.html>`_.
ArangoDB Collection Mapping Process. `Learn more about the PGT ArangoDB
Collection Mapping Process here
<../html/rdf_to_arangodb_pgt.html#arangodb-collection-mapping-process>`_.
Contrary to RPT, regardless of whether **contextualize_graph** is set to
True or not, all RDF Predicates within every RDF Statement in **rdf_graph**
Expand Down Expand Up @@ -765,9 +765,6 @@ def rdf_to_arangodb_by_pgt(
1) Loading Meta Ontologies (i.e OWL, RDF, RDFS, etc.) into the RDF Graph
2) Providing Domain & Range Inference
3) Providing Domain & Range Introspection
`Learn more about Graph Contextualization
here <../html/contextualization.html>`_.
:type contextualize_graph: bool
:param flatten_reified_triples: If set to False, will preserve the RDF
structure of any Reified Triple. If set to True, will "flatten" any reified
Expand Down Expand Up @@ -959,8 +956,9 @@ def write_adb_col_statements(
The PGT Algorithm relies on the ArangoDB Collection Mapping Process to
identify the ArangoDB Collection of every RDF Resource. Using this method prior
to running :func:`rdf_to_arangodb_by_pgt` allows you to visualize and
modify the mapping. `Learn more about the ArangoDB Collection Mapping
Process here <../html/mapping.html>`_.
modify the mapping. `Learn more about the PGT ArangoDB
Collection Mapping Process here
<../html/rdf_to_arangodb_pgt.html#arangodb-collection-mapping-process>`_.
NOTE: Running this method prior to :func:`rdf_to_arangodb_by_pgt`
is unnecessary if the user is not interested in
Expand Down
26 changes: 16 additions & 10 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,34 @@ Quickstart

.. code-block:: python
# pip install arango-datasets
from arango_datasets import Datasets
name = "OPEN_INTELLIGENCE_ANGOLA"
Datasets(db).load(name)
# 1. Graph to RDF
rdf_graph = adbrdf.arangodb_graph_to_rdf(name="BeatlesRPT", rdf_graph=Graph())
rdf_graph = adbrdf.arangodb_graph_to_rdf(name, rdf_graph=Graph())
# 2. Collections to RDF
rdf_graph_2 = adbrdf.arangodb_collections_to_rdf(
name="BeatlesRPT",
name,
rdf_graph=Graph(),
v_cols={"BeatlesRPT_URIRef", "BeatlesRPT_Literal", "BeatlesRPT_BNode"},
e_cols={"BeatlesRPT_Statement"}
v_cols={"Event", "Actor", "Source"},
e_cols={"eventActor", "hasSource"},
)
# 3. Metagraph to RDF
rdf_graph_3 = adbrdf.arangodb_to_rdf(
name="BeatlesPGT",
name=name,
rdf_graph=Graph(),
metagraph={
"vertexCollections": {
"Album": {"name", "date"},
"SoloArtist": {}
"Event": {"date", "description", "fatalities"},
"Actor": {"name"}
},
"edgeCollections": {
"artist": {}
}
}
"eventActor": {}
},
},
)
4 changes: 2 additions & 2 deletions docs/rdf_to_arangodb_pgt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ collection for that Resource.
We are welcome to suggestions on how to improve the ArangoDB Collection Mapping Process for PGT,
as we understand that it is not perfect.

Consider overriding the `ArangoRDFController <./specs.html#arango_rdf.controller.ArangoRDFController>`` Class
Consider overriding the `ArangoRDFController <./specs.html#arango_rdf.controller.ArangoRDFController>`_ Class
to implement your own ArangoDB Collection Mapping Process for PGT.

Supported Cases
Expand All @@ -228,7 +228,7 @@ test cases range from simple RDF Graphs to complex RDF-star Graphs.
ArangoRDF's PGT interface can be observed `here <./specs.html#arango_rdf.main.ArangoRDF.rdf_to_arangodb_by_pgt>`_.

`View how ArangoRDF's PGT transformation approach performs on these test cases in
Colab <https://colab.research.google.com/github/ArangoDB-Community/ArangoRDF/blob/main/examples/ArangoRDF.ipynb#scrollTo=mRutdKii-Pk5>`_.
Colab <https://colab.research.google.com/github/ArangoDB-Community/ArangoRDF/blob/main/examples/ArangoRDF.ipynb#scrollTo=cy_BWXK2AX5n>`_.

.. image:: _static/cases.png
:width: 500px
Expand Down
2 changes: 1 addition & 1 deletion docs/rdf_to_arangodb_rpt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ test cases range from simple RDF Graphs to complex RDF-star Graphs.
ArangoRDF's RPT interface can be observed `here <./specs.html#arango_rdf.main.ArangoRDF.rdf_to_arangodb_by_rpt>`_.

`View how ArangoRDF's RPT transformation approach performs on these test cases in
Colab <https://colab.research.google.com/github/ArangoDB-Community/ArangoRDF/blob/main/examples/ArangoRDF.ipynb#scrollTo=mRutdKii-Pk5>`_.
Colab <https://colab.research.google.com/github/ArangoDB-Community/ArangoRDF/blob/main/examples/ArangoRDF.ipynb#scrollTo=cy_BWXK2AX5n>`_.

.. image:: _static/cases.png
:width: 500px
Expand Down

0 comments on commit c8a5e05

Please sign in to comment.