tetherless-world / nanomine-graph

the visualization web app for nanomine project
MIT License
1 stars 4 forks source link

Edge cases in current sample rdfs:label scheme (zero or 2+ filler materials, 2+ matrix materials) #53

Open mdeagen opened 3 years ago

mdeagen commented 3 years ago

Current labeling scheme ("X in Y", where X is label of filler material and Y is label of matrix material) works in the base case of 1 filler and 1 matrix, but not other configurations.

Examples: 1) No Filler material (label reads e.g. "in polystyrene") 2) 2+ Filler materials (e.g. Graphene oxide, Titanium dioxide... label reads "Graphene Oxide in polystyrene") 3) 2+ Matrix materials (e.g. Poly(methyl methacrylate); Polystyrene; Poly(ethylene-vinyl acetate)... label reads "montmorillonite in polystyrene")

Reference SPARQL query:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sio: <http://semanticscience.org/resource/>
PREFIX mm: <http://materialsmine.org/ns/>
SELECT ?sample ?sample_label 
  (GROUP_CONCAT(DISTINCT ?component; SEPARATOR="; ") AS ?FillerComponents) 
  (COUNT(DISTINCT ?component) AS ?Filler_Count) 
WHERE {
    ?sample sio:hasComponentPart [ a [ rdfs:label ?component ] ;
                                   sio:hasRole [ a mm:Matrix ] ] ; # change to mm:Filler to see results for Filler materials
          rdfs:label ?sample_label . 

 # uncomment to see samples comprising only Matrix (control samples, without filler)
 # FILTER NOT EXISTS{ ?sample sio:hasComponentPart/sio:hasRole/a mm:Filler } 
} GROUP BY ?sample ?sample_label
ORDER BY DESC (?Filler_Count)

Reference screenshots: image

image