dmaog

Data Mapping Access Objects Generator

https://github.com/herminiogg/dmaog

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.8%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Data Mapping Access Objects Generator

Basic Info
Statistics
  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • Open Issues: 4
  • Releases: 6
Created over 4 years ago · Last pushed 10 months ago
Metadata Files
Readme License Citation Codemeta

README.md

Data Mapping Access Objects Generator (DMAOG)

Main build Maven Central DOI SWH

DMAOG is a library that allows to use data mapping rules to automatically generate code to access the data generated from these mapping rules. In this way a developer only has to write the mapping rules to generate a Knowledge Graph, then DMAOG will apply the mapping rules and generate the data access code necessary to query them. Additionally, DMAOG can take care of the data changes – and reapplying mapping rules – as a background task.

How it works

DMAOG is able to run mapping rules in ShExML and RML. After applying the mapping rules the data is explored through SPARQL queries in order to get the details of each type. It is important to remark that every desired data object to be generated must contain a type declaration in the form of :subject a :type. From the analysis DMAOG builds a set of Java classes that compounds the Data Access layer for the data generated by the mapping rules. This layer can be used in any Java-based project that uses DMAOG as a dependency. When accessing the data, DMAOG relies on reflection techniques to create and populate the objects that are then returned to the user through the created data access layer.

How to start

The DMAOG library is composed of two different entry points that are intended for the two steps described earlier: code generation and data access. The CLI is intended for the code generation from the command line in an easy and consistent way. Data access layer is used by the generated code to effectively encapsulate data query.

As an example we can use the mapping rules hosted in this project under the films.shexml file to generate the data access layer with the following command (see the CLI section to get further details about the configuration possibilities): $ java -jar dmaog.jar -m films.shexml -o . -p com.herminiogarcia.dmaog This command will create the following files: Actor.java, Film.java, ActorService.java, FilmService.java and DataAccessSingleton.java. Inside DataAccessSingleton.java all the configuration parameters can be set up. Then the services can be directly used, for example: new FilmService().getAll(); and the methods will return the results encapsulated in the generated DTO objects. To see all the methods supported by the services take a look to the "Supported methos in services" section.

CLI

``` Usage: dmaog [-hV] [--static] [-d=] [-dr=] [-m=] [-ml=] -o= -p= [-ps=] [-se=] [-sep=] [-seu=] [-sl=] [-u=] Generate data access objects and services from your mapping rules. -d, --datafile= Path where the datafile is located if no mapping rules are provided. -dr, --drivers= Drivers string in case it is not included in ShExML -h, --help Show this help message and exit. -m, --mapping= Path to the file with the mappings -ml, --mappingLanguage= Mapping language to use: ShExML or RML -o, --output= Path where to generate the output files -p, --package= Package information for the generated files -ps, --password= Password in case of database connection -se, --sparqlEndpoint= URL pointing to the SPARQL endpoint -sep, --sparqlEndpointPassword= Password for the SPARQL endpoint -seu, --sparqlEndpointUsername= Username for the SPARQL endpoint -sl, --sparqlQueryLimit= Limit the amount of requested results by adding a LIMIT x statement to the queries. This could limit performance issues when dealing with big graphs

  --static    Exploit mapping rules without executing them

-u, --username= Username in case of database connection -V, --version Print version information and exit.

```

Supported features

  • Generation of data against files and SPARQL endpoints
  • Using already existing data files and SPARQL endpoints without mapping rules
  • Update actions on files and SPARQL endpoints (authentication included)
  • Static analysis of ShExML rules (not need to run the mapping rules to generate classes)
  • Multilingual strings
  • Pagination of the results

Supported methods in services

  • getAll(): List[Type] -> Returns all the results for the type
  • getAll(Long limit, Long offset): List[Type] -> Returns all the results for the type within the given page
  • getAll(String rdfFormat): String -> Returns all the results in the requested format
  • count(): Long -> Returns the total number of objects of this type
  • getById(String id): Type -> Return the object with the given id for the type. Take into account that the id is refering to the local part of the subject URI when talking about RDF data.
  • getById(String id, String rdfFormat): String -> Return the object with the given id in the requested format.
  • getByField(String fieldName, String value): List -> Return all the results whose indicated field value matches with the given value. Take into account that the fieldName refers to the localPart of the predicate URI when talking about RDF data.
  • getByField(String fieldName, String value, String rdfFormat): String -> Return all the results whose indicated field value matches with the given value in the requested format.
  • commit(Type instance) -> Deletes the instance (if it exists) in the data store and inserts the new data. It can act as create or update method.
  • delete(Type instance) -> Deletes the instance in the data store.

Requirements

The minimal versions for this software to work are: - JDK 8 (or the Open JDK 8) - Scala 2.12.17 - SBT 1.7.2

Webpage

A live playground is also offered online (https://dmaog.herminiogarcia.com). However, due to hardware limitations it is not intended for intensive use.

Build

The library uses sbt as the package manager and building tool, therefore to compile the project you can use the following command: $ sbt compile To run the project from within sbt you can use the command below, where <options> can be replaced by the arguments explained in the CLI $ sbt "run <options>" To generate an executable JAR file you can call the following command. Take into account that if you want to test the library before generating the artifact you need to set up the testing environment as explained in the Testing section and omit the "set test in assembly := {}" option from the command. $ sbt "set test in assembly := {}" clean update assembly

Testing

The project contains a full suite of tests that checks that all the features included in the engine work as expected. These tests units are included under the src/test/scala folder. To run them you can use the command below. Notice that it is of utmost importance to test that the project pass the tests for all the cross-compiled versions used within the project (see the Cross-compilation section for more details.) $ sbt test The test environment uses some external resources that need to be set up before running them which mainly involves starting and configuring a triple store. This process is described on the Github workflow file.

Cross-compilation

The project is enabled to work with three different versions of Scala (i.e., 2.12.x, 2.13.x and 3.x) so it can be used across different Scala environments. Therefore, all the commands will work by default with the 3.x version but it is possible to run the same command for all the versions at the same time or just for one specific version. Below you can see how to do so with the test command.

Testing against all the cross-compiled versions: $ sbt "+ test"

Testing against a specific version where is one of the configured versions in the build.sbt file: $ sbt "++<version> test"

Dependencies

The following dependencies are used by this library:

| Dependency | License | |----------------------------------------------|-----------------------------------------| | org.apache.jena / jena-base | Apache License 2.0 | | org.apache.jena / jena-core | Apache License 2.0 | | org.apache.jena / jena-arq | Apache License 2.0 | | info.picocli / picocli | Apache License 2.0 | | be.ugent.rml / rmlmapper | MIT License | | com.herminiogarcia / shexml | MIT License | | com.typesafe.scala-logging / scala-logging | Eclipse Public License v1.0 or LGPL-2.1 | | ch.qos.logback / logback-classic | Eclipse Public License v1.0 or LGPL-2.1 |

For performing a more exhaustive licenses check, including subdependecies and testing ones the sbt-license-report plugin is included in the project, enabling the generation of a report with the command: $ sbt dumpLicenseReport The results are available, after the execution of this command, under the directory target/license-reports.

Future work

  • Handling Blank Nodes
  • Possibility to use Shapes for code generation
  • Static analysis of RML rules

Owner

  • Name: Herminio García González
  • Login: herminiogg
  • Kind: user
  • Location: Brussels, Belgium
  • Company: Kazerne Dossin

Citation (CITATION.cff)

cff-version: 1.2.0
title: DMAOG
type: software
authors:
  - given-names: Herminio
    family-names: García-González
    affiliation: Kazerne Dossin
    orcid: 'https://orcid.org/0000-0001-5590-4857'
identifiers:
  - type: url
    value: 'https://dmaog.herminiogarcia.com/'
    description: Main webpage
  - type: doi
    value: 10.5281/zenodo.12782289
    description: Zenodo's DOI
  - type: swh
    value: 'swh:1:rev:69a34da6a681bbeda6de60faa5b2fa2893c8ace0'
    description: Version 0.1.5 release
repository-code: 'https://github.com/herminiogg/dmaog'
url: 'https://dmaog.herminiogarcia.com/'
abstract: >-
  DMAOG is a library that allows to use data mapping rules to automatically generate code to access the data generated
  from these mapping rules. In this way a developer only has to write the mapping rules to generate a Knowledge Graph,
  then DMAOG will apply the mapping rules and generate the data access code necessary to query them. Additionally,
  DMAOG can take care of the data changes – and reapplying mapping rules – as a background task.
license: MIT

CodeMeta (codemeta.json)

{
  "@context": {
    "@vocab": "https://w3id.org/codemeta/3.0/",
    "schema": "http://schema.org/",
    "id": "@id",
    "type": "@type",
    "identifier": {
      "@type": "@id"
    },
    "codeRepository": {
      "@type": "@id"
    },
    "issueTracker": {
      "@type": "@id"
    },
    "downloadUrl": {
      "@type": "@id"
    },
    "license": {
      "@type": "@id"
    },
    "schema:author": {
      "@type": "@id"
    },
    "referencePublication": {
      "@type": "@id"
    }
  },
  "id": "https://github.com/herminiogg/dmaog",
  "type": "SoftwareSourceCode",
  "applicationCategory": "Computer Science",
  "author": [
    {
      "id": "https://herminiogarcia.com/#me",
      "type": "Person",
      "affiliation": {
        "id": "https://kazernedossin.eu/en",
        "type": "Organization",
        "name": "Kazerne Dossin"
      },
      "email": "herminio.garciagonzalez@kazernedossin.eu",
      "familyName": "Garca Gonzlez",
      "givenName": "Herminio",
      "identifier": "https://orcid.org/0000-0001-5590-4857"
    },
    {
      "type": "Role",
      "schema:author": "https://herminiogarcia.com/#me",
      "roleName": "Main author"
    }
  ],
  "codeRepository": "https://github.com/herminiogg/dmaog",
  "dateCreated": "2021-11-24",
  "description": "Data Mapping Access Objects Generator",
  "developmentStatus": "active",
  "downloadUrl": "https://api.github.com/repos/herminiogg/dmaog/downloads",
  "identifier": "https://doi.org/10.5281/zenodo.12782290",
  "issueTracker": "https://api.github.com/repos/herminiogg/dmaog/issues",
  "license": "https://api.github.com/licenses/mit",
  "name": "DMAOG",
  "programmingLanguage": "Scala",
  "runtimePlatform": "JVM",
  "softwareRequirements": [
    {
      "id": "http://example.org/jena-base",
      "type": "SoftwareSourceCode",
      "name": "org.apache.jena:jena-base",
      "version": "3.8.0"
    },
    {
      "id": "http://example.org/rmlmapper",
      "type": "SoftwareSourceCode",
      "name": "be.ugent.rml:rmlmapper",
      "version": "4.9.0"
    },
    {
      "id": "http://example.org/jena-core",
      "type": "SoftwareSourceCode",
      "name": "org.apache.jena:jena-core",
      "version": "3.8.0"
    },
    {
      "id": "http://example.org/scala-logging_3",
      "type": "SoftwareSourceCode",
      "name": "com.typesafe.scala-logging:scala-logging_3",
      "version": "3.9.5"
    },
    {
      "id": "http://example.org/scalatest_3",
      "type": "SoftwareSourceCode",
      "name": "org.scalatest:scalatest_3",
      "version": "3.2.9"
    },
    {
      "id": "http://example.org/scala3-library_3",
      "type": "SoftwareSourceCode",
      "name": "org.scala-lang:scala3-library_3",
      "version": "3.2.0"
    },
    {
      "id": "http://example.org/logback-classic",
      "type": "SoftwareSourceCode",
      "name": "ch.qos.logback:logback-classic",
      "version": "1.3.5"
    },
    {
      "id": "http://example.org/jena-arq",
      "type": "SoftwareSourceCode",
      "name": "org.apache.jena:jena-arq",
      "version": "3.8.0"
    },
    {
      "id": "http://example.org/shexml_3",
      "type": "SoftwareSourceCode",
      "name": "com.herminiogarcia:shexml_3",
      "version": "0.4.0"
    },
    {
      "id": "http://example.org/picocli",
      "type": "SoftwareSourceCode",
      "name": "info.picocli:picocli",
      "version": "4.0.4"
    }
  ],
  "version": "0.1.5"
}

GitHub Events

Total
  • Push event: 3
  • Pull request event: 2
  • Create event: 1
Last Year
  • Push event: 3
  • Pull request event: 2
  • Create event: 1

Issues and Pull Requests

Last synced: almost 3 years ago

All Time
  • Total issues: 21
  • Total pull requests: 22
  • Average time to close issues: 25 days
  • Average time to close pull requests: 2 minutes
  • Total issue authors: 1
  • Total pull request authors: 1
  • Average comments per issue: 0.1
  • Average comments per pull request: 0.0
  • Merged pull requests: 22
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 15
  • Pull requests: 19
  • Average time to close issues: 16 days
  • Average time to close pull requests: 1 minute
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.13
  • Average comments per pull request: 0.0
  • Merged pull requests: 19
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • herminiogg (21)
Pull Request Authors
  • herminiogg (21)
Top Labels
Issue Labels
enhancement (17) bug (2)
Pull Request Labels

Packages

  • Total packages: 3
  • Total downloads: unknown
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 1
    (may contain duplicates)
  • Total versions: 14
repo1.maven.org: com.herminiogarcia:dmaog_2.13

Data Mapping Access Objects Generator (DMAOG)

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 32.0%
Forks count: 39.8%
Average: 40.7%
Stargazers count: 42.3%
Dependent packages count: 48.9%
Last synced: 7 months ago
repo1.maven.org: com.herminiogarcia:dmaog_2.12

Data Mapping Access Objects Generator (DMAOG)

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 32.0%
Forks count: 39.8%
Average: 40.7%
Stargazers count: 42.3%
Dependent packages count: 48.9%
Last synced: 6 months ago
repo1.maven.org: com.herminiogarcia:dmaog_3

Data Mapping Access Objects Generator (DMAOG)

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 1
Rankings
Dependent repos count: 20.8%
Average: 48.1%
Dependent packages count: 50.1%
Forks count: 58.7%
Stargazers count: 62.8%
Last synced: 7 months ago

Dependencies

.github/workflows/scala.yml actions
  • actions/checkout v2 composite
  • actions/setup-java v2 composite