Skip to content

Commit

Permalink
Merge pull request #52 from halcyon-project/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ebremer authored Dec 15, 2023
2 parents 4078793 + 594acbb commit 3b32f8c
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ public void onClick() {
DataCore.getInstance().ReloadSECM();
AccessCachePool.getPool().getKeys().forEach(k->{
System.out.println("Clear key pool --> "+k);
AccessCachePool.getPool().clear(k);

AccessCachePool.getPool().clear(k);
});
}
};
Expand Down
6 changes: 3 additions & 3 deletions Halcyon/src/main/java/com/ebremer/halcyon/puffin/Puffin.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ public Puffin() {
ds.end();
RDFDataMgr.write(System.out, m, Lang.TURTLE);
Model target = ModelFactory.createDefaultModel();
Resource r = target.createResource("https://www.ebremer.com/myfirstcolorlist");
Resource r = target.createResource("https://halcyon.is/res/myfirstcolorlist");
r.addProperty(RDF.type, HAL.AnnotationClassList);
r.addProperty(SchemaDO.name, "My first annotation class list!");
r.addProperty(SchemaDO.name, r.getModel().createResource("http://www.google.com"));
r.addProperty(SchemaDO.name, "HI!");
Resource bn = target.createResource();
bn.addProperty(HAL.hasClassification, SNO.Lymphocytes).addProperty(HAL.color, "#0000ff").addProperty(RDF.type, HAL.AnnotationClass);
bn.addProperty(HAL.classification, SNO.Lymphocytes).addProperty(HAL.color, "#0000ff").addProperty(RDF.type, HAL.AnnotationClass);
r.addProperty(HAL.hasAnnotationClass, bn);
bn = target.createResource();
bn.addProperty(HAL.hasClassification, SNO.Necrosis).addProperty(HAL.color, "#00ff00").addProperty(RDF.type, HAL.AnnotationClass);
bn.addProperty(HAL.classification, SNO.Necrosis).addProperty(HAL.color, "#00ff00").addProperty(RDF.type, HAL.AnnotationClass);
r.addProperty(HAL.hasAnnotationClass, bn);
SHACLForm sf = new SHACLForm("sform", r, HAL.AnnotationClassListShape.asNode(), null);
add(sf);
Expand Down
2 changes: 1 addition & 1 deletion Halcyon/src/main/java/com/ebremer/halcyon/server/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public FilterRegistrationBean<HALKeycloakOIDCFilter> KeycloakOIDCFilterFilterReg
registration.addUrlPatterns("/*");
registration.setOrder(Ordered.HIGHEST_PRECEDENCE);
registration.addInitParameter(KeycloakOIDCFilter.CONFIG_FILE_PARAM, "keycloak.json");
registration.addInitParameter(KeycloakOIDCFilter.SKIP_PATTERN_PARAM, "(^/skunkworks/.*|^/puffin.*|^/threejs/.*|^/halcyon.*|^/zephyr/.*|^/rdf.*|^/talon/.*|/;jsessionid=.*|/gui/images/halcyon.png|^/wicket/resource/.*|^/multi-viewer.*|^/iiif.*|^/|^/about|^/ListImages.*|^/wicket/resource/com.*\\.css||^/auth/.*|^/favicon.ico)");
registration.addInitParameter(KeycloakOIDCFilter.SKIP_PATTERN_PARAM, "(^/h2.*|^/skunkworks/.*|^/puffin.*|^/threejs/.*|^/halcyon.*|^/zephyr/.*|^/rdf.*|^/talon/.*|/;jsessionid=.*|/gui/images/halcyon.png|^/wicket/resource/.*|^/multi-viewer.*|^/iiif.*|^/|^/about|^/ListImages.*|^/wicket/resource/com.*\\.css||^/auth/.*|^/favicon.ico)");
registration.setEnabled(true);
return registration;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public FilterRegistrationBean<WicketFilter> wicketFilterRegistration(){
registration.setOrder(5000);
registration.addInitParameter(ContextParamWebApplicationFactory.APP_CLASS_PARAM, HalcyonApplication.class.getName());
registration.addInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*");
registration.addInitParameter(IGNORE_PATHS_PARAM, "/skunkworks,/login,/auth,/three.js/,/multi-viewer/,/iiif/,/halcyon/,/images/,/favicon.ico,/rdf,/talon/,/threejs/,/zephyr/,/rdf/");
registration.addInitParameter(IGNORE_PATHS_PARAM, "/h2,/skunkworks,/login,/auth,/three.js/,/multi-viewer/,/iiif/,/halcyon/,/images/,/favicon.ico,/rdf,/talon/,/threejs/,/zephyr/,/rdf/");
return registration;
}
}
3 changes: 2 additions & 1 deletion Halcyon/src/main/java/com/ebremer/halcyon/sparql/Sparql.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ <h2>SPARQL Endpoint</h2>
var tab = yasgui.getTab();
//tab.setQuery("select *\nwhere {graph ?g {?s ?p ?o}}\nlimit 20");
tab.yasqe.addPrefixes({ so: "https://schema.org/" });
tab.yasqe.addPrefixes({hal: "https://www.ebremer.com/halcyon/ns/" });
tab.yasqe.addPrefixes({hal: "https://halcyon.is/ns/" });
tab.yasqe.addPrefixes({rdfs: "http://www.w3.org/2000/01/rdf-schema#" });
tab.yasqe.addPrefixes({rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#" });
tab.yasqe.addPrefixes({exif: "http://www.w3.org/2003/12/exif/ns#" });
tab.yasqe.addPrefixes({owl: "http://www.w3.org/2002/07/owl#" });
tab.yasqe.addPrefixes({loc: "http://id.loc.gov/vocabulary/preservation/cryptographicHashFunctions/" });
tab.yasqe.addPrefixes({geo: "http://www.opengis.net/ont/geosparql#" });
tab.yasqe.addPrefixes({dct: "http://purl.org/dc/terms/" });
tab.yasqe.addPrefixes({prov: "http://www.w3.org/ns/prov#" });
tab.yasqe.collapsePrefixes(true);
</script>
</wicket:extend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.jena.query.Dataset;
import org.apache.jena.query.DatasetFactory;
import org.apache.jena.query.ParameterizedSparqlString;
Expand All @@ -46,6 +44,7 @@
import org.apache.jena.vocabulary.RDF;
import org.apache.jena.vocabulary.RDFS;
import org.apache.jena.vocabulary.SchemaDO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
Expand All @@ -54,7 +53,7 @@
*/
public class FeatureManager {

private static final org.slf4j.Logger logger = LoggerFactory.getLogger(FeatureManager.class);
private static final Logger logger = LoggerFactory.getLogger(FeatureManager.class);

public static String getFeatures(HashSet<String> features, String urn) {
Dataset ds = DataCore.getInstance().getDataset();
Expand Down Expand Up @@ -89,6 +88,7 @@ public static String getFeatures(HashSet<String> features, String urn) {
pss.setIri("image", urn);
pss.setValues("selected", createactions);
ds.begin(ReadWrite.READ);
logger.debug(pss.toString());
ResultSet results = QueryExecutionFactory.create(pss.toString(), ds).execSelect().materialise();
ds.end();
ArrayList<RDFNode> roc = new ArrayList<>();
Expand All @@ -111,6 +111,7 @@ public static String getFeatures(HashSet<String> features, String urn) {
pss.setNsPrefix("rdf", RDF.uri);
pss.setValues("selected", roc);
ds.begin(ReadWrite.READ);
logger.debug(pss.toString());
ResultSet rs = QueryExecutionFactory.create(pss.toString(), ds).execSelect().materialise();
ds.end();
record ColorCode(String color, int code, String name) {}
Expand Down Expand Up @@ -258,7 +259,7 @@ record ColorCode(String color, int code, String name) {}
out.writeObject(jo);
hold = new String(baos.toByteArray());
} catch (JsonLdError ex) {
Logger.getLogger(FeatureManager.class.getName()).log(Level.SEVERE, null, ex);
logger.error(ex.toString());
}
return HFrame.wow(hold);
}
Expand Down
2 changes: 1 addition & 1 deletion Halcyon/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ logging:
max-history: 10
level:
root: ERROR
com.ebremer.halcyon: ERROR
com.ebremer.halcyon: DEBUG
com.ebremer.beakgraph: ERROR
#org.apache.wicket.Application: ERROR
#org.keycloak.adapters: TRACE
Expand Down
14 changes: 10 additions & 4 deletions halcyon-core/src/main/java/com/ebremer/halcyon/FL/FLHeatmap.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.ebremer.halcyon.raptor.Objects.Scale;
import com.ebremer.halcyon.lib.GeometryTools;
import com.ebremer.ns.GEO;
import com.ebremer.ns.PROVO;
import jakarta.json.Json;
import jakarta.json.JsonArray;
import jakarta.json.JsonObject;
Expand Down Expand Up @@ -54,7 +53,6 @@
import org.apache.jena.sparql.vocabulary.DOAP;
import org.apache.jena.vocabulary.DCTerms;
import org.apache.jena.vocabulary.RDF;
import org.apache.jena.vocabulary.RDFS;
import org.apache.jena.vocabulary.SchemaDO;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Polygon;
Expand Down Expand Up @@ -277,6 +275,13 @@ private Model LoadManifest() {

@Override
public Model LoadExtendedManifest() {
logger.info("Loading ROCrate Manifest");
Model hh = ModelFactory.createDefaultModel();
BeakGraph bg = BeakGraphPool.getPool().borrowObject(uri);
hh.add(bg.getReader().getManifest());
BeakGraphPool.getPool().returnObject(uri, bg);
return hh;
/*
Model hh = ModelFactory.createDefaultModel();
BeakGraph bg = BeakGraphPool.getPool().borrowObject(uri);
Dataset ds = DatasetFactory.wrap(new BGDatasetGraph(bg));
Expand All @@ -289,7 +294,7 @@ public Model LoadExtendedManifest() {
dct:title ?title;
prov:wasGeneratedBy [ a prov:Activity; prov:used ?used; prov:wasAssociatedWith ?wasAssociatedWith ] .
?fc dct:creator ?creator .
?fc dct:publisherr ?publisher .
?fc dct:publisher ?publisher .
?fc dct:references ?references .
?fc hal:hasClassification ?hasClassification .
?fc dct:contributor ?contributor .
Expand All @@ -300,7 +305,7 @@ public Model LoadExtendedManifest() {
dct:title ?title;
prov:wasGeneratedBy [ a prov:Activity; prov:used ?used; prov:wasAssociatedWith ?wasAssociatedWith ] .
optional { ?fc dct:creator ?creator }
optional { ?fc dct:publisherr ?publisherr }
optional { ?fc dct:publisher ?publisher }
optional { ?fc dct:references ?references }
optional { ?fc hal:hasClassification ?hasClassification }
optional { ?fc dct:contributor ?contributor }
Expand All @@ -315,6 +320,7 @@ public Model LoadExtendedManifest() {
pss.setNsPrefix("rdfs", RDFS.uri);
pss.setNsPrefix("prov", PROVO.NS);
return QueryExecutionFactory.create(pss.toString(), hh).execConstruct();
*/
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.ebremer.halcyon.lib.GeometryTools;
import com.ebremer.halcyon.utils.ImageTools;
import com.ebremer.ns.GEO;
import com.ebremer.ns.PROVO;
import jakarta.json.Json;
import jakarta.json.JsonArray;
import jakarta.json.JsonObject;
Expand Down Expand Up @@ -60,7 +59,6 @@
import org.apache.jena.sparql.vocabulary.DOAP;
import org.apache.jena.vocabulary.DCTerms;
import org.apache.jena.vocabulary.RDF;
import org.apache.jena.vocabulary.RDFS;
import org.apache.jena.vocabulary.SchemaDO;
import org.locationtech.jts.geom.Polygon;
import org.slf4j.Logger;
Expand Down Expand Up @@ -236,18 +234,21 @@ private Model LoadManifest() {
public Model LoadExtendedManifest() {
logger.info("Loading ROCrate Manifest");
Model hh = ModelFactory.createDefaultModel();
BeakGraph bg = BeakGraphPool.getPool().borrowObject(uri);
Dataset ds = DatasetFactory.wrap(new BGDatasetGraph(bg));
hh.add(ds.getDefaultModel());
BeakGraphPool.getPool().returnObject(uri, bg);
BeakGraph bg = BeakGraphPool.getPool().borrowObject(uri);
//Dataset ds = DatasetFactory.wrap(new BGDatasetGraph(bg));
//hh.add(ds.getDefaultModel());
hh.add(bg.getReader().getManifest());
BeakGraphPool.getPool().returnObject(uri, bg);
return hh;
/*
ParameterizedSparqlString pss = new ParameterizedSparqlString(
"""
construct {
?fc a geo:FeatureCollection;
dct:title ?title;
prov:wasGeneratedBy [ a prov:Activity; prov:used ?used; prov:wasAssociatedWith ?wasAssociatedWith ] .
?fc dct:creator ?creator .
?fc dct:publisherr ?publisher .
?fc dct:publisher ?publisher .
?fc dct:references ?references .
?fc hal:hasClassification ?hasClassification .
?fc dct:contributor ?contributor .
Expand All @@ -258,7 +259,7 @@ public Model LoadExtendedManifest() {
dct:title ?title;
prov:wasGeneratedBy [ a prov:Activity; prov:used ?used; prov:wasAssociatedWith ?wasAssociatedWith ] .
optional { ?fc dct:creator ?creator }
optional { ?fc dct:publisherr ?publisherr }
optional { ?fc dct:publisher ?publisher }
optional { ?fc dct:references ?references }
optional { ?fc hal:hasClassification ?hasClassification }
optional { ?fc dct:contributor ?contributor }
Expand All @@ -273,6 +274,7 @@ public Model LoadExtendedManifest() {
pss.setNsPrefix("rdfs", RDFS.uri);
pss.setNsPrefix("prov", PROVO.NS);
return QueryExecutionFactory.create(pss.toString(), hh).execConstruct();
*/
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,6 @@ public void Process(BeakWriter bw, Dataset ds) {
Resource FC = last.listResourcesWithProperty(RDF.type, GEO.FeatureCollection).next();
FC.addProperty(RDFS.member, bw.getTarget());
bw.getROC().getManifest().getManifestModel().add(last);
//Model man = bw.getROC().getManifest().getManifestModel();
//man.setNsPrefix("bg", BG.NS);
//man.setNsPrefix("prov", PROVO.NS);
logger.debug("Heatmap process finished...");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ public void FindClassifications(Dataset ds) {
?featureCollection hal:hasClassification ?class
}
where {
?featureCollection
a geo:FeatureCollection;
?featureCollection a geo:FeatureCollection;
rdfs:member ?feature .
?feature hal:classification ?class
}
Expand Down Expand Up @@ -420,9 +419,6 @@ public void Process(BeakWriter bw, Dataset ds) {
}
"""
);
// ?featureCollection a geo:FeatureCollection; prov:wasGeneratedBy ?activity; hal:hasClassification ?classification .
//?activity a prov:Activity; prov:used ?used; prov:wasAssociatedWith ?wasAssociatedWith .
//?used ?up ?uo
pssx.setNsPrefix("so", SchemaDO.NS);
pssx.setNsPrefix("geo", GEO.NS);
pssx.setNsPrefix("dcterms", DCTerms.NS);
Expand Down Expand Up @@ -463,13 +459,8 @@ public void Process(BeakWriter bw, Dataset ds) {
pssx.setNsPrefix("dcterms", DCTerms.NS);
qe = QueryExecutionFactory.create(pssx.toString(), ds.getDefaultModel());
last.add(qe.execConstruct());
//Resource activity = last.listResourcesWithProperty(RDF.type, PROVO.Activity).next();
Resource FC = last.listResourcesWithProperty(RDF.type, GEO.FeatureCollection).next();
//activity.addProperty(SchemaDO.result, bw.getTarget());
FC.addProperty(RDFS.member, bw.getTarget());
bw.getROC().getManifest().getManifestModel().add(last);
//Model man = bw.getROC().getManifest().getManifestModel();
//man.setNsPrefix("bg", BG.NS);
//man.setNsPrefix("prov", PROVO.NS);
}
}
29 changes: 0 additions & 29 deletions ingest/src/main/java/com/ebremer/halcyon/converters/NS2GS.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import org.apache.jena.vocabulary.RDFS;
import org.apache.jena.vocabulary.SchemaDO;
import org.apache.jena.vocabulary.XSD;
import org.slf4j.LoggerFactory;

/**
*
Expand Down Expand Up @@ -264,31 +263,3 @@ public Model call() {
}
}
}

/*
Resource root = m.createResource()
.addProperty(SchemaDO.creator, m.createResource("http://orcid.org/0000-0003-0223-1059"))
.addProperty(RDF.type, SchemaDO.Dataset)
.addLiteral(SchemaDO.keywords, "Whole Slide Imaging")
.addLiteral(SchemaDO.keywords, "pathology")
.addProperty(SchemaDO.datePublished, dateTimeLiteral)
.addLiteral(SchemaDO.keywords, "nuclear segmentation")
.addLiteral(SchemaDO.description, "Nuclear segmentation of TCGA cancer types")
.addLiteral(SchemaDO.name, "cnn-nuclear-segmentations-2019")
.addProperty(SchemaDO.instrument, m.createResource("https://github.com/SBU-BMI/quip_cnn_segmentation/releases/tag/v1.1"))
.addProperty(SchemaDO.publisher, m.createResource("https://ror.org/05qghxh33"))
.addProperty(SchemaDO.publisher, m.createResource("https://ror.org/01882y777"));
root.addProperty(SchemaDO.hasPart, CA);
*/

/*
Resource CA = m.createResource()
.addProperty(RDF.type, SchemaDO.CreateAction)
.addLiteral(SchemaDO.name, "cnn-nuclear-segmentations-2019")
.addLiteral(SchemaDO.description, "cnn-nuclear-segmentations-2019")
.addProperty(SchemaDO.object, image)
.addProperty(SchemaDO.result, SpatialObjectCollection);
*/

0 comments on commit 3b32f8c

Please sign in to comment.