monarch-initiative / owlsim-v3

Ontology Based Profile Matching
16 stars 5 forks source link

Adding ability to load individuals from in-memory data as well as off-disk. #71

Closed julesjacobsen closed 7 years ago

julesjacobsen commented 7 years ago

Fix for @drseb in issue #57 enabling individuals data to be loaded into the knowledgebase from a Map rather than off disk.

julesjacobsen commented 7 years ago

One question on naming. Should .loadDataFromMap(data) really be loadIndividuals? We still have no way of importing labels and presumably this requires different OWLAPI calls.

cmungall commented 7 years ago

individualAssociations would be more precise

We need the label loading to get human-friendly results returned. Some clients will have their own way of doing a lookup, others will rely on the service

addAxiom(df.getOWLAnnotationAssertionAxiom(df.getRDFSLabel(), 
ind.getIRI(), df.getOWLLiteral(label))
julesjacobsen commented 7 years ago

OK so these methods need to change their signatures too. Here 'data' means 'individualAssociations'. Does this make sense for loadDataFromOntology be changed to loadIndividualAssociationsFromOntology given these are actually just being merged? Should there just be a single set of loadOntology or loadInstancedOntology?

         public Loader loadDataFromOntology(String path) {
            sourceDataBuilder.dataOntology(path);
            return this;
        }

        public Loader loadDataFromOntologies(String... paths) {
            sourceDataBuilder.dataOntologies(paths);
            return this;
        }

        public Loader loadDataFromOntologies(Collection<String> paths) {
            sourceDataBuilder.dataOntologies(paths);
            return this;
        }

        public Loader loadDataFromTsv(String path) {
            sourceDataBuilder.dataTsv(path);
            return this;
        }

        public Loader loadDataFromTsv(String... paths) {
            sourceDataBuilder.dataTsv(paths);
            return this;
        }

        public Loader loadDataFromTsv(Collection<String> paths) {
            sourceDataBuilder.dataTsv(paths);
            return this;
        }

        public Loader loadDataFromMap(Map<String, ? extends Collection<String>> data) {
            sourceDataBuilder.data(data);
            return this;
       }
julesjacobsen commented 7 years ago

@cmungall / @jnguyenx can you comment on this further or merge this please. We can add the labels in another PR.

drseb commented 7 years ago

I think it is good. Thanks. Can't test this right now.

julesjacobsen commented 7 years ago

OK, cheers for looking. @drseb I think this should make it possible to do what you need. If not, open another ticket.

drseb commented 7 years ago

Thanks. I will test ASAP