Skip to content

Commit

Permalink
all projects only on demand
Browse files Browse the repository at this point in the history
janpolowinski committed Sep 22, 2015
1 parent 4f94dda commit f2c471d
Showing 6 changed files with 62 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rvl-d3vis/src/main/resources/web/index.html
Original file line number Diff line number Diff line change
@@ -389,7 +389,7 @@
}

// call example projects on selecting from option list
d3.json(baseUrlBackend + "projects", function (error, projects) {
d3.json(getProjectsEndpoint(), function (error, projects) {

if (error != null) {
showErrorMessage(error);
22 changes: 21 additions & 1 deletion rvl-d3vis/src/main/resources/web/js/utils.js
Original file line number Diff line number Diff line change
@@ -12,4 +12,24 @@ function getProjectByID(projects, id) {

function showErrorMessage(error) {
alert("Sorry, an error occured. Status: " + error.statusText + " (" + error.statusText + "). " + error.responseText)
}
}

function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}


/* OGVIC-specific */

// show all projects or only public ones
function getProjectsEndpoint() {
var allProjects = getParameterByName("allProjects");
if (allProjects != null && allProjects == "true") {
return baseUrlBackend + "projects";
} else {
return baseUrlBackend + "projects/public";
}
}
Original file line number Diff line number Diff line change
@@ -44,6 +44,7 @@ public void initWithUseCaseTestProjects() throws FileNotFoundException {
useCaseAA.registerDataFile("/life-sciences/amino-acid/example-data/amino-acid.owl");
//useCaseAA.setD3Generator(new D3GeneratorTreeJSON());
useCaseAA.setD3Generator(new D3GeneratorDeepLabelsJSON());
useCaseAA.setPublish(false); // WIP
storeProject(useCaseAA);

VisProject useCaseAA_3 = new VisProject("aa-3");
@@ -76,6 +77,7 @@ public void initWithUseCaseTestProjects() throws FileNotFoundException {
//project.setRvlInterpreter(new SimpleRVLInterpreter());
// requires better filtering!
//project.setD3Generator(new D3GeneratorTreeJSON());
useCaseZFA_inheritance.setPublish(false); // WIP
storeProject(useCaseZFA_inheritance);

//////////////////////////////////////////////////////////////////
@@ -131,6 +133,7 @@ public void initWithUseCaseTestProjects() throws FileNotFoundException {
//project.registerDataFile("/software/ro/example-mappings/extra-data.ttl"));
project.registerDataFile("/software/ro/example-data/ro_v_1_4_1_incl_social_network_example.owl");
project.setD3Generator(new D3GeneratorTreeJSON());
project.setPublish(false); // too much

project = storeProject("ro-4b");
project.registerMappingFile("/software/ro/example-mappings/RO_4b.ttl");
@@ -174,6 +177,7 @@ public void initWithUseCaseTestProjects() throws FileNotFoundException {
project.registerDataFile("/software/ro/example-data/ogvic-requirements.ttl");
project.registerDataFile("/software/ro/example-data/ro_v_1_4_1_incl_social_network_example.owl");
project.setD3Generator(new D3GeneratorTreeJSON());
project.setPublish(false); // not suitable for public demo

project = storeProject("po");
project.registerMappingFile("/life-sciences/plant-ontology/example-mappings/experimental-wip.ttl");
@@ -196,6 +200,7 @@ public void initWithUseCaseTestProjects() throws FileNotFoundException {
project.registerMappingFile("/life-sciences/amino-acid/example-mappings/AA_4.ttl");
project.registerMappingFile("/life-sciences/amino-acid/example-mappings/AA_3.ttl");
project.registerDataFile("/life-sciences/amino-acid/example-data/amino-acid.owl");
project.setPublish(false); // not supported by editor right now

project = storeProject("tolkien");
project.registerDataFile("/library-and-publication/tolkien/example-data/tolkien-example-data.ttl");
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ public class VisProject {
private String name;
private String description;
private String defaultGraphicType;
private boolean publish = true;

@XmlTransient
private String avm;
@@ -279,4 +280,12 @@ public void setAvmJsonDirty(boolean genFromAvmDirty) {
this.avmJsonDirty = genFromAvmDirty;
}

public boolean isPublish() {
return publish;
}

public void setPublish(boolean publish) {
this.publish = publish;
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package org.purl.rvl.tooling.process;

import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
@@ -54,6 +56,7 @@ public void initWithUseCaseTestProjects() throws FileNotFoundException {
//useCaseVISOClasses.setRvlInterpreter(new SimpleRVLInterpreter());
useCaseVISOClasses.setD3Generator(new D3GeneratorTreeJSON());
//useCaseVISOClasses.setD3Generator(new D3GeneratorSimpleJSON());
useCaseVISOClasses.setPublish(false);
storeProject(useCaseVISOClasses);

//////////////////////////////////////////////////////////////////
@@ -145,6 +148,7 @@ public void initWithUseCaseTestProjects() throws FileNotFoundException {
project.registerDataFile(ExampleData.RVL_EXAMPLE);
project.registerDataFile(ExampleData.RVL_EXAMPLE_INFERRED_TRIPLES);
project.setD3Generator(new D3GeneratorDeepLabelsJSON());
project.setPublish(false); // still WIP

project = storeProject("rdf-id-test");
project.setReasoningDataModel(Reasoning.rdfs);
@@ -173,6 +177,7 @@ public void initWithUseCaseTestProjects() throws FileNotFoundException {
project.registerDataFile(ExampleData.RVL_EXAMPLE_INFERRED_TRIPLES);
//project.setRvlInterpreter(new SimpleRVLInterpreter());
//project.setD3Generator(new D3GeneratorTreeJSON());
project.setPublish(false); // still required at all?

project = storeProject("area-test");
project.setReasoningDataModel(Reasoning.rdfs);
@@ -198,6 +203,7 @@ public void initWithUseCaseTestProjects() throws FileNotFoundException {
project.registerDataFile(ExampleData.RVL_EXTRA_DATA);
project.setD3Generator(new D3GeneratorTreeJSON());
project.setDefaultGraphicType("circle-packing-zoomable");
project.setPublish(false); // too much

//////////////////////////////////////////////////////////////////
// "Bootstrapping" AVM (example)
@@ -208,6 +214,7 @@ public void initWithUseCaseTestProjects() throws FileNotFoundException {
project.registerDataFile("/example-data/avm-example-data.ttl");
project.registerDataFile(ExampleData.AVM_EXTRA_DATA);
project.setD3Generator(new D3GeneratorDeepLabelsJSON());
project.setPublish(false); // live-AVM available now

}

@@ -259,8 +266,17 @@ public static VisProjectLibrary getInstance() {
return instance;
}

public Collection<? extends VisProject> getProjects() {
public Collection<VisProject> getProjects() {
return library.values();
}

public List<VisProject> getPublicProjects() {
List<VisProject> publicProjects = new ArrayList<>();
for (VisProject project : library.values()) {
if (project.isPublish())
publicProjects.add(project);
}
return publicProjects;
}

}
Original file line number Diff line number Diff line change
@@ -78,7 +78,15 @@ public List<VisProject> getVisProjectsBrowser() {
return projects;
}

// Return the list of projects for applications
// Return the list of visualization projects that are ready for public demo
@GET
@Path("/public")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public List<VisProject> getPublicProjects() {
return VisProjectLibraryExamples.getInstance().getPublicProjects();
}

// Return the unfiltered list of visualization projects including WIP not intended for public demo
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public List<VisProject> getProjects() {

0 comments on commit f2c471d

Please sign in to comment.