Skip to content

Instantly share code, notes, and snippets.

Avatar
🐓

Julian Bruyat BruJu

🐓
View GitHub Profile
@BruJu
BruJu / CppLisilibyTips.md
Last active Jul 12, 2022
C++ Lisibility Tips
View CppLisilibyTips.md

Comment avoir 8/6 à la partie programmation du projet de Génie Log

(quand c'est moi qui note)

Ne pas utiliser de variables globales

Les variables globales nuisent à la lisibilité du code. S'il y a des variables globales, les entrées de vos fonctions peuvent être n'importe quoi : on ne sait pas si des valeurs issues de variables globales seront utilisées en entrées ou pas.

@BruJu
BruJu / InJava.java
Last active Apr 21, 2022
TypeScript strange downcast rules
View InJava.java
// ==== Basic Elements
class Elem {
public String id;
}
class NamedElem extends Elem {
public String name;
}
View SyntaxTreeToXML.ts
/** Convert a CodeMirror Syntax Tree to an XML-like string */
function treeToXML(tree: Tree): string {
let t = "";
tree.iterate({
enter(type) { t += "<" + type.name + ">"; },
leave(type) { t += "</" + type.name + ">"; }
});
return t;
}
View bad_object_suggestion.diff
diff --git a/shacled-turtle/src/schema/MetaDataState.ts b/shacled-turtle/src/schema/MetaDataState.ts
index 3b5b47b..b24af9d 100644
--- a/shacled-turtle/src/schema/MetaDataState.ts
+++ b/shacled-turtle/src/schema/MetaDataState.ts
@@ -2,6 +2,7 @@ import TermMap from "@rdfjs/term-map";
import TermSet from "@rdfjs/term-set";
import * as RDF from "@rdfjs/types";
import Schema from ".";
+import { addTermPairInTermMultiMap } from "../util";
import { MetaBaseInterface, MetaBaseInterfaceComponent } from "./MetaDataInterface";
View shacl.shape.ttl
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix shsh: <http://www.w3.org/ns/shacl-shacl#> .
# from https://www.w3.org/TR/shacl/#shacl-shacl
shsh:
View logicRuleDebug.ts
/* istanbul ignore next */
debugString(): string {
let strRules: string[] = [];
function debugMeta(info: MetaInfo | null): string {
if (info === null) return '.';
return "<< " + termToString(info.target) + " " + info.kind + " " + termToString(info.value) + " >>";
}
View full.ttl
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ex: <http://example.org/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix schema: <http://schema.org/> .
ex:Target a sh:NodeShape ; sh:property [ sh:path ex:ok ] .
# Predicate Path
sh:Pathed01 a sh:NodeShape ;
@BruJu
BruJu / colornameontology.ttl
Created Mar 22, 2022
colornameontology.ttl
View colornameontology.ttl
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ex: <http://example.org/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
ex:firstname rdfs:domain ex:Named .
ex:Colored a rdfs:Class ;
sh:targetSubjectsOf ex:color .
View tests_from_manifest.ts
# Test parser from the W3C test suite manifest
describe("Tests from manifest", () => {
// const manifestUrl = "https://www.w3.org/2013/rdf-mt-tests/manifest.ttl";
const manifestContent = fs.readFileSync(path.join(__dirname, "w3c-test-manifest.ttl"), "utf8");
const manifestQuads = new n3.Parser().parse(manifestContent);
let tests = new TermMap<RDF.Quad_Subject, ManifestedTest>();
@BruJu
BruJu / OneStepBackward.ttl
Last active Feb 27, 2022
OneStepBackward
View OneStepBackward.ttl
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix sh: <http://www.w3.org/ns/shacl#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix ex: <http://example.com/ns#>
prefix s: <http://schema.org/>
ex:OneStep a sh:NodeShape ;