Skip to content

Commit

Permalink
Merge pull request #514 from SynBioHub/jsonpage5
Browse files Browse the repository at this point in the history
Jsonpage5
  • Loading branch information
danielfang97 authored Aug 18, 2023
2 parents f6283b3 + ed43639 commit be33433
Show file tree
Hide file tree
Showing 12 changed files with 635 additions and 181 deletions.
19 changes: 17 additions & 2 deletions frontend/components/Viewing/PageJSON/MasterJSON.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ import Participation from './Types/Participation.json';
import SequenceConstraint from './Types/SequenceConstraint.json';
import Datasheet from './Types/Datasheet.json';
import Plan from './Types/Plan.json';
import VariableComponent from './Types/VariableComponent.json';
import SequenceAnnotation from './Types/SequenceAnnotation.json';
import Activity from './Types/Activity.json';
import Usage from './Types/Usage.json';
import Association from './Types/Association.json';
import Agent from './Types/Agent.json';
import GenericLocation from './Types/GenericLocation.json';
import Cut from './Types/Cut.json';


const TypeToJson = {
Expand All @@ -39,9 +47,16 @@ const TypeToJson = {
'http://sbols.org/v2#Interaction': Interaction,
'http://sbols.org/v2#Participation': Participation,
'http://sbols.org/v2#SequenceConstraint': SequenceConstraint,
'http://sbols.org/v2#VariableComponent': VariableComponent,
'http://sbols.org/v2#SequenceAnnotation': SequenceAnnotation,
'http://sbols.org/v2#GenericLocation': GenericLocation,
'http://sbols.org/v2#Cut': Cut,
'http://www.myapp.org/Datasheet': Datasheet,
'http://www.w3.org/ns/prov#Plan' : Plan

'http://www.w3.org/ns/prov#Plan' : Plan,
'http://www.w3.org/ns/prov#Activity': Activity,
'http://www.w3.org/ns/prov#Usage': Usage,
'http://www.w3.org/ns/prov#Association': Association,
'http://www.w3.org/ns/prov#Agent': Agent
};

export default TypeToJson;
24 changes: 18 additions & 6 deletions frontend/components/Viewing/PageJSON/Rendering/SectionRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,31 @@ function loadText(template, args) {
}

export default function SectionRenderer({ section, metadata }) {
console.log(section)
const graphPrefix = "https://synbiohub.org/";
console.log(section.link);
section.link = replaceBeginning("" + section.link, graphPrefix, "/");
console.log(section.link);
if (section.grouped) {
const items = section.text.split(', ');
const content = items.map((item, index) => {
if (section.link && item) {
return (
<ColumnLink
link={loadText(section.link, { This: item })}
text={`${item}${
index === items.length - 1 ||
text={`${item}${index === items.length - 1 ||
(section.linkType !== 'default' && section.linkType !== undefined)
? ''
: ', '
}`}
? ''
: ', '
}`}
linkType={section.linkType}
key={index}
/>
);
}
return (
<span key={index}>
{item}
"{item}"
{index === items.length - 1 ? '' : ', '}
</span>
);
Expand All @@ -58,6 +62,14 @@ export default function SectionRenderer({ section, metadata }) {
);
}

function replaceBeginning(original, oldBeginning, newBeginning) {
if (original.startsWith(oldBeginning)) {
return newBeginning + original.slice(oldBeginning.length);
}
return original;
}


function ColumnLink({ text, link, linkType }) {
if (linkType === 'search') {
const searchStart = link.indexOf('=');
Expand Down
137 changes: 137 additions & 0 deletions frontend/components/Viewing/PageJSON/Types/Activity.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
{
"type": "http://www.w3.org/ns/prov#Activity",
"prefixes": [
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>",
"PREFIX dcterms: <http://purl.org/dc/terms/>",
"PREFIX dc: <http://purl.org/dc/elements/1.1/>",
"PREFIX sbh: <http://wiki.synbiohub.org/wiki/Terms/synbiohub#>",
"PREFIX prov: <http://www.w3.org/ns/prov#>",
"PREFIX sbol: <http://sbols.org/v2#>",
"PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>",
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>",
"PREFIX purl: <http://purl.obolibrary.org/obo/>"
],
"metadata": [],
"tables": [
{
"icon": "faVials",
"title": "Usages",
"rootPredicate": "prov:qualifiedUsage",
"sections": [
{
"title": "Usage",
"infoLink": "https://www.w3.org/ns/prov#Usage",
"predicates": [
"sbol:displayId"
],
"stripAfter": "#",
"link": "$<usageLink>"
},
{
"title": "usageLink",
"predicates": [],
"hide": true
},
{
"title": "Entity",
"infoLink": "https://www.w3.org/ns/prov#entity",
"predicates": [
"prov:entity"
],
"link": "$<entityLink>"
},
{
"title": "entityLink",
"predicates": [],
"hide": true
},
{
"title": "Roles",
"infoLink": "https://www.w3.org/ns/prov#hasRole",
"predicates": [
"prov:hadRole"
],
"stripAfter": "#",
"link": "$<roleLink>"
},
{
"title": "roleLink",
"predicates": [],
"hide": true
}
]
},
{
"icon": "faVials",
"title": "Associations",
"rootPredicate": "prov:qualifiedAssociation",
"sections": [
{
"title": "Association",
"infoLink": "https://www.w3.org/ns/prov#Association",
"predicates": [
"sbol:displayId"
],
"stripAfter": "#",
"link": "$<associationLink>"
},
{
"title": "associationLink",
"predicates": [],
"hide": true
},
{
"title": "Agent",
"infoLink": "https://www.w3.org/ns/prov#Agent",
"predicates": [
"prov:agent"
],
"link": "$<agentLink>"
},
{
"title": "agentLink",
"predicates": [],
"hide": true
},
{
"title": "Plan",
"infoLink": "https://www.w3.org/ns/prov#Plan",
"predicates": [
"prov:hadPlan"
],
"link": "$<planLink>"
},
{
"title": "planLink",
"predicates": [],
"hide": true
},
{
"title": "Roles",
"infoLink": "https://www.w3.org/ns/prov#hasRole",
"predicates": [
"prov:hadRole"
],
"link": "$<rolesLink>",
"stripAfter": "#"

},
{
"title": "rolesLink",
"predicates": [
"prov:hadRole"
],
"hide": true
}
]
}
],
"pages": [
"$TABLES[Usages]",
"$TABLES[Associations]",
"Details",
"Other Properties",
"Member of these Collections",
"Attachments"
]
}
23 changes: 23 additions & 0 deletions frontend/components/Viewing/PageJSON/Types/Agent.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"type": "http://www.w3.org/ns/prov#Agent",
"prefixes": [
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>",
"PREFIX dcterms: <http://purl.org/dc/terms/>",
"PREFIX dc: <http://purl.org/dc/elements/1.1/>",
"PREFIX sbh: <http://wiki.synbiohub.org/wiki/Terms/synbiohub#>",
"PREFIX prov: <http://www.w3.org/ns/prov#>",
"PREFIX sbol: <http://sbols.org/v2#>",
"PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>",
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>",
"PREFIX purl: <http://purl.obolibrary.org/obo/>"
],
"metadata": [],
"tables": [
],
"pages": [
"Details",
"Other Properties",
"Member of these Collections",
"Attachments"
]
}
57 changes: 57 additions & 0 deletions frontend/components/Viewing/PageJSON/Types/Association.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"type": "http://www.w3.org/ns/prov#Association",
"prefixes": [
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>",
"PREFIX dcterms: <http://purl.org/dc/terms/>",
"PREFIX dc: <http://purl.org/dc/elements/1.1/>",
"PREFIX sbh: <http://wiki.synbiohub.org/wiki/Terms/synbiohub#>",
"PREFIX prov: <http://www.w3.org/ns/prov#>",
"PREFIX sbol: <http://sbols.org/v2#>",
"PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>",
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>",
"PREFIX purl: <http://purl.obolibrary.org/obo/>"
],
"metadata": [
{
"title": "Roles",
"icon": "faVials",
"infoLink": "https://sbols.org/v2#role",
"rootPredicate": "prov:hadRole",
"sections": [
{
"title": "name",
"predicates": [

],
"stripAfter":"#",
"link": "$<roleLink>"
},
{
"title": "roleLink",
"predicates": [],
"hide": true
}
]
},
{
"title": "Agent",
"icon": "faVials",
"infoLink": "https://www.w3.org/ns/prov#agent",
"rootPredicate": "prov:agent",
"sections": [
{
"title": "name",
"predicates": [
],
"link": "$<This>"
}
]
}
],
"tables": [],
"pages": [
"Details",
"Other Properties",
"Attachments"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
{
"title": "Extra Work",
"predicates": [
"sbol:displayId"
]
],
"link": "$<This>"
}
]
},
Expand All @@ -34,7 +34,12 @@
"title": "Extra Work",
"stripAfter": "#",
"predicates": [],
"link": "$<This>"
"link": "$<strategyLink>"
},
{
"title": "strategyLink",
"predicates": [],
"hide": true
}
]
}
Expand All @@ -57,38 +62,44 @@
{
"title": "VariableComponentsLink",
"predicates": [
"sbol:persistentIdentity"
],
"hide": true
},

{
"title": "Variable",
"infoLink": "https://dissys.github.io/sbol-owl/sbol-owl.html#variable",
"infoLink": "https://sbols.org/v2#variable",
"predicates": [
"sbol:variable"
],
"link": "$<VariableLink>"
"link": "$<This>"
},

{
"title": "VariableLink",
"predicates": [
"sbol:variable"
],
"hide": true
},
{
"title": "Operator",
"infoLink": "https://dissys.github.io/sbol-owl/sbol-owl.html#operator",
"infoLink": "https://sbols.org/v2#operator",
"predicates": [
"sbol:operator"
],
"stripAfter": "#",
"link": "$<operatorLink>"
},
{
"title": "operatorLink",
"predicates": [
"sbol:operator"
],
"stripAfter": "#"
"hide": true
},
{
"title": "Variant",
"infoLink": "https://dissys.github.io/sbol-owl/sbol-owl.html#variant",
"infoLink": "https://sbols.org/v2#variant",
"predicates": [
"sbol:variant", "sbol:displayId"
],
Expand Down
Loading

0 comments on commit be33433

Please sign in to comment.