p2m2 / discovery   0.4.3

MIT License Website GitHub

Discovery provides a powerful toolset for developers who are looking to build UIs using RDF data in an a robust software development process

Scala versions: 2.13
Scala.js versions: 1.x

Discovery

p2m2 codecov CodeFactor Codacy Badge javadoc Npm package version Docker Image Version (tag latest semver) Maven Central

What is discovery

discovery is a software library which aims to ease the development of decision support tools exploiting omics RDF databases. The library offers a dedicated query language that can be used in several runtime environments (Browser/JS, Node/JS, JVM/Scala).

discovery is developed as part of the work package "Creating FAIR e-resources for knowledge mining" for the national infrastructure for metabolomics and fluxomics - MetaboHUB

features

  • Programming/building request with immutables objects
  • Querying several RDF content (SPARQL Endpoint, RDF File, RDF content)
  • Federated Query
  • Handling lazy page results
  • Subscribe to SPARQL query status events
  • Stringify request and configuration to ease transport
  • Decorating the building nodes with additional information

Dependencies - RDF Software libraries

this software development is based on RDFJS (RDF JavaScript Libraries) and RDF4J

Documentation

further information and documentation, visit https://p2m2.github.io/discovery/

Html/Js example

Html import

<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/p2m2/discovery@develop/dist/discovery-web.min.js"> </script> 
<script>
      var config = SWDiscoveryConfiguration
                    .init()
                    .sparqlEndpoint("https://metabolights.semantic-metabolomics.fr/sparql");

      SWDiscovery(config)
          .prefix("obo","http://purl.obolibrary.org/obo/")
          .prefix("metabolights","https://www.ebi.ac.uk/metabolights/property#")
          .prefix("rdfs","http://www.w3.org/2000/01/rdf-schema#")
          .something()
            .set(URI("obo:CHEBI_4167"))
              .isObjectOf(URI("metabolights:Xref"),"study")
                .datatype(URI("rdfs:label"),"label")
          .select("study","label")
             .commit()
             .raw()
             .then((response) => {
                  for (let i=0;i<response.results.bindings.length;i++) {
                    let study=response.results.bindings[i]["study"].value;
                    let label=response.results.datatypes["label"][study][0].value; 
                    console.log(study+"-->"+label);
                  }
            }).catch( (error) => {
              console.error(" -- catch exception --")
              console.error(error)
            } );
 </script>

js fiddle example

Install

sbt

libraryDependencies += "com.github.p2m2" %% "discovery" % "0.4.0"

scalajs

libraryDependencies += "com.github.p2m2" %%% "discovery" % "0.4.0"

npm

npm i @p2m2/discovery

Running docker proxy image

docker command

docker run -d --network host -t inraep2m2/service-discovery-proxy:latest

docker-compose file

version: '3.9'
services:
  service-discovery-proxy:
    image: inraep2m2/service-discovery-proxy:latest
    command: ./mill -w app.runBackground --port 8085 --verbose
    network_mode: "host"
    restart: on-failure