Skip to content

Commit

Permalink
Unify product and project IDs and links (#445)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsteeg committed Jul 9, 2021
1 parent 5ab5499 commit ba72911
Show file tree
Hide file tree
Showing 21 changed files with 79 additions and 70 deletions.
7 changes: 5 additions & 2 deletions gatsby/lobid/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ exports.createPages = async ({ graphql, actions }) => {
const shortMemberIds = members.membership.map(m => m.member.id)
.filter(id => id.indexOf("lobid.org/team") != -1)
.map(id => id.slice(id.lastIndexOf("/") + 1, id.lastIndexOf("!#") - 1));
console.log("Creating member pages: ", shortMemberIds);
addPages(shortMemberIds, "team", "./src/templates/member.js", createPage);

// Pages for individual products listed in `makesOffer`
Expand All @@ -60,7 +61,8 @@ exports.createPages = async ({ graphql, actions }) => {

const shortProductIds = products.makesOffer.map(p => p.id)
.filter(id => id.indexOf("/") != -1)
.map(id => id.slice(id.lastIndexOf("/") + 1, id.lastIndexOf(".")));
.map(id => id.slice(id.lastIndexOf("/") + 1));
console.log("Creating product pages: ", shortProductIds);
addPages(shortProductIds, "product", "./src/templates/product.js", createPage);

// Pages for individual project files in /project
Expand All @@ -78,10 +80,11 @@ exports.createPages = async ({ graphql, actions }) => {
}
}
`);

const shortProjectIds = projects.edges.map(e => e.node.id)
.filter(id => id.indexOf("/") != -1)
.map(id => id.slice(id.lastIndexOf("/") + 1));
console.log("Creating project pages: ", shortProjectIds);
addPages(shortProjectIds, "project", "./src/templates/project.js", createPage);

};
Expand Down
8 changes: 2 additions & 6 deletions gatsby/lobid/src/components/helpers.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
export function simpleProductId(url) {
return url.slice(url.lastIndexOf("/") + 1, url.lastIndexOf("."));
}

export function simpleProjectId(url) {
return url.slice(url.lastIndexOf('/')+1);
export function simpleId(url) {
return url.slice(url.lastIndexOf("/") + 1);
}
15 changes: 8 additions & 7 deletions gatsby/lobid/src/components/product.html.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import md5 from 'md5';
import { simpleProductId } from './helpers.js'
import { simpleId } from './helpers.js'

import Header from "./header.html";
import Footer from "./footer.html";
Expand All @@ -20,9 +20,10 @@ export class Product extends React.Component {
}

asLinks(field) {
return this.props.product[field] && <tr><td>{this.props[field]}</td><td>{this.props.product[field].map((link) =>
<div key={link.id}><a href={link.id}>{link.id.replace('https://', '').replace('http://', '')}</a><br /></div>
)}</td></tr>
return this.props.product[field] && <tr><td>{this.props[field]}</td><td>{this.props.product[field].map((link) => {
let linkId = link.id.replace(/https?:\/\/lobid.org\//, '/');
return <div key={link.id}><a href={linkId}>{linkId}</a><br /></div>
})}</td></tr>
}

render() {
Expand All @@ -43,19 +44,19 @@ export class Product extends React.Component {
{this.props.product.name.label}
<small>
{this.props.product.slogan && [this.props.product.slogan].map(s => <span> &mdash; {s.label}</span>)}
<a title="Beschreibung als JSON-LD anzeigen" href={'/product/' + simpleProductId(this.props.product.id) + '.json'}><img className='json-ld-icon' src={jsonLdPng} alt="JSON-LD" /></a></small>
<a title="Beschreibung als JSON-LD anzeigen" href={'/product/' + simpleId(this.props.product.id) + '.json'}><img className='json-ld-icon' src={jsonLdPng} alt="JSON-LD" /></a></small>
</h1>
</div>

<div className="row">
<div className="col-md-9">
<p className={this.props.product.description.label.length < 400 && "lead"}>{this.props.product.description.label}</p>
<p className={this.props.product.description.label.length < 400 ? "lead" : "p"}>{this.props.product.description.label}</p>
<table className="table table-striped table-condensed">
<thead>
<tr><th width="20%" /><th width="80%" /></tr>
</thead>
<tbody>
<tr><td>Website</td><td><a href={this.props.product.id}>{this.props.product.id}</a></td></tr>
<tr><td>Website</td><td><a href={this.props.product.url || this.props.product.id}>{this.props.product.url || this.props.product.id}</a></td></tr>
{this.asLinks("hasPart")}
{this.asLinks("isBasedOn")}
{this.asLinks("isRelatedTo")}
Expand Down
14 changes: 8 additions & 6 deletions gatsby/lobid/src/components/project.html.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import md5 from 'md5';
import { simpleProjectId } from './helpers.js'
import { simpleId } from './helpers.js'

import Header from "./header.html";
import Footer from "./footer.html";
Expand All @@ -20,8 +20,10 @@ export class Project extends React.Component {
}

asLinks(field) {
return this.props.project[field] && <tr><td>{this.props[field]}</td><td>{this.props.project[field].map((link) =>
<div key={link.id}><a href={link.id}>{link.id.replace('https://', '').replace('http://', '')}</a><br /></div>
return this.props.project[field] && <tr><td>{this.props[field]}</td><td>{this.props.project[field].map((link) => {
let linkId = link.id.replace(/https?:\/\/lobid.org\//, '/');
return <div key={link.id}><a href={linkId}>{linkId}</a><br /></div>
}
)}</td></tr>
}

Expand All @@ -43,19 +45,19 @@ export class Project extends React.Component {
{this.props.project.name.label}
<small>
{this.props.project.alternateName && this.props.project.alternateName.map(s => <span> | {s}</span>)}
<a title="Beschreibung als JSON-LD anzeigen" href={'/project/' + simpleProjectId(this.props.project.id) + '.json'}><img className='json-ld-icon' src={jsonLdPng} alt="JSON-LD" /></a></small>
<a title="Beschreibung als JSON-LD anzeigen" href={'/project/' + simpleId(this.props.project.id) + '.json'}><img className='json-ld-icon' src={jsonLdPng} alt="JSON-LD" /></a></small>
</h1>
</div>

<div className="row">
<div className="col-md-9">
<p className={this.props.project.description.label.length < 400 && "lead"}>{this.props.project.description.label}</p>
<p className={this.props.project.description.label.length < 400 ? "lead" : "p"}>{this.props.project.description.label}</p>
<table className="table table-striped table-condensed">
<thead>
<tr><th width="20%" /><th width="80%" /></tr>
</thead>
<tbody>
<tr><td>Website</td><td><a href={this.props.project.id}>{this.props.project.id}</a></td></tr>
<tr><td>Website</td><td><a href={this.props.project.url || this.props.project.id}>{this.props.project.url || this.props.project.id}</a></td></tr>
{this.props.project.endDate && <tr><td>Abgeschlossen</td><td>{this.props.project.endDate}</td></tr>}
{this.asLinks("hasPart")}
{this.asLinks("isBasedOn")}
Expand Down
3 changes: 1 addition & 2 deletions gatsby/lobid/src/components/publications.html.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from "react"
import { simpleProductId } from './helpers.js'

import jsonLdPng from "./images/json-ld.png";

Expand All @@ -20,7 +19,7 @@ export default class Publications extends React.Component {
<td><small>{publication.datePublished}</small></td>
<td><a href={publication.id}>{publication.name.de || publication.name.en || publication.id}</a></td>
<td>{publication.about && publication.about.map(a =>
<p key={a.id}><small><span className="glyphicon glyphicon-tag" aria-hidden="true"></span></small>&nbsp;<a href={a.id}>{simpleProductId(a.id)}</a></p>
<p key={a.id}><small><span className="glyphicon glyphicon-tag" aria-hidden="true"></span></small>&nbsp;<a href={a.id}>{a.id.slice(a.id.lastIndexOf("/")+1, a.id.lastIndexOf("."))}</a></p>
)}</td>
<td align="right"><small><a href={"https://schema.org/" + publication.type}>{publication.type}</a></small></td>
<td><a title="Beschreibung als JSON-LD anzeigen" href={publication.fields.jsonFile}><img height="20px" src={jsonLdPng} alt="JSON-LD" /></a></td>
Expand Down
8 changes: 4 additions & 4 deletions gatsby/lobid/src/components/team.html.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import md5 from 'md5';
import { simpleProductId, simpleProjectId } from './helpers.js'
import { simpleId } from './helpers.js'

import Header from "./header.html";
import Footer from "./footer.html";
Expand Down Expand Up @@ -172,7 +172,7 @@ export class Team extends React.Component {
<div key={offer.id}>
{this.getImage(offer.id, details.node.image)}
<p className="details">
<a href={"/product/" + simpleProductId(offer.id)}>
<a href={"/product/" + simpleId(offer.id)}>
{offer.name}
</a>
<br />
Expand All @@ -188,8 +188,8 @@ export class Team extends React.Component {
<div key={details.node.id}>
{this.getImage(details.node.id, details.node.image)}
<p className="details">
<a href={"/project/" + simpleProjectId(details.node.id)}>
{details.node.alternateName || simpleProjectId(details.node.id)}
<a href={"/project/" + simpleId(details.node.id)}>
{details.node.alternateName || simpleId(details.node.id)}
</a>
<br />
{(details.node.name && details.node.name[this.props.lang]) || details.node.alternateName}
Expand Down
1 change: 1 addition & 0 deletions gatsby/lobid/src/templates/product.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const query = graphql`
edges {
node {
childProductJson {
url
name {
label: de
}
Expand Down
1 change: 1 addition & 0 deletions gatsby/lobid/src/templates/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const query = graphql`
isBasedOn {
id
}
url
alternateName
endDate
result {
Expand Down
9 changes: 5 additions & 4 deletions gatsby/lobid/static/product/lobid.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"@context": "https://schema.org",
"id": "https://lobid.org",
"id": "https://lobid.org/product/lobid",
"url": "https://lobid.org",
"type": [
"Product"
],
Expand All @@ -18,7 +19,7 @@
},
"startDate": "2010-08",
"maintainer": {
"id": "http://stage.lobid.org/team#!",
"id": "http://lobid.org/team#!",
"name": {
"de": "Offene Infrastruktur",
"en": "Open Infrastructure"
Expand All @@ -38,12 +39,12 @@
],
"isBasedOn": [
{
"id": "https://metafacture.org"
"id": "https://lobid.org/product/metafacture"
}
],
"isRelatedTo": [
{
"id": "https://github.com/hbz/lobid-resources/milestone/1"
"id": "https://lobid.org/project/alma-migration"
}
]
}
6 changes: 3 additions & 3 deletions gatsby/lobid/static/product/metafacture.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"@context": "https://schema.org",
"id": "https://metafacture.org",
"id": "https://lobid.org/product/metafacture",
"url": "https://metafacture.org",
"type": [
"Product"
],
"name": {
"en": "Metafacture",
"de": "Metafacture"
},
"url": "https://metafacture.org",
"description": {
"en": "Metafacture is a toolkit for processing semi-structured data with a focus on library metadata. It provides a versatile set of tools for reading, writing and transforming data. Metafacture can be used as a stand-alone application or as a Java library in other applications. The name Metafacture is a portmanteau of the words meta data and manufacture.",
"de": "Metafacture is ein Toolkit für die Verarbeitung von (semi-)strukturierten Daten mit dem Fokus auf bibliothekarische Metadaten. Es bietet ein vielseitiges Set an Werkzeugen für das Auslesen, Schreiben und Transformieren von Daten. Metafacture kann als alleinstehende Applikaiton oder als Java Library in anderen Applikationen genutzt werden. Der Name Metafacture ist eine Zusammensetzung der Wörter Metadaten und manufacture (eng.: herstellen)."
},
"maintainer": {
"id": "http://stage.lobid.org/team#!",
"id": "http://lobid.org/team#!",
"name": {
"de": "Offene Infrastruktur",
"en": "Open Infrastructure"
Expand Down
7 changes: 4 additions & 3 deletions gatsby/lobid/static/product/nwbib.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"@context": "https://schema.org",
"id": "https://nwbib.de",
"id": "https://lobid.org/product/nwbib",
"url": "https://nwbib.de",
"type": [
"Product"
],
Expand All @@ -17,11 +18,11 @@
},
"isBasedOn": [
{
"id": "https://lobid.org"
"id": "https://lobid.org/product/lobid"
}
],
"maintainer": {
"id": "http://stage.lobid.org/team#!",
"id": "http://lobid.org/team#!",
"name": {
"de": "Offene Infrastruktur",
"en": "Open Infrastructure"
Expand Down
6 changes: 3 additions & 3 deletions gatsby/lobid/static/product/skohub.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"id": "https://skohub.io",
"id": "https://lobid.org/product/skohub",
"url": "https://skohub.io",
"type": [
"Product"
],
"name": {
"en": "SkoHub",
"de": "SkoHub"
},
"url": "https://skohub.io",
"description": {
"en": "SkoHub supports a novel approach for finding content on the web. The general idea is to extend the scope of Knowledge Organization Systems (KOS) to also act as communication hubs for publishers and information seekers. In effect, SkoHub allows to follow specific subjects in order to be notified when new content about that subject is published.",
"de": "SkoHub unterstützt einen neuen Zugang, um Inhalte im Netz zu finden. Die allgemeine Idee von SkoHub ist die Reichweite von Knowledge Organization Systems (KOS) so zu erweitern, dass sie auch als communication hub (?) zwischen Metadatenbereitsteller:innen und Imformationssuchende eingesetzt werden können. In der Tat, ermöglicht SkoHub das Folgen bestimmter Themen, um benachrichtigt zu werden, wenn neue Inhalte veröffentlicht werden."
},
"maintainer": {
"id": "http://stage.lobid.org/team#!",
"id": "http://lobid.org/team#!",
"name": {
"de": "Offene Infrastruktur",
"en": "Open Infrastructure"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"@context": "https://schema.org/",
"id": "https://service-wiki.hbz-nrw.de/display/SEM/Alma+Migration",
"id": "https://lobid.org/project/alma-migration",
"url": "https://github.com/hbz/lobid-resources/milestone/1",
"type": [
"Project"
],
Expand All @@ -12,15 +13,14 @@
"en": "Switch lobid-resources ETL and indexing from Aleph to Alma Marc21 XML",
"de": "Der schrittweise Umstieg der hbz-Verbundbibliotheken auf das Bibliotheksmanagementsystem Alma im Rahmen des GO:AL-Projekts (GOAL) bringt auch für die Gruppe Offene Infrastruktur dauerhaft Aufgaben mit sich: lobid indexiert unter anderem die Verbunddaten des hbz, die nun schrittweise nach Alma wandern. Demenstprechend müssen sämtliche Prozesse zum Extrahieren, Transformieren und Laden (ETL) der Verbunddaten angepasst werden, damit sie (auch) auf Basis von Alma-Daten funktionieren."
},
"url": "https://github.com/hbz/lobid-resources/milestone/1",
"enhances": [
{
"id": "https://lobid.org"
"id": "https://lobid.org/product/lobid"
}
],
"isBasedOn": [
{
"id": "https://metafacture.org"
"id": "https://lobid.org/product/metafacture"
}
]
}
5 changes: 3 additions & 2 deletions gatsby/lobid/static/project/lrmi-profile.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"@context": "https://schema.org/",
"id": "https://github.com/dini-ag-kim/lrmi-profile",
"id": "https://lobid.org/project/lrmi-profile",
"url": "https://github.com/dini-ag-kim/lrmi-profile",
"type": [
"Project"
],
Expand All @@ -14,7 +15,7 @@
},
"isBasedOn": [
{
"id": "https://github.com/dini-ag-kim/oer-stoeberspecs"
"id": "https://lobid.org/project/oer-stoeberspecs"
}
]
}
6 changes: 3 additions & 3 deletions gatsby/lobid/static/project/metafacture-fix.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"@context": "https://schema.org/",
"id": "https://github.com/metafacture/metafacture-fix",
"id": "https://lobid.org/project/metafacture-fix",
"url": "https://github.com/metafacture/metafacture-fix",
"type": [
"Project"
],
Expand All @@ -12,10 +13,9 @@
"en": "Implementation of the Fix language for Metafacture as an alternative to configuring data transformations with Metamorph",
"de": "Ziel des Projekts ist die Erleichterung der Metafacture-Konfiguration und damit die Erweiterung der Zielgruppe um Bibliothekar*innen und andere Metadatenfachleute, die keinen Programmierhintergrund haben.\n\nDies geschieht durch die Implementierung der Fix-DSL für die Konfiguration von Metadatenmappings als Alternative zum XML-basierten Metamorph. Zunächst wird die Erweiterung zur produktiven Nutzung im OERSI-Kontext und anderen neu zu erstellenden ETL-Prozessen entwickelt und dann auf die komplexeren Prozesse – etwa im lobid-Kontext – ausgeweitet.\n\nIn einem nächsten Schritt – voraussichtlich 2022 – wird an einer Standardisierung der Fix-Sprache gearbeitet mit dem Ziel, Kompatibilität zwischen Metafacture und Catmandu zu erreichen."
},
"url": "https://github.com/metafacture/metafacture-fix",
"enhances": [
{
"id": "https://metafacture.org"
"id": "https://lobid.org/product/metafacture"
}
]
}
8 changes: 4 additions & 4 deletions gatsby/lobid/static/project/metafacture-playground.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"@context": "https://schema.org/",
"id": "https://github.com/metafacture/metafacture-playground",
"id": "https://lobid.org/project/metafacture-playground",
"url": "https://github.com/metafacture/metafacture-playground",
"type": [
"Project"
],
Expand All @@ -12,15 +13,14 @@
"en": "This projects aims to provide a web application to play around with Metafactures languages Fix and Flux.",
"de": "Der Metafacture Playground ist eine browserbasierte Umgebung, um an der Konfiguration von ETL-Prozessen mittels Metafacture zu arbeiten. Der Playground nutzt die [Metafacture-Fix-Erweiterung (MFF)](https://github.com/metafacture/metafacture-fix). Kurzfristig soll der Playground zum Teilen von ETL-Konfigurationen via URL und für aktive Arbeit in metafacture-Workshops Verwendung finden.\n\nMittelfristiges Ziel ist der Aufbau einer Plattform zum Teilen von ETL-Konfigurationen, um das Auffinden bestehender Lösungen und deren Nachnutzung zu erleichtern und damit Parallelarbeiten zu vermeiden."
},
"url": "https://github.com/metafacture/metafacture-playground",
"enhances": [
{
"id": "https://metafacture.org"
"id": "https://lobid.org/product/metafacture"
}
],
"isBasedOn": [
{
"id": "https://github.com/metafacture/metafacture-fix"
"id": "https://lobid.org/project/metafacture-fix"
}
]
}
Loading

0 comments on commit ba72911

Please sign in to comment.