Code Monkey home page Code Monkey logo

Comments (1)

JustasB avatar JustasB commented on September 4, 2024

Hi, Justas -

I have included below my queries in support of the NIF integration to return null values when the metadata does not exist and to return a collection of values as one field, e.g., authors.
I have not defined the views that are shown as comments at this point.
I still need to put this all together for NIF.
I would like you to look at the detailed plan (sent in an earlier email) and
verify these queries before our Wednesday meeting, if possible.

See you then,
Suzanne


use neuromldb;

-- create view model_ID_NAME_TYPE as
select Cell_ID as Model_ID, Cell_Name as Model_Name, "Cell" as Model_Type from cells union select Channel_ID as Model_ID, Channel_Name as Model_Name, "Channel" as Model_Type from channels union select Network_ID as Model_ID, Network_Name as Model_Name, "Network" as Model_Type from networks union select Synapse_ID as Model_ID, Synapse_Name as Model_Name, "Synapse" as Model_Type from synapses ;

-- create view model_neurolexes as
select m.Model_ID, nl.NeuroLex_URI, nl.NeuroLex_Term from models m left join (select mma.Model_ID, n.NeuroLex_URI, n.NeuroLex_Term
from model_metadata_associations mma join neurolexes n
on mma.Metadata_ID = n.NeuroLex_ID) nl on m.Model_ID = nl.Model_ID order by m.Model_ID;

-- create view model_publications as
select m.Model_ID, pub.Pubmed_Ref, pub.Full_Title as Pubmed_Title from models m left join (select mma.Model_ID, p.Pubmed_Ref, p.Full_Title
from model_metadata_associations mma join publications p
on mma.Metadata_ID = p.Publication_ID) pub
on m.Model_ID = pub.Model_ID order by m.Model_ID;

-- create view model_keywords as
select m.Model_ID, k.keywords as Keywords from models m left join (select mma.Model_ID, group_concat(ok.Other_Keyword_term) as keywords from model_metadata_associations mma join other_keywords ok
on mma.Metadata_ID = ok.Other_Keyword_ID group by mma.Model_ID) k on m.Model_ID = k.Model_ID order by m.Model_ID;

-- create view model_authors as
select m.Model_ID, aut.Authors
from models m left join
(select mma.Model_ID, group_concat(CONCAT(p.Person_First_Name, ' ', p.Person_Last_Name) SEPARATOR ', ') as Authors
from model_metadata_associations mma join author_lists al on mma.Metadata_ID = al.AuthorList_ID
join author_list_associations ala on al.AuthorList_ID = ala.AuthorList_ID
join people p on ala.Person_ID = p.Person_ID where ala.is_translator='0' or ala.is_translator='2'
group by mma.Model_ID) aut
on m.Model_ID = aut.Model_ID
order by m.Model_ID;

-- model with its "associated (parent or child) models
select m.Model_ID, group_concat(a.associated_Model_ID SEPARATOR ', ') as Associated_Models
from models m left join (select m.Model_ID, child as associated_Model_ID
from models m join partof_tables p
where m.Model_ID = p.parent
union
select m.Model_ID, parent as associated_Model_ID
from models m join partof_tables p
where m.Model_ID = p.child) a
on m.Model_ID = a.Model_ID
group by m.Model_ID
order by m.Model_ID ;

from neuroml-db.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.