Code Monkey home page Code Monkey logo

olga's Introduction

Build Status GitHub stars HitCount

OLGA: an Ontology SDK

Welcome !

OLGA (Ontology Library GenerAtor) is a generic tool aiming to accelerate the adoption of Standard W3C Semantic technology among developers.

OLGA provides a better development experience by focusing on:

  • Reducing friction barrier for developers when working with an ontology model.

  • Accelerating development of ontology based systems.

  • Eliminating complexity by providing Object Oriented libraries for developers.

OLGA is based on a model driven approach taking as input an ontology file expressed in one of the supported W3C supported standards (RDF, OWL) and generating a library conform to the ontology model.

The generated library is then imported and used to programmatically to:

  1. Generate an ontology instance conform to the ontology model.
  2. Query the generated ontology instance by relying on Object Oriented Model instead of SPARQL.

OLGA is licensed under the MIT License. Schneider Electric requests contributions to be provided back to benefit the community.

Getting Started

To get started with OLGA, please check the following resources:

Docker

You can build a docker image for hosting the OLGA web service.

To build a new image, run the following command:

$ ./build-docker-image.sh

There are various environment variable you can set for the build script:

Environment Variable Default Value Description
OLGA_REPO_URL https://github.com/EcoStruxure/OLGA.git OLGA Source Code Repo
OLGA_GIT_BRANCH master Git branch in source repo to use when cloning OLGA repo
OLGA_PROJECT_NAME OLGA Project name, used by the Dockerfile to generate artifact paths
OLGA_SUBPROJECTS OLGA-Core,OLGA-Ws What subprojects we want to build
OLGA_ARTIFACT_ID OLGA-Ws Maven Artifact ID, used by Dockerfile to generate artifact paths
OLGA_VERSION 0.0.6 OLGA Version
OLGA_DOCKER_TAG ecostruxure/olga:latest Docker tag for image

N.B. the build script skips the tests.

To run the resulting image, run the following command:

$ ./docker-run.sh

There is a environment variable you can set for the run script:

Environment Variable Default Value Description
OLGA_DOCKER_TAG ecostruxure/olga:latest Docker tag for image

You can access the web service at http://localhost:9090

An additional script, docker-cleanup.sh is included to cleanup intermediate docker images created by the build script.

olga's People

Contributors

albertadrous avatar charbull avatar joephayes avatar radissoa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

olga's Issues

Not able to generate code for GoogleDigitalBuildings RDF file and latest OLGA SDK

Compilation fails for Java code generated using the OLGA SDK

Steps to reproduce the behavior:
Download the digital_buildings rdf file from the digital buildings repo.
ZIP the OLGA Repo Master branch.
install the CORE and CLI packages,

java -jar OLGA-Cli/target/OLGA-Cli-0.0.6-with-dependencies.jar --code java --library rdf4j --name DigitalBuildings --path digital_buildings.rdf

I get the following error
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project digitalbuildings-RDF4J: Compilation failure: Compilation failure:
[ERROR] /E:/OLGA-master/OLGA-master/OLGA/OLGA/generated/digitalbuildings-RDF4J-java/src/main/java/digitalbuildings/rdf/model/Ahu_bspc_dx4sc_econm_efss_efvsc_oafmc_sfss_sfvsc_sspc.java:[64,17] method addUsesOptionalsEconomizer_mode(digitalbuildings.rdf.model.IEconomizer_mode) is already defined in class digitalbuildings.rdf.model.Ahu_bspc_dx4sc_econm_efss_efvsc_oafmc_sfss_sfvsc_sspc

This comes for a lot of classes
Please Help

Docker Image

It would be very helpful to have a working Docker image which has the HTTP API enabled. That would make it much easier for us to use OLGA as a generator in our ontology platform 'modom.io'.

Building Docker with OLGA failes due to missing file or wrong directory

Describe the bug
When trying to built the docker following this example, step 27/30 fails.

To Reproduce
Steps to reproduce the behavior:

  1. Try to built the logger with the made settings.
% ./build-docker-image.sh
Using https://github.com/EcoStruxure/OLGA.git as git repo URL
Using master as git branch
Using OLGA as project
Using OLGA-Core,OLGA-Ws as subprojects
Using OLGA-Ws as Maven artifact ID
Using 0.0.5 as version
Using ecostruxure/olga:latest as the Docker tag
Sending build context to Docker daemon  3.584kB
Step 1/30 : FROM alpine/git as clone
 ---> 8f5f87e1dbac
Step 2/30 : ARG url
 ---> Using cache
 ---> af5efd494ea7
Step 3/30 : ARG branch
 ---> Using cache
 ---> 98dc352216ea
Step 4/30 : WORKDIR /app
 ---> Using cache
 ---> 4570109b47ff
Step 5/30 : RUN git clone -b ${branch} --single-branch ${url}
 ---> Using cache
 ---> e0520e2dc2a7
Step 6/30 : FROM maven:3.5-jdk-8-alpine as build
 ---> fb4bb0d89941
Step 7/30 : ARG project
 ---> Using cache
 ---> aeba4bf3d4f8
Step 8/30 : ARG subprojects
 ---> Using cache
 ---> 202620a431b2
Step 9/30 : WORKDIR /app
 ---> Using cache
 ---> 5e3e3bfbbe92
Step 10/30 : COPY --from=clone /app/${project} /app
 ---> Using cache
 ---> d5bcb57a8d71
Step 11/30 : WORKDIR /app/${project}
 ---> Using cache
 ---> ad0c768b884a
Step 12/30 : RUN mvn --projects ${subprojects} clean install -DskipTests
 ---> Using cache
 ---> 6c57ef6d40b4
Step 13/30 : FROM maven:3.5-jdk-8-alpine
 ---> fb4bb0d89941
Step 14/30 : ARG project
 ---> Using cache
 ---> aeba4bf3d4f8
Step 15/30 : ARG artifactid
 ---> Using cache
 ---> 3885bc681dc2
Step 16/30 : ARG version
 ---> Using cache
 ---> 0017c7c1897d
Step 17/30 : ENV artifact ${artifactid}-${version}-with-dependencies.jar
 ---> Using cache
 ---> fcfb5af4fe3c
Step 18/30 : ENV M2_HOME ${MAVEN_HOME}
 ---> Using cache
 ---> e88f4af25cd3
Step 19/30 : ARG REPO=mcr.microsoft.com/dotnet/core/runtime-deps
 ---> Using cache
 ---> 42d1902900f0
Step 20/30 : RUN apk add --no-cache icu-libs openssl-dev
 ---> Using cache
 ---> 432729cb87cc
Step 21/30 : ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false     LC_ALL=en_US.UTF-8     LANG=en_US.UTF-8
 ---> Using cache
 ---> 2ec1b2f24ffe
Step 22/30 : ENV DOTNET_SDK_VERSION 2.1.607
 ---> Using cache
 ---> 6944623b6da3
Step 23/30 : RUN wget -O dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-musl-x64.tar.gz     && dotnet_sha512='61caf6602b8a2aa89769b3e91ddaec963d8ab9f802cd7f6c6da4f02426358712bc2bb0930e7ee3a81d75c7607039543b554cb8ed50e45610655f9e91ed0f2f17'     && echo "$dotnet_sha512  dotnet.tar.gz" | sha512sum -c -     && mkdir -p /usr/share/dotnet     && tar -C /usr/share/dotnet -xzf dotnet.tar.gz     && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet     && rm dotnet.tar.gz
 ---> Using cache
 ---> 26df7bcc17d7
Step 24/30 : ENV DOTNET_USE_POLLING_FILE_WATCHER=true     NUGET_XMLDOC_MODE=skip
 ---> Using cache
 ---> b6972fd69e7f
Step 25/30 : RUN dotnet help
 ---> Using cache
 ---> 1e1ac47645cc
Step 26/30 : WORKDIR /app
 ---> Using cache
 ---> d1b6538e6ae4
Step 27/30 : COPY --from=build /app/${project}/${artifactid}/target/${artifact} /app
COPY failed: stat /var/lib/docker/overlay2/599d6faae67bccbef0c845ae0404d8ca76feea148940b305da03c788e46592b2/merged/app/OLGA/OLGA-Ws/target/OLGA-Ws-0.0.5-with-dependencies.jar: no such file or directory

Expected Behaviour:
Building of the docker is successful.

OS:
Ubuntu GNU/Linux 18.04 LTS

Swagger API documentation is not working

Describe the bug
Swagger documentation URL - http://localhost:9090/Ontology/OLGAsaas/1.0.0/1.0/ does not display API documentation, instead it display the string redirect:swagger-ui.html

To Reproduce
Steps to reproduce the behavior:

  1. Build and Run OLGA web service according to the instructions found in the Webservice User Guide
  2. Try to access the API documentation using the URL http://localhost:9090/Ontology/OLGAsaas/1.0.0/1.0/

Instead of seeing API documentation I see a page with the text: redirect:swagger-ui.html. If I go directly to http://localhost:9090/Ontology/OLGAsaas/1.0.0/1.0/swagger-ui.html I get the documentation UI, but I get a dialog prompting me for the API's base URL.

Also note that the web service readme gives the wrong URL for the API documentation (http://localhost:9090/ instead of http://localhost:9090/Ontology/OLGAsaas/1.0.0/1.0/)

Expected behavior
Browser should redirect to API documentation

Screenshots

Screen Shot 2020-01-09 at 2 56 49 PM.

Screen Shot 2020-01-09 at 3 33 01 PM

Desktop (please complete the following information):

  • OS: MacOS Mojave 10.14.6

  • Browser Firefox

  • Version 71.0 (64 bit)

  • Browser Chrome

  • Version 79.0.3945.117 (Official Build) (64-bit)

rdfs:Datatype not properly handled

Describe the bug
rdfs:Datatype is not handled. OLGA considers it as a class to generate with the superclass rdfs:Literal. But OLGA prevents classes from rdfs: to be generated see here. Hence the superclass of the rdfs:Datatype is not generated which causes a compile error.

To Reproduce
Steps to reproduce the behavior:
Execute OLGAJavaTest#testSarefMerged junit test

Expected behavior
The generated code should compile.

Jsonld file is not created

I have used digital building example code and create java library. mvn build worked and I was able use this library in my new maven project. After ruuning the code with Rio.write(GLOBAL.model, System.out, RDFFormat.TURTLE);build was successful. But I am not getting any out jsonld file as an output.

Error
Caused by: java.lang.NoClassDefFoundError: www/google/com/digitalbuildings/_0_0_1/facilities/IFloor

Unable to generate code for Brick Ontology v1.2.0

Describe the bug
I am trying to generate POCO/POJO classes for Brick ontology v1.2.0 but the OLGA CLI generate throws an error about Invalid class name for both C3 and Java code gen.
The Error happens because BRICK has some classes which contain '.' e.g. PM2.5_Concentration. This interferes with Class naming convention of .Net and Java.
Visitor.IsValidToken() returns false and the codegen fails for such classes.

To Reproduce
Steps to reproduce the behavior:

  1. Download the latest brick.ttl file(v1.2.0) from https://brickschema.org/schema/1.2.0/Brick.ttl
  2. Installed OLGA (v0.0.6) from https://github.com/EcoStruxure/OLGA
  3. To Generate the code from the file this is the command that I use.
    java -jar OLGA-Cli/target/OLGA-Cli-0.0.6-with-dependencies.jar --code java --library rdf4j --name BrickSchemaClasses --path Brick.ttl --out .

I see the following error

2021-06-28 20:20:08 ERROR OLGA:90 - semanticstore.ontology.library.generator.exceptions.InvalidClassNameException: PM2.5_Concentration Invalid class name, it doesn't follow the convention. PM2.5_Concentration Invalid class name, it doesn't follow the convention. **

Expected behavior
The POCO/POJO classes should be generated for the Brick ontology (since the documentation mentions that it has been tested against Brick (maybe a previous version).

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Chrome
  • Version 91.0.4472.124

Add Turtle support to OLGA web service

Add turtle file support to the OLGA web service (CLI already supports turtle files)

Currently when I try to submit a turtle file to the web service I get the following error:

{
    "timestamp": "2020-01-28T16:07:53.065Z",
    "status": 415,
    "error": "Unsupported Media Type",
    "exception": "org.springframework.web.HttpMediaTypeNotSupportedException",
    "message": "Content type 'text/turtle' not supported",
    "path": "/Ontology/OLGAsaas/1.0.0/1.0/generate"
}

Unable to generate jar file for Fiesta-iot ontology

Facing Compilation error while trying to generate jar file for fiesta ontology using OLGA

Steps to reproduce the behavior:

  1. Download fiesta-iot.owl from https://github.com/fiesta-iot/ontology
  2. Download and Unzip the OLGA Repo Master branch.
  3. Install the CORE and CLI packages,

Open command prompt from OLGA folder and give this command
java -jar OLGA-Cli/target/OLGA-Cli-0.0.6-with-dependencies.jar --code java --library rdf4j --name Fiesta --path OLGA-Cli/target/fiesta-iot.owl

I get the following error
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /G:/OLGA-master/OLGA-master/OLGA/fiesta-RDF4J-java/src/main/java/fiesta/rdf/model/Metadata.java:[17,8] class MetaData is public, should be declared in a file named MetaData.java
[ERROR] /G:/OLGA-master/OLGA-master/OLGA/fiesta-RDF4J-java/src/main/java/fiesta/rdf/model/IMetadata.java:[9,8] interface IMetaData is public, should be declared in a file named IMetaData.java
[INFO] 2 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

Could someone please take a look on this and provide solution as soon as possible, it will be very much helpful.
Thanks in advance.

When running tests, NullPointerException is thrown from OWL manager method loadOntologyFromOntologyDocument

Describe the bug
When running tests on master branch, NullPointerException is thrown from OWL manager method loadOntologyFromOntologyDocument

To Reproduce
Steps to reproduce the behavior:

  1. Run the following command: mvn clean install --projects OLGA-Core

Expected behavior
All tests pass.

Actual behavior
Several tests fail with a NullPointerException thrown by the call to loadOntologyFromOntologyDocument. For example,

[INFO] Running semanticstore.ontology.library.generator.visitor.OLGAVisitorDSPTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.002 s <<< FAILURE! - in semanticstore.ontology.library.generator.visitor.OLGAVisitorDSPTest
[ERROR] semanticstore.ontology.library.generator.visitor.OLGAVisitorDSPTest  Time elapsed: 0.002 s  <<< ERROR!
java.lang.NullPointerException
        at semanticstore.ontology.library.generator.visitor.OLGAVisitorDSPTest.setUpBeforeClass(OLGAVisitorDSPTest.java:238)

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: MacOS, version 10.14.6, OpenJDK 1.8.0_232
  • Browser n/a
  • Version n/a

Additional context
I had to add the following exclusion to the maven-invoker-plugin in OLGA-Core pom.xml:

<exclusion>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-jdk14</artifactId>
</exclusion>

Generation does not work using docker container.

Describe the bug
The generation does not seem to run using service through the docker image.
Response is:

{
  "content-disposition": "attachment;filename=test.zip",
  "content-length": "0",
  "date": "Tue, 10 Nov 2020 12:26:40 GMT"
}

To Reproduce
Steps to reproduce the behavior:

  1. Start OLGA container
  2. Navigate to the swagger endpoint
  3. Fill the values with the ones from Webservice-User-Guide
  4. Press "Try it out" button
  5. See error

Expected behavior
It should download the result, but the ontology file doesn't seem to be picked up by service.

Log

2020-11-10 12:26:40 INFO GeneratorController:90 - Operation Starts

2020-11-10 12:26:40 INFO GeneratorController:96 - Parsing Inputs

2020-11-10 12:26:40 INFO GeneratorController:104 - Invoke Olga Service

2020-11-10 12:26:40 ERROR OlgaService:223 - java.nio.file.NoSuchFileException: ./temp/b26d57b2-7897-435a-91e5-328b15d44020

2020-11-10 12:26:40 ERROR OlgaService:123 - java.nio.file.NoSuchFileException: ./temp/b26d57b2-7897-435a-91e5-328b15d44020

2020-11-10 12:26:40 ERROR OlgaService:78 - java.nio.file.NoSuchFileException: ./temp/b26d57b2-7897-435a-91e5-328b15d44020

2020-11-10 12:26:40 ERROR GeneratorController:133 - java.nio.file.NoSuchFileException: ./temp/b26d57b2-7897-435a-91e5-328b15d44020

./temp/b26d57b2-7897-435a-91e5-328b15d44020

2020-11-10 12:26:40 INFO GeneratorController:137 - Clean up

2020-11-10 12:26:40 INFO GeneratorController:142 -

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Opera

Additional context
I've built and run the OLGA docker container under windows.
Also, the documentation has not been updated since the endpoint parameters was switched to Multipart-Form. ´

Bug: Code Generation RDF4 with a Preserve option

Describe the bug
Some classes are not being generated with RDF4J with the preserve namespace option code generation.

To Reproduce

  1. use the digital buildings ontology: https://github.com/google/digitalbuildings/blob/master/ontology/rdf/digital_buildings.rdf
  2. generate OLGA in Java with -preserve --code java --library rdf4j --name DigitalBuildings --path PATH_TO_ONTOLOGY
  3. See error

Expected behavior
Some Classes are not being generated,

Desktop (please complete the following information):

  • OS: MacOS or Ubuntu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.