Skip to content

Instantly share code, notes, and snippets.

View labra's full-sized avatar

Jose Emilio Labra Gayo labra

View GitHub Profile
@labra
labra / research_software.shex
Last active July 21, 2022 11:25
ShEx schema for Research Software generated by sheXer
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xml: <http://www.w3.org/XML/1998/namespace>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX schema: <http://schema.org/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
@labra
labra / cm.shex
Last active June 21, 2022 16:22
Conceptual Mapping draft schema
prefix cm: <http://vocab.linkeddata.es/def/conceptual-mapping#>
prefix cmf: <http://vocab.linkeddata.es/def/conceptual-mapping/functions_list/>
prefix cmp: <http://vocab.linkeddata.es/def/conceptual-mapping/protocols_list/>
prefix wotsec: <https://www.w3.org/2019/wot/security>
prefix def: <http://vocab.linkeddata.es/def>
prefix owl: <http://www.w3.org/2002/07/owl>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns>
prefix rdflicense: <http://purl.org/NET/rdflicense>
prefix terms: <http://purl.org/dc/terms>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
{
"@context": {
"schema": "http://schema.org/",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"bts": "http://discovery.biothings.io/bts/"
},
"@graph": [{
"@id": "bts:CTSADataset",
"@type": "rdfs:Class",
{
"@graph" : [ {
"@id" : "http://journal1.xyz",
"@type" : "schema:Periodical",
"hasPart" : "http://pub1.xyz",
"issn" : "issn:1234",
"name" : "A journal"
}, {
"@id" : "http://pub1.xyz",
"@type" : "schema:ScholarlyArticle"
@labra
labra / ctsaDataset.shex
Last active September 3, 2019 11:10
Examples at BioHackathon'19
prefix schema: <http://schema.org/>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix bts: <http://discovery.biothings.io/bts/>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix dct: <http://purl.org/dc/terms/>
bts:CTSADatasetShape {
schema:name xsd:string // dct:description "The name of the CTSA Dataset" ;
schema:description xsd:string // dct:description "A description of the CTSA Dataset" ;
@labra
labra / runKafka.bat
Created March 18, 2018 08:22
Simple script to start zooKeeper and kafka asynchronously (waits 5 seconds for Kafka so Zookeeper has time to start)
SET currentDir=%cd%
cd C:\utils\Stream\kafka_2.11-1.0.1
start "Zookeeper" /min bin\windows\zookeeper-server-start.bat config/zookeeper.properties
timeout 5
start "Kafka" /min bin\windows\kafka-server-start.bat config/server.properties
cd %currentDir%
@labra
labra / MultipartServer.scala
Created November 18, 2017 17:27
http4s example processing multipart content
package com.example.http4sfile
import cats.effect.IO
import org.http4s._
import org.http4s.dsl.Http4sDsl
import org.http4s.multipart.{Multipart, Part}
import org.http4s.server.blaze.BlazeBuilder
import org.http4s.util.StreamApp
import org.http4s.MediaType._
import org.http4s.headers._
/*
* Ejemplo de tipo abstracto para gestionar lista de alumnos
* Cada alumno tiene un nombre y una edad
*/
// Internamente se representan como una sola lista
let alumnos = [];
// Se inicializan un par de valores
alumnos.push({ "nombre": "pepe", "edad": 23 });
@labra
labra / apiPedido.js
Last active August 4, 2022 04:04
API Rest de pedidos
'use strict';
let http= require('http'),
url = require('url'),
qs = require('querystring');
let Pedido = require('./pedido.js');
let pedido = new Pedido;
pedido.insertaProducto(23,"Botella",3);
@labra
labra / pedido.js
Created December 3, 2016 15:57
Clase Pedido
'use strict';
class Pedido {
constructor() {
this.productos = {};
}
getProducto(id) {
if (id in this.productos)
return this.productos[id];