Skip to content

Commit

Permalink
Merge branch 'issue-544' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
balhoff committed Jul 29, 2024
2 parents 7197be2 + 532cc63 commit 1298312
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.openrdf.repository.RepositoryException;
import org.semanticweb.owlapi.model.IRI;

import javax.annotation.Nullable;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.io.IOException;
Expand Down Expand Up @@ -89,18 +90,21 @@ static public class ModelMeta {
private String date;
private String title;
private String state;
@SerializedName("conforms-to-gpad")
private Boolean conformsToGPAD;
private Set<String> contributors;
private Set<String> groups;
private HashMap<String, Set<String>> query_match;

@SerializedName("modified-p")
private boolean modified;

public ModelMeta(String id, String date, String title, String state, Set<String> contributors, Set<String> groups, boolean modified) {
public ModelMeta(String id, String date, String title, String state, @Nullable Boolean conformsToGPAD, Set<String> contributors, Set<String> groups, boolean modified) {
this.id = id;
this.date = date;
this.title = title;
this.state = state;
this.conformsToGPAD = conformsToGPAD;
this.contributors = contributors;
this.groups = groups;
this.modified = modified;
Expand Down Expand Up @@ -150,6 +154,15 @@ public void setState(String state) {
this.state = state;
}

@Nullable
public Boolean getConformsToGPAD() {
return this.conformsToGPAD;
}

public void setConformsToGPAD(Boolean conforms) {
this.conformsToGPAD = conforms;
}

public Set<String> getContributors() {
return contributors;
}
Expand Down Expand Up @@ -454,7 +467,7 @@ public ModelSearchResult search(Set<String> taxa,
String group_by_constraint = "GROUP BY ?id";
//default return block
//TODO investigate need to add DISTINCT to GROUP_CONCAT here
String return_block = "?id (MIN(?date) AS ?mindate) (MIN(?title) AS ?mintitle) (MIN(?state) AS ?minstate) <ind_return_list> (GROUP_CONCAT(DISTINCT ?contributor;separator=\";\") AS ?contributors) (GROUP_CONCAT(DISTINCT ?group;separator=\";\") AS ?groups)";
String return_block = "?id (MIN(?date) AS ?mindate) (MIN(?title) AS ?mintitle) (MIN(?state) AS ?minstate) (MIN(?conformsToGPAD) AS ?minConformsToGPAD) <ind_return_list> (GROUP_CONCAT(DISTINCT ?contributor;separator=\";\") AS ?contributors) (GROUP_CONCAT(DISTINCT ?group;separator=\";\") AS ?groups)";
if (count != null) {
return_block = "(count(distinct ?id) as ?count)";
limit_constraint = "";
Expand Down Expand Up @@ -525,6 +538,12 @@ public ModelSearchResult search(Set<String> taxa,
if (state_binding != null) {
state = state_binding.getValue().stringValue();
}
Binding conformanceBinding = bs.getBinding("minConformsToGPAD");
Boolean conformance = null;
if (conformanceBinding != null) {
System.out.println("CONFORMANCE: " + conformanceBinding.getValue().stringValue());
conformance = Boolean.valueOf(conformanceBinding.getValue().stringValue());
}
Binding group_binding = bs.getBinding("groups");
String groups_ = "";
if (group_binding != null) {
Expand All @@ -539,7 +558,7 @@ public ModelSearchResult search(Set<String> taxa,
if (mm == null) {
//look up model in in-memory cache to check edit state
boolean is_modified = m3.isModelModified(model_iri);
mm = new ModelMeta(model_curie, date, title, state, contributors, groups, is_modified);
mm = new ModelMeta(model_curie, date, title, state, conformance, contributors, groups, is_modified);
}
//matching
for (String ind : ind_return.keySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ GRAPH ?id {
<http://purl.org/dc/elements/1.1/contributor> ?contributor ;
optional{?id <http://purl.org/pav/providedBy> ?group } .
optional{?id lego:modelstate ?state } .
optional{?id lego:conforms_to_gpad ?conformsToGPAD}
<types>
<state_constraint>
<contributor_constraint>
Expand Down

0 comments on commit 1298312

Please sign in to comment.