PennTURBO / semantic-engine

TURBO semantic engine (Drivetrain). Transforms source-dependent RDF data into a source-independent, semantically rich RDF model.
6 stars 0 forks source link

How to find reusable patterns in Acorn files? #50

Closed turbomam closed 4 years ago

turbomam commented 5 years ago

There's no need for multiple specifications (recipes?) saying that an encounter-denoting CRID, and a person-denoting CRIDS, etc. have symbol parts.

There's probably re-usability opportunities in literals and contexts, too.

greenguy33 commented 5 years ago

I don't understand this issue. Can you give an example? There is no reason a recipe cannot be the input or output of multiple process specifications.

Similarly, literals, object describers, and contexts can be used in multiple connection recipes.

turbomam commented 5 years ago

Yes, I definitely want to find more opportunities for reuse, not less.

Based on 2019-10-28 TURBO meeting, we'll save refactoring opportunities for later.

I think I have some ideas for finding these opportunities with handcrafted SPARQL statements, but it would be nice to roll that into Drivetrain itself.

turbomam commented 5 years ago

Only pasting patterns with a count > 1 here:

s p o count
owl:Axiom oboInOwl:hasDbXref ontologies:TURBO_0010404 45
obo:IAO_0000028 obo:BFO_0000050 ontologies:TURBO_0010433 21
ontologies:TURBO_0010433 obo:IAO_0000219 ontologies:TURBO_0010404 18
obo:IAO_0000028 obo:BFO_0000050 obo:IAO_0000578 12
owl:Axiom owl:annotatedTarget obo:NCBITaxon_9606 9
ontologies:TURBO_0010433 obo:IAO_0000219 obo:IAO_0000416 6
obo:PDRO_0000024 obo:IAO_0000136 obo:NCBITaxon_9606 6
obo:IAO_0000578 obo:IAO_0000219 obo:NCBITaxon_9606 6
obo:IAO_0000578 obo:BFO_0000051 ontologies:TURBO_0010255 6
obo:IAO_0000578 obo:BFO_0000051 ontologies:TURBO_0010256 6
obo:PDRO_0000024 obo:BFO_0000050 drivetrain:RxColumnTerm 6
owl:Axiom owl:annotatedSource drivetrain:EncToBeTyped 5
ontologies:TURBO_0010404 ontologies:TURBO_0010094 drivetrain:person_keysym_LiteralValue 5
ontologies:TURBO_0010433 obo:IAO_0000219 obo:PDRO_0000024 4
owl:Axiom owl:annotatedSource drivetrain:MeasToBeTyped 4
ontologies:TURBO_0010404 ontologies:TURBO_0010094 drivetrain:visit_occurrence_id_IntegerLiteralValue 4
owl:Axiom owl:annotatedProperty obo:BFO_0000050 3
owl:Axiom owl:annotatedProperty obo:IAO_0000136 3
obo:OGMS_0000073 obo:IAO_0000136 obo:NCBITaxon_9606 3
drivetrain:GidToBeTyped obo:IAO_0000136 obo:NCBITaxon_9606 3
drivetrain:MeasToBeTyped obo:IAO_0000136 obo:NCBITaxon_9606 3
drivetrain:RidToBeTyped obo:IAO_0000136 obo:NCBITaxon_9606 3
ontologies:TURBO_0010433 obo:IAO_0000219 obo:NCBITaxon_9606 3
http://api.stardog.com/person ontologies:TURBO_0010113 obo:NCBITaxon_9606 3
drivetrain:WrittenNotDispensedMOD rdfs:subClassOf obo:OBI_0000011 3
obo:NCBITaxon_9606 obo:RO_0000087 obo:OBI_0000093 3
owl:Axiom owl:annotatedProperty obo:OBI_0000299 3
drivetrain:EncClassList rdfs:subClassOf obo:OGMS_0000097 3
drivetrain:PrevencsClass rdfs:subClassOf obo:OGMS_0000097 3
obo:NCBITaxon_9606 ontologies:TURBO_0000303 obo:UBERON_0035946 3
ontologies:TURBO_0010433 obo:BFO_0000051 ontologies:TURBO_0010269 3
ontologies:TURBO_0010433 obo:BFO_0000051 ontologies:TURBO_0010396 3
ontologies:TURBO_0010433 obo:BFO_0000051 ontologies:TURBO_0010398 3
ontologies:TURBO_0010433 obo:BFO_0000051 ontologies:TURBO_0010407 3
obo:OBI_0001933 obo:BFO_0000050 ontologies:TURBO_0010411 3
ontologies:TURBO_0010404 obo:BFO_0000050 ontologies:TURBO_0010423 3
drivetrain:GidToBeTyped obo:BFO_0000050 ontologies:TURBO_0010431 3
drivetrain:RidToBeTyped obo:BFO_0000050 ontologies:TURBO_0010441 3
ontologies:TURBO_0010433 obo:BFO_0000050 ontologies:TURBO_0010442 3
efo:EFO_0004950 obo:BFO_0000050 ontologies:TURBO_0010443 3
obo:IAO_0000028 obo:BFO_0000050 ontologies:TURBO_0010444 3
ontologies:TURBO_0010404 obo:BFO_0000050 ontologies:TURBO_0010447 3
ontologies:TURBO_0010404 obo:BFO_0000050 ontologies:TURBO_0010449 3
obo:IAO_0000416 obo:BFO_0000050 ontologies:TURBO_0010451 3
obo:IAO_0000028 obo:BFO_0000050 ontologies:TURBO_0010453 3
obo:IAO_0000028 obo:BFO_0000050 ontologies:TURBO_0010455 3
obo:IAO_0000416 obo:BFO_0000050 ontologies:TURBO_0010457 3
ontologies:TURBO_0010404 obo:BFO_0000050 ontologies:TURBO_0010459 3
ontologies:TURBO_0010404 obo:BFO_0000050 ontologies:TURBO_0010464 3
obo:IAO_0000028 obo:BFO_0000050 ontologies:TURBO_0010465 3
ontologies:TURBO_0010404 obo:BFO_0000050 ontologies:TURBO_0010466 3
ontologies:TURBO_0010404 obo:BFO_0000050 ontologies:TURBO_0010469 3
ontologies:TURBO_0010404 obo:BFO_0000050 ontologies:TURBO_0010470 3
obo:IAO_0000416 obo:BFO_0000050 ontologies:TURBO_0010472 3
obo:IAO_0000028 obo:BFO_0000050 ontologies:TURBO_0010482 3
ontologies:TURBO_0010404 obo:BFO_0000050 ontologies:TURBO_0010483 3
obo:IAO_0000416 obo:BFO_0000050 ontologies:TURBO_0010484 3
ontologies:TURBO_0010404 obo:BFO_0000050 ontologies:TURBO_0010486 3
ontologies:TURBO_0010404 obo:BFO_0000050 ontologies:TURBO_0010487 3
ontologies:TURBO_0010404 obo:BFO_0000050 ontologies:TURBO_0010488 3
ontologies:TURBO_0010433 obo:BFO_0000051 ontologies:TURBO_0010510 3
obo:IAO_0000028 obo:BFO_0000050 ontologies:TURBO_0010602 3
obo:IAO_0000416 obo:BFO_0000050 ontologies:TURBO_0010604 3
obo:OGMS_0000073 obo:BFO_0000050 ontologies:TURBO_0010605 3
ontologies:TURBO_0010404 obo:BFO_0000050 ontologies:TURBO_0010701 3
ontologies:TURBO_0010404 obo:BFO_0000050 ontologies:TURBO_0010702 3
ontologies:TURBO_0010404 obo:BFO_0000050 ontologies:TURBO_0010703 3
ontologies:TURBO_0010404 obo:BFO_0000050 ontologies:TURBO_0010704 3
obo:IAO_0000028 obo:BFO_0000050 ontologies:TURBO_0010705 3
obo:IAO_0000416 obo:BFO_0000050 ontologies:TURBO_0010706 3
owl:Axiom owl:annotatedProperty rdf:type 3
drivetrain:ProcToBeTyped obo:BFO_0000050 drivetrain:EncToBeTyped 3
owl:Axiom owl:annotatedSource drivetrain:ProcToBeTyped 3
ontologies:TURBO_0010433 obo:BFO_0000051 drivetrain:RxSourcedenTerm 3
obo:IAO_0000416 obo:IAO_0000136 obo:BFO_0000035 2
owl:Axiom owl:annotatedProperty obo:BFO_0000055 2
ontologies:TURBO_0010433 obo:IAO_0000219 obo:IAO_0000028 2
drivetrain:MeasClassList rdfs:subClassOf obo:IAO_0000109 2
obo:PDRO_0000024 obo:IAO_0000581 obo:IAO_0000416 2
owl:Axiom owl:annotatedTarget obo:OBI_0000093 2
ontologies:TURBO_0010433 obo:IAO_0000219 obo:OGMS_0000073 2
drivetrain:EncToBeTyped obo:OBI_0000299 obo:PDRO_0000024 2
http://api.stardog.com/drug_exposure ontologies:TURBO_0010113 obo:PDRO_0000024 2
owl:Axiom owl:annotatedSource obo:PDRO_0000024 2
owl:Axiom owl:annotatedTarget obo:PDRO_0000024 2
obo:IAO_0000578 obo:IAO_0000219 drivetrain:EncToBeTyped 2
ontologies:TURBO_0010433 obo:IAO_0000219 drivetrain:EncToBeTyped 2
owl:Axiom owl:annotatedTarget drivetrain:EncToBeTyped 2
ontologies:TURBO_0010433 obo:IAO_0000219 drivetrain:MeasToBeTyped 2
obo:PDRO_0000024 obo:IAO_0000142 drivetrain:RxMentionedClassList 2
obo:PDRO_0000024 ontologies:TURBO_0010094 drivetrain:drug_source_value_StringLiteralValue 2
http://api.stardog.com/visit_occurrence http://api.stardog.com/visit_occurrence#person_id drivetrain:person_keysym_LiteralValue 2
PREFIX drivetrain: <https://github.com/PennTURBO/Drivetrain/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select 
distinct 
?s ?p ?o 
(count( ?recipe ) as ?count)
where {
    ?recipe drivetrain:subject ?s ;
            drivetrain:predicate ?p ;
            drivetrain:object ?o .
    optional {
        ?s rdfs:label ?sl .
    }
    optional {
        ?p rdfs:label ?pl .
    }
    optional {
        ?o rdfs:label ?ol .
    }
}
# limit 100
group by ?s ?p ?o 
order by desc (count( ?recipe ))