Skip to content

Instantly share code, notes, and snippets.

View phochste's full-sized avatar

Patrick Hochstenbach phochste

View GitHub Profile
@prefix vcard: <http://www.w3.org/2006/vcard/ns#> .
# Syntax:
# <> a vcard:Group;
# vcard:hasMember <webID1> ;
# vcard:hasMember <webID2> ;
# (etc)
# vcard:hasMember <webIDN> .
<> a vcard:Group;
vcard:hasMember <https://patrickhochstenbach.net/profile/card#me> .
@phochste
phochste / example.js
Last active November 16, 2022 10:41
Example how to transform RDF from one serialisation to another
// npm install rdf-parse rdf-serialize stream-to-string streamify-string'
// node example.js
const rdfParser = require("rdf-parse").default;
const rdfSerializer = require("rdf-serialize").default;
const stringifyStream = require('stream-to-string');
const streamifyString = require('streamify-string');
doit(`
{
"@context": "http://schema.org/",
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix : <http://example.org/ns#>.
# beetle is a car
:beetle a :Car.
# bob is a person
:bob a :Person.
# grannysmith apple is green
{
"@context": [
"https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^5.0.0/components/context.jsonld",
"https://linkedsoftwaredependencies.org/bundles/npm/koreografeye/^0.0.0/components/context.jsonld"
],
"@graph": [
{
"@id": "urn:koreografeye:reasonerInstance",
"@type": "EyeJsReasoner",
"args": [ "--quiet" , "--nope" , "--pass" ]
@prefix ex: <http://example.org/> .
@prefix as: <https://www.w3.org/ns/activitystreams#> .
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix pol: <https://www.example.org/ns/policy#> .
@prefix fno: <https://w3id.org/function/ontology#> .
{
# We need an Announce
?id a as:Announce .
MIIVcjADAgEAMIIVaQYJKoZIhvcNAQcCoIIVWjCCFVYCAQMxDzANBglghkgBZQMEAgMFADCCAaQG
CyqGSIb3DQEJEAEEoIIBkwSCAY8wggGLAgEBBgQqAwQBMFEwDQYJYIZIAWUDBAIDBQAEQBX2O8T8
+6VAZO7C8v1twvOUBBgA/Vz7orCfdbtUq1t7TqOTlaz11QrmNysFu8TFukxzSwB24jJQeMV0BLHE
bf0CBAD6cuUYDzIwMjMxMTMwMTI0NTE4WgEB/6CCARGkggENMIIBCTERMA8GA1UEChMIRnJlZSBU
U0ExDDAKBgNVBAsTA1RTQTF2MHQGA1UEDRNtVGhpcyBjZXJ0aWZpY2F0ZSBkaWdpdGFsbHkgc2ln
bnMgZG9jdW1lbnRzIGFuZCB0aW1lIHN0YW1wIHJlcXVlc3RzIG1hZGUgdXNpbmcgdGhlIGZyZWV0
c2Eub3JnIG9ubGluZSBzZXJ2aWNlczEYMBYGA1UEAxMPd3d3LmZyZWV0c2Eub3JnMSIwIAYJKoZI
hvcNAQkBFhNidXNpbGV6YXNAZ21haWwuY29tMRIwEAYDVQQHEwlXdWVyemJ1cmcxCzAJBgNVBAYT
AkRFMQ8wDQYDVQQIEwZCYXllcm6gghAIMIIIATCCBemgAwIBAgIJAMHphhYNqOmCMA0GCSqGSIb3
DQEBDQUAMIGVMREwDwYDVQQKEwhGcmVlIFRTQTEQMA4GA1UECxMHUm9vdCBDQTEYMBYGA1UEAxMP
{
"@context": {
"@vocab": "http://example.org/ns#",
"contains": { "@container":"@graph" }
},
"@id":"urn:uuid:B7AC1149-E71F-4529-ADA6-A06BEA6BABD5",
"@type":"Package",
"contains": {
"@id":"urn:uuid:05D1E281-AF04-49C9-821B-862C82501D2D",
"@type": [ "Trust","Package"],
{
"@context": {
"@vocab": "http://www.w3.org/2000/10/swap/lingua#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"vars": { "@container":"@list"},
"premise": { "@container":"@graph" },
"conclusion": { "@container":"@graph" }
},
"@id":"urn:uuid:B7AC1149-E71F-4529-ADA6-A06BEA6BABD5",
"@type":"Rules",
{
"@context": {
"bflc":"http://id.loc.gov/ontologies/bflc/",
"mads":"http://www.loc.gov/mads/rdf/v1#",
"identifiers":"http://id.loc.gov/vocabulary/identifiers/",
"skos":"http://www.w3.org/2004/02/skos/core#",
"bflc:subjectOf": {
"@type":"@id"
},
"mads:elementList": {
{
"openapi": "3.0.3",
"info": {
"description": "This is mirepo's authorIDy instance",
"version": "v1.0",
"title": "mirepo authorIDy",
"termsOfService": "https://mirepo.org/terms-of-service/",
"contact": {
"email": "admin@mirepo.org"
},