Module: Mrdf_Repository
- Defined in:
- lib/ontomde-uml2/select.rb,
lib/ontomde-uml2/umlx.rb,
lib/ontomde-uml2/umlx.rb,
lib/ontomde-uml2/umlx.rb,
lib/ontomde-uml2/umlx.rb,
lib/ontomde-uml2/umlx.rb,
lib/ontomde-uml2/check.rb,
lib/ontomde-uml2/shortcut.rb,
lib/ontomde-uml2/component.rb,
lib/ontomde-uml2/dotDiagram.rb,
lib/ontomde-uml2/kb/protege.rb,
lib/ontomde-uml2/autoImplement.rb,
lib/ontomde-uml2/autoImplement.rb,
lib/ontomde-uml2/salvageErrors.rb,
lib/ontomde-uml2/versionSignature.rb,
lib/ontomde-uml2/multipleInheritance.rb
Overview
adds a version check interface signature
Constant Summary collapse
- UMLX_IGNORE_MODELS =
Model name to be ignored Typicaly containing metamodels
["UML2"]
- UMLX_RESERVED_MODEL_URI =
"http://xmda-reserved"- PROJECT_FILE_SUFFIX =
""- SOA_URI =
"#{NS_SOA_CLASS}#soa"- DATAFILTER_URI =
"#{NS_SOA_CLASS}#dataFilter"- DATAFILTERNAME_URI =
"#{NS_SOA_CLASS}#dataFilterName"- SERVICE_URI =
"#{NS_SOA_CLASS}#service"- ROOT_URI =
"#{NS_RDF_2000}rdf-schema#Resource"- PREDEF_DATAFILTER_URI =
"#{NS_SOA_CLASS}#predefinedDataFilter"- CUSTOM_DATAFILTER_URI =
"#{NS_SOA_CLASS}#customDataFilter"- DATAFILTER_RULE_URI =
"#{NS_SOA_CLASS}#dataFilterRule"- DATAFILTER_PROPERTY_RULE_URI =
"#{NS_SOA_CLASS}#dataPropertyFilterRule"- DATAFILTER_PARAMETER_RULE_URI =
"#{NS_SOA_CLASS}#dataParameterFilterRule"- TARGETDATAFILTER_URI =
"#{NS_SOA_CLASS}#useDataFilter"- SOURCEDATAFILTER_URI =
"#{NS_SOA_CLASS}#sourceDataFilter"- FILTERED_FIELD_URI =
"#{NS_SOA_CLASS}#filteredProperty"- SOA_URI_SET =
list of SOA URI for use in exclusion list in rdfToJava
[ PREDEF_DATAFILTER_URI, CUSTOM_DATAFILTER_URI, DATAFILTER_RULE_URI, DATAFILTER_PROPERTY_RULE_URI, DATAFILTER_PARAMETER_RULE_URI, TARGETDATAFILTER_URI, SOURCEDATAFILTER_URI, FILTERED_FIELD_URI ]
- @@message_umlx_model_not_found_displayed =
flag used to display found multiple models message only once
false
Instance Method Summary collapse
-
#generateMetaEditor(targetFile) ⇒ Object
generates Meta editor project for protege 2000.
-
#generateProtegeKbProject(targetFile) ⇒ Object
generates protege 2000 knowledge base project file and RDF file.
-
#generateProtegeKbRDFS(targetFile) ⇒ Object
generates Protege 2000 RDFS file of a knowledge base project.
-
#generateRDFS(targetFile) ⇒ Object
generates protege 2000 knowledge base project files.
-
#kbRDFS_footer ⇒ Object
Protege 2000 RDFS knowledge base file footer.
-
#kbRDFS_header ⇒ Object
Protege 2000 RDFS knowledge base file header.
- #kbRDFS_writeComponents ⇒ Object
- #uml_addVersionSignature ⇒ Object
-
#uml_Class_all(ret = Set.new) ⇒ Object
search and returns every uml class contained in the current repository.
-
#uml_Component_all(ret = Set.new) ⇒ Object
search and returns every uml component contained in the current repository.
-
#uml_Enumeration_all(ret = Set.new) ⇒ Object
search and returns every uml Enumeration contained in the current repository.
-
#uml_Model_all ⇒ Object
search and returns every uml model contained in the repository.:w.
-
#umlx_autoCreateImplicitComponent! ⇒ Object
generate implicit components from methods defined on domain class.
- #umlx_autoImplementOperation! ⇒ Object
- #umlx_autoImplementProperty! ⇒ Object
- #umlx_checkAbstractAndInheritance ⇒ Object
- #umlx_classesWithMultipleInheritance(ret = Set.new) ⇒ Object
- #umlx_composition_dotDiagram ⇒ Object
-
#umlx_computeIsAnException ⇒ Object
TO BE DONE.
- #umlx_generateCompositonDotDiagram ⇒ Object
-
#umlx_makeCompositionNavigable! ⇒ Object
Modify every composition so navigability is enabled from composante to composite.
- #umlx_mapMultipleInheritanceToInterface! ⇒ Object
- #umlx_MarkAllAsbusinessMethod! ⇒ Object
-
#umlx_model ⇒ Object
return first uml model found in model.
-
#umlx_processShortcuts! ⇒ Object
Transform a set of UML models with links into a single model with uml_ownedMember.
-
#umlx_processUnrootedElements! ⇒ Object
attached unrooted elements to umlx_reserved_model This processing is necessery to handle properly incremental export for enterprise architect.
-
#umlx_pruneEmptyEnums! ⇒ Object
prune empty enumeration (without literal) with a dummy value this can be usefull to hide bug in third party sofware which do not support this.
- #umlx_reserved_model ⇒ Object
-
#umlx_sanitizeAbstractsInHierarchy! ⇒ Object
A properly behaved model should not have inheritance from non abstract class.
-
#umlx_tryToSalvageErrors! ⇒ Object
Tries to fix a broken UML model.
Instance Method Details
#generateMetaEditor(targetFile) ⇒ Object
generates Meta editor project for protege 2000
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'lib/ontomde-uml2/kb/protege.rb', line 367 def generateMetaEditor(targetFile) #log.debug "targetFile=#{targetFile}" s=UML2_RDFS_NT_FILE t="#{targetFile}_meta.rdfs.nt" FileUtils.copy(s,t) if File.exist?(targetFile+"_meta.rdfs") log.info "Overwriting existing file: #{targetFile}_meta.rdfs" end translateToXML(targetFile+"_meta.rdfs.nt",targetFile+"_meta.rdfs") if File.exist?(targetFile+"_meta.rdf") log.info "Using already existing file: #{targetFile}_meta.rdf" else translateToXML(targetFile.to_s,targetFile+"_meta.rdf") end if File.exist?(targetFile+"_meta.pprj") log.info "Using already existing file: #{targetFile}_meta.pprj" else ext="pprj" log.info "creating .#{ext}" mtk_writeSession(targetFile+"_meta.#{ext}") { File.open("#{File.dirname(__FILE__)}/MYMODEL_meta.#{ext}",'r') { |src| src.each {|line| x=line.gsub(/MYMODEL_meta/,"#{File.basename(targetFile)}_meta") write(x) } } } end end |
#generateProtegeKbProject(targetFile) ⇒ Object
generates protege 2000 knowledge base project file and RDF file. internal used
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 |
# File 'lib/ontomde-uml2/kb/protege.rb', line 411 def generateProtegeKbProject(targetFile) ["pprj","rdf"].each { |ext| if File.exist?(targetFile+"#{PROJECT_FILE_SUFFIX}.#{ext}") log.debug { "Using already existing file: #{ext}" } next end log.info "creating .#{ext}" mtk_writeSession(targetFile+"#{PROJECT_FILE_SUFFIX}.#{ext}") { File.open("#{File.dirname(__FILE__)}/MYMODEL_kb.#{ext}",'r') { |src| src.each {|line| x=line.gsub(/MYMODEL_kb/,"#{File.basename(targetFile)}#{PROJECT_FILE_SUFFIX}") write(x) } } } } end |
#generateProtegeKbRDFS(targetFile) ⇒ Object
generates Protege 2000 RDFS file of a knowledge base project.
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 |
# File 'lib/ontomde-uml2/kb/protege.rb', line 431 def generateProtegeKbRDFS(targetFile) targetFileRDFS=targetFile+"#{PROJECT_FILE_SUFFIX}.rdfs.nt" targetFileXML=targetFile+"#{PROJECT_FILE_SUFFIX}.rdfs" #mark temporary file for deletion mtk_addTempFileToDelete(targetFileRDFS) mtk_writeSession(targetFileRDFS) { write(kbRDFS_header) uml_Model_all.each { |m| m.uml_Class_all.each {|c| next if c.kind_of?(Muml_Enumeration) c.prot_writeNTriple c.uml_ownedAttribute.each {|a| a.prot_writeNTriple } c.uml_ownedOperation.each {|a| (a.uml_ownedParameter+a.uml_returnResult).each {|param| # puts "--> param: #{param}" param.prot_writeNTriple_parameter(a) } } } m.uml_UseCase_all.each {|uc| uc.prot_writeNTriple } } kbRDFS_writeComponents write() } translateToXML(targetFileRDFS.to_s,targetFileXML) end |
#generateRDFS(targetFile) ⇒ Object
generates protege 2000 knowledge base project files
401 402 403 404 405 |
# File 'lib/ontomde-uml2/kb/protege.rb', line 401 def generateRDFS(targetFile) #generateMetaEditor(targetFile) generateProtegeKbProject(targetFile) generateProtegeKbRDFS(targetFile) end |
#kbRDFS_footer ⇒ Object
Protege 2000 RDFS knowledge base file footer
465 466 467 |
# File 'lib/ontomde-uml2/kb/protege.rb', line 465 def return "# end\n" end |
#kbRDFS_header ⇒ Object
Protege 2000 RDFS knowledge base file header
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 |
# File 'lib/ontomde-uml2/kb/protege.rb', line 496 def kbRDFS_header nt_top='# debut\n' ['UML_CLASS','UML_TEST_DATA_SET'].each {|c| nt_top=nt_top+"<\#{NS_UML_CLASS}#\#{c}> <http://protege.stanford.edu/system#role> \"abstract\" .\n<\#{NS_UML_CLASS}#\#{c}> <\#{NS_RDF_2000}rdf-schema#label> \"\" .\n<\#{NS_UML_CLASS}#\#{c}> <\#{NS_RDF_2000}rdf-schema#subClassOf> <\#{ROOT_URI}> .\n<\#{NS_UML_CLASS}#\#{c}> <\#{NS_RDF_2000}rdf-schema#comment> \"Cette classe est la racine des classes de type UML. \\\\nFevrier 2006 - FTRD/BIZZ/CIL\\\\nStep\#{\"\"}hane Car\#{\"\"}rie\".\n<\#{NS_UML_CLASS}#\#{c}> <\#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_METACLASS> .\n" } nt_top=nt_top+"<\#{SOA_URI}> <http://protege.stanford.edu/system#role> \"abstract\" .\n<\#{SOA_URI}> <\#{NS_RDF_2000}rdf-schema#label> \"\" .\n<\#{SOA_URI}> <\#{NS_RDF_2000}rdf-schema#subClassOf> <\#{ROOT_URI}> .\n<\#{SOA_URI}> <\#{NS_RDF_2000}rdf-schema#comment> \"SOA sub-model root element. \\\\nMay 2008 - FTRD/BIZZ/CIL\\\\nStep\#{\"\"}hane Car\#{\"\"}rie\".\n<\#{SOA_URI}> <\#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_METACLASS> . \n" nt_top=nt_top+"<\#{DATAFILTER_URI}> <\#{NS_RDF_2000}rdf-schema#label> \"\" .\n<\#{DATAFILTER_URI}> <http://protege.stanford.edu/system#role> \"abstract\" .\n<\#{DATAFILTER_URI}> <\#{NS_RDF_2000}rdf-schema#subClassOf> <\#{SOA_URI}> .\n<\#{DATAFILTER_URI}> <\#{NS_RDF_2000}rdf-schema#comment> \"SOA data filter rule inventory. \\\\nMay 2008 - FTRD/BIZZ/CIL\\\\nStep\#{\"\"}hane Car\#{\"\"}rie\".\n<\#{DATAFILTER_URI}> <\#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_METACLASS> .\n<\#{DATAFILTER_URI}> <\#{NS_UML_CLASS}#UML_URI> \"\#{DATAFILTER_URI}\" .\n\n<\#{DATAFILTERNAME_URI}> <\#{NS_RDF_1999}22-rdf-syntax-ns#type> <\#{NS_RDF_1999}22-rdf-syntax-ns#Property> .\n<\#{DATAFILTERNAME_URI}> <http://protege.stanford.edu/system#maxCardinality> \"1\" .\n<\#{DATAFILTERNAME_URI}> <\#{NS_RDF_2000}rdf-schema#label> \"dataFilterName\" .\n<\#{DATAFILTERNAME_URI}> <\#{NS_RDF_2000}rdf-schema#domain> <\#{DATAFILTER_URI}> .\n<\#{DATAFILTERNAME_URI}> <\#{NS_RDF_2000}rdf-schema#range> <\#{NS_RDF_2000}rdf-schema#Literal> .\n<\#{DATAFILTERNAME_URI}> <\#{NS_RDF_2000}rdf-schema#comment> \"SOA dataFilter name\\\\nMay 2008 - FTRD/BIZZ/CIL\\\\nStep\#{\"\"}hane Pie\#{\"\"}rre Car\#{\"\"}rie\" . \n\n<\#{PREDEF_DATAFILTER_URI}> <\#{NS_RDF_2000}rdf-schema#label> \"\" .\n<\#{PREDEF_DATAFILTER_URI}> <\#{NS_RDF_2000}rdf-schema#subClassOf> <\#{DATAFILTER_URI}> .\n<\#{PREDEF_DATAFILTER_URI}> <\#{NS_RDF_2000}rdf-schema#comment> \"SOA predefined data filter rule. \\\\nMay 2008 - FTRD/BIZZ/CIL\\\\nStep\#{\"\"}hane Car\#{\"\"}rie\" .\n<\#{PREDEF_DATAFILTER_URI}> <\#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_METACLASS> .\n<\#{PREDEF_DATAFILTER_URI}> <\#{NS_UML_CLASS}#UML_URI> \"\#{PREDEF_DATAFILTER_URI}\" .\n\n<\#{CUSTOM_DATAFILTER_URI}> <\#{NS_RDF_2000}rdf-schema#label> \"\" .\n<\#{CUSTOM_DATAFILTER_URI}> <\#{NS_RDF_2000}rdf-schema#subClassOf> <\#{DATAFILTER_URI}> .\n<\#{CUSTOM_DATAFILTER_URI}> <\#{NS_RDF_2000}rdf-schema#comment> \"SOA custom data filter rule. \\\\nMay 2008 - FTRD/BIZZ/CIL\\\\nStep\#{\"\"}hane Car\#{\"\"}rie\" .\n<\#{CUSTOM_DATAFILTER_URI}> <\#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_METACLASS> .\n<\#{CUSTOM_DATAFILTER_URI}> <\#{NS_UML_CLASS}#UML_URI> \"\#{CUSTOM_DATAFILTER_URI}\" .\n\n<\#{DATAFILTER_RULE_URI}> <\#{NS_RDF_2000}rdf-schema#label> \"\" .\n<\#{DATAFILTER_RULE_URI}> <http://protege.stanford.edu/system#role> \"abstract\" .\n<\#{DATAFILTER_RULE_URI}> <\#{NS_RDF_2000}rdf-schema#subClassOf> <\#{SOA_URI}> .\n<\#{DATAFILTER_RULE_URI}> <\#{NS_RDF_2000}rdf-schema#comment> \"SOA data filter rule inventory. \\\\nMay 2008 - FTRD/BIZZ/CIL\\\\nStep\#{\"\"}hane Car\#{\"\"}rie\".\n<\#{DATAFILTER_RULE_URI}> <\#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_METACLASS> .\n<\#{DATAFILTER_RULE_URI}> <\#{NS_UML_CLASS}#UML_URI> \"\#{DATAFILTER_RULE_URI}\" .\n\n<\#{DATAFILTER_PROPERTY_RULE_URI}> <\#{NS_RDF_2000}rdf-schema#label> \"\" .\n<\#{DATAFILTER_PROPERTY_RULE_URI}> <\#{NS_RDF_2000}rdf-schema#subClassOf> <\#{DATAFILTER_RULE_URI}> .\n<\#{DATAFILTER_PROPERTY_RULE_URI}> <\#{NS_RDF_2000}rdf-schema#comment> \"SOA data filter property rule. \\\\nMay 2008 - FTRD/BIZZ/CIL\\\\nStep\#{\"\"}hane Car\#{\"\"}rie\".\n<\#{DATAFILTER_PROPERTY_RULE_URI}> <\#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_METACLASS> .\n<\#{DATAFILTER_PROPERTY_RULE_URI}> <\#{NS_UML_CLASS}#UML_URI> \"\#{DATAFILTER_PROPERTY_RULE_URI}\" .\n\n<\#{SOURCEDATAFILTER_URI}> <\#{NS_RDF_1999}22-rdf-syntax-ns#type> <\#{NS_RDF_1999}22-rdf-syntax-ns#Property> .\n<\#{SOURCEDATAFILTER_URI}> <http://protege.stanford.edu/system#maxCardinality> \"1\" .\n<\#{SOURCEDATAFILTER_URI}> <\#{NS_RDF_2000}rdf-schema#label> \"sourceDataFilter\" .\n<\#{SOURCEDATAFILTER_URI}> <\#{NS_RDF_2000}rdf-schema#domain> <\#{DATAFILTER_RULE_URI}> .\n<\#{SOURCEDATAFILTER_URI}> <\#{NS_RDF_2000}rdf-schema#range> <\#{DATAFILTER_URI}> .\n<\#{SOURCEDATAFILTER_URI}> <\#{NS_RDF_2000}rdf-schema#comment> \"SOA sourceDataFilter name\\\\nMay 2008 - FTRD/BIZZ/CIL\\\\nStep\#{\"\"}hane Pie\#{\"\"}rre Car\#{\"\"}rie\". \n\n<\#{TARGETDATAFILTER_URI}> <\#{NS_RDF_1999}22-rdf-syntax-ns#type> <\#{NS_RDF_1999}22-rdf-syntax-ns#Property> .\n<\#{TARGETDATAFILTER_URI}> <http://protege.stanford.edu/system#maxCardinality> \"1\" .\n<\#{TARGETDATAFILTER_URI}> <\#{NS_RDF_2000}rdf-schema#label> \"targetDataFilter\" .\n<\#{TARGETDATAFILTER_URI}> <\#{NS_RDF_2000}rdf-schema#domain> <\#{DATAFILTER_RULE_URI}> .\n<\#{TARGETDATAFILTER_URI}> <\#{NS_RDF_2000}rdf-schema#range> <\#{DATAFILTER_URI}> .\n<\#{TARGETDATAFILTER_URI}> <\#{NS_RDF_2000}rdf-schema#comment> \"SOA sourceDataFilter name\\\\nMay 2008 - FTRD/BIZZ/CIL\\\\nStep\#{\"\"}hane Pie\#{\"\"}rre Car\#{\"\"}rie\". \n\n<\#{FILTERED_FIELD_URI}> <\#{NS_RDF_1999}22-rdf-syntax-ns#type> <\#{NS_RDF_1999}22-rdf-syntax-ns#Property> .\n<\#{FILTERED_FIELD_URI}> <http://protege.stanford.edu/system#maxCardinality> \"1\" .\n<\#{FILTERED_FIELD_URI}> <\#{NS_RDF_2000}rdf-schema#label> \"filteredProperty\" .\n<\#{FILTERED_FIELD_URI}> <\#{NS_RDF_2000}rdf-schema#domain> <\#{DATAFILTER_RULE_URI}> .\n<\#{FILTERED_FIELD_URI}> <\#{NS_RDF_2000}rdf-schema#range> <http://protege.stanford.edu/kb#UML_SLOT> .\n<\#{FILTERED_FIELD_URI}> <\#{NS_RDF_2000}rdf-schema#comment> \"SOA sourceDataFilter name\\\\nMay 2008 - FTRD/BIZZ/CIL\\\\nStep\#{\"\"}hane Pie\#{\"\"}rre Car\#{\"\"}rie\". \n\n<\#{DATAFILTER_PARAMETER_RULE_URI}> <\#{NS_RDF_2000}rdf-schema#label> \"\" .\n<\#{DATAFILTER_PARAMETER_RULE_URI}> <\#{NS_RDF_2000}rdf-schema#subClassOf> <\#{DATAFILTER_RULE_URI}> .\n<\#{DATAFILTER_PARAMETER_RULE_URI}> <\#{NS_RDF_2000}rdf-schema#comment> \"SOA data filter parameter rule. \\\\nMay 2008 - FTRD/BIZZ/CIL\\\\nStep\#{\"\"}hane Car\#{\"\"}rie\".\n<\#{DATAFILTER_PARAMETER_RULE_URI}> <\#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_METACLASS> .\n<\#{DATAFILTER_PARAMETER_RULE_URI}> <\#{NS_UML_CLASS}#UML_URI> \"\#{DATAFILTER_PARAMETER_RULE_URI}\" .\n\n" nt_top=nt_top+"<\#{NS_UML_CLASS}#UML_METACLASS> <\#{NS_RDF_1999}22-rdf-syntax-ns#type> <\#{NS_RDF_2000}rdf-schema#Class> .\n<\#{NS_UML_CLASS}#UML_METACLASS> <\#{NS_RDF_2000}rdf-schema#label> \"UML_METACLASS\" .\n<\#{NS_UML_CLASS}#UML_METACLASS> <\#{NS_RDF_2000}rdf-schema#subClassOf> <\#{NS_RDF_2000}rdf-schema#Class> .\n<\#{NS_UML_CLASS}#UML_METACLASS> <\#{NS_RDF_2000}rdf-schema#comment> \"Cette classe est la metaclasse des classes de type UML. \\\\nFevrier 2006 - FTRD/BIZZ/CIL\\\\nStep\#{\"\"}hane Pie\#{\"\"}rre Car\#{\"\"}rie\".\n<http://protege.stanford.edu/kb#UML_SLOT> <\#{NS_RDF_1999}22-rdf-syntax-ns#type> <\#{NS_RDF_2000}rdf-schema#Class> .\n<http://protege.stanford.edu/kb#UML_SLOT> <\#{NS_RDF_2000}rdf-schema#subClassOf> <\#{NS_RDF_1999}22-rdf-syntax-ns#Property> .\n<\#{NS_UML_CLASS}#\#{PROTEGE_INSTANCE_ALIAS_URI_SUFFIX}> <\#{NS_RDF_1999}22-rdf-syntax-ns#type> <\#{NS_RDF_1999}22-rdf-syntax-ns#Property> .\n<\#{NS_UML_CLASS}#\#{PROTEGE_INSTANCE_ALIAS_URI_SUFFIX}> <http://protege.stanford.edu/system#maxCardinality> \"1\" .\n<\#{NS_UML_CLASS}#\#{PROTEGE_INSTANCE_ALIAS_URI_SUFFIX}> <\#{NS_RDF_2000}rdf-schema#label> \"\#{PROTEGE_INSTANCE_ALIAS_URI_SUFFIX}\" .\n<\#{NS_UML_CLASS}#\#{PROTEGE_INSTANCE_ALIAS_URI_SUFFIX}> <\#{NS_RDF_2000}rdf-schema#domain> <http://protege.stanford.edu/kb#UML_CLASS> .\n<\#{NS_UML_CLASS}#\#{PROTEGE_INSTANCE_ALIAS_URI_SUFFIX}> <\#{NS_RDF_2000}rdf-schema#range> <\#{NS_RDF_2000}rdf-schema#Literal> .\n<\#{NS_UML_CLASS}#\#{PROTEGE_INSTANCE_ALIAS_URI_SUFFIX}> <\#{NS_RDF_2000}rdf-schema#comment> \"UML Alias used as key in other tools (xmda java junit, ...)\\\\n - FTRD/BIZZ/CIL\\\\nStep\#{\"\"}hane Pie\#{\"\"}rre Car\#{\"\"}rie\".\n" nt_top=nt_top+"<\#{NS_UML_CLASS}#\#{PROTEGE_USE_CASE_ENV_URI_SUFFIX}> <\#{NS_RDF_1999}22-rdf-syntax-ns#type> <\#{NS_RDF_1999}22-rdf-syntax-ns#Property> .\n<\#{NS_UML_CLASS}#\#{PROTEGE_USE_CASE_ENV_URI_SUFFIX}> <http://protege.stanford.edu/system#maxCardinality> \"1\" .\n<\#{NS_UML_CLASS}#\#{PROTEGE_USE_CASE_ENV_URI_SUFFIX}> <\#{NS_RDF_2000}rdf-schema#label> \"\#{PROTEGE_USE_CASE_ENV_URI_SUFFIX}\" .\n<\#{NS_UML_CLASS}#\#{PROTEGE_USE_CASE_ENV_URI_SUFFIX}> <\#{NS_RDF_2000}rdf-schema#domain> <http://protege.stanford.edu/kb#UML_TEST_DATA_SET> .\n<\#{NS_UML_CLASS}#\#{PROTEGE_USE_CASE_ENV_URI_SUFFIX}> <\#{NS_RDF_2000}rdf-schema#range> <\#{NS_RDF_2000}rdf-schema#Literal> .\n<\#{NS_UML_CLASS}#\#{PROTEGE_USE_CASE_ENV_URI_SUFFIX}> <\#{NS_RDF_2000}rdf-schema#comment> \"UML Alias used as key in other tools (xmda java junit, ...)\\\\n - FTRD/BIZZ/CIL\\\\nStep\#{\"\"}hane Pier\#{\"\"}re Car\#{\"\"}rie\".\n" ['UML_LABEL', 'UML_URI'].each{ |k| nt_top=nt_top+"<\#{NS_UML_CLASS}#\#{k}> <\#{NS_RDF_1999}22-rdf-syntax-ns#type> <\#{NS_RDF_1999}22-rdf-syntax-ns#Property> .\n<\#{NS_UML_CLASS}#\#{k}> <http://protege.stanford.edu/system#maxCardinality> \"1\" .\n<\#{NS_UML_CLASS}#\#{k}> <\#{NS_RDF_2000}rdf-schema#label> \"\#{k}\" .\n<\#{NS_UML_CLASS}#\#{k}> <\#{NS_RDF_2000}rdf-schema#domain> <http://protege.stanford.edu/kb#UML_METACLASS> .\n<\#{NS_UML_CLASS}#\#{k}> <\#{NS_RDF_2000}rdf-schema#domain> <http://protege.stanford.edu/kb#UML_SLOT> .\n<\#{NS_UML_CLASS}#\#{k}> <\#{NS_RDF_2000}rdf-schema#range> <\#{NS_RDF_2000}rdf-schema#Literal> .\n" } #<#{NS_UML_CLASS}##{k}> <http://protege.stanford.edu/system#range> "cls" . #<#{NS_UML_CLASS}##{k}> <#{NS_RDF_2000}rdf-schema#range> <http://www.w3.org/2000/01/rdf-schema#Class> . #<#{NS_UML_CLASS}##{k}> <http://protege.stanford.edu/system#allowedParents> <#{NS_UML_CLASS}#UML_TEST_DATA_SET> . ['UML_REFERENCED_USE_CASE'].each{ |k| inv="UML_DATA" nt_top=nt_top+"<\#{NS_UML_CLASS}#\#{k}> <\#{NS_RDF_1999}22-rdf-syntax-ns#type> <\#{NS_RDF_1999}22-rdf-syntax-ns#Property> .\n<\#{NS_UML_CLASS}#\#{k}> <\#{NS_RDF_2000}rdf-schema#label> \"\#{k}\" .\n<\#{NS_UML_CLASS}#\#{k}> <\#{NS_RDF_2000}rdf-schema#range> <\#{NS_UML_CLASS}#UML_TEST_DATA_SET> .\n<\#{NS_UML_CLASS}#\#{k}> <\#{NS_RDF_2000}rdf-schema#domain> <\#{NS_UML_CLASS}#UML_CLASS> .\n<\#{NS_UML_CLASS}#\#{k}> <http://protege.stanford.edu/system#inverseProperty> <\#{NS_UML_CLASS}#\#{inv}> .\n<\#{NS_UML_CLASS}#\#{inv}> <\#{NS_RDF_1999}22-rdf-syntax-ns#type> <\#{NS_RDF_1999}22-rdf-syntax-ns#Property> .\n<\#{NS_UML_CLASS}#\#{inv}> <\#{NS_RDF_2000}rdf-schema#label> \"{k}\" .\n<\#{NS_UML_CLASS}#\#{inv}> <http://protege.stanford.edu/system#inverseProperty> <\#{NS_UML_CLASS}#\#{k}> .\n<\#{NS_UML_CLASS}#\#{inv}> <\#{NS_RDF_2000}rdf-schema#range> <\#{NS_UML_CLASS}#UML_CLASS> .\n<\#{NS_UML_CLASS}#\#{inv}> <\#{NS_RDF_2000}rdf-schema#domain> <\#{NS_UML_CLASS}#UML_TEST_DATA_SET> .\n" } return nt_top end |
#kbRDFS_writeComponents ⇒ Object
647 648 649 650 651 |
# File 'lib/ontomde-uml2/kb/protege.rb', line 647 def kbRDFS_writeComponents uml_Component_all.each { |c| c.kb_writeComponent } end |
#uml_addVersionSignature ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ontomde-uml2/versionSignature.rb', line 5 def uml_addVersionSignature v=context[:versionSignature,nil] return if v.nil? i=nil uml_Class_all.each { |c| if i.nil? i=c.umlx_getOrCreateInterface("xmda.Version") i.uml_name="Version _ #{v.tr('.','_')}" i.umlx_external=RDF_FALSE end c.uml_addVersionSignature(i) } end |
#uml_Class_all(ret = Set.new) ⇒ Object
search and returns every uml class contained in the current repository.
17 18 19 20 21 22 23 |
# File 'lib/ontomde-uml2/select.rb', line 17 def uml_Class_all(ret=Set.new) #return @typeIndex[Muml_Class] uml_Model_all.each { |m| m.uml_Class_all(ret) } return ret end |
#uml_Component_all(ret = Set.new) ⇒ Object
search and returns every uml component contained in the current repository.
26 27 28 29 30 31 32 |
# File 'lib/ontomde-uml2/select.rb', line 26 def uml_Component_all(ret=Set.new) #return @typeIndex[Muml_Class] uml_Model_all.each { |m| m.uml_Component_all(ret) } return ret end |
#uml_Enumeration_all(ret = Set.new) ⇒ Object
search and returns every uml Enumeration contained in the current repository.
35 36 37 38 39 40 41 |
# File 'lib/ontomde-uml2/select.rb', line 35 def uml_Enumeration_all(ret=Set.new) #return @typeIndex[Muml_Class] uml_Model_all.each { |m| m.uml_Enumeration_all(ret) } return ret end |
#uml_Model_all ⇒ Object
search and returns every uml model contained in the repository.:w
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/ontomde-uml2/select.rb', line 5 def uml_Model_all #Use index if index is available. return @typeIndex[Muml_Model] ret=Array.new each { |k,m| next unless m.kind_of?(Muml_Model) ret << m } return ret end |
#umlx_autoCreateImplicitComponent! ⇒ Object
generate implicit components from methods defined on domain class.
6 7 8 9 10 11 |
# File 'lib/ontomde-uml2/component.rb', line 6 def umlx_autoCreateImplicitComponent! uml_Class_all.each {|clazz| next unless clazz.kind_of?(Cuml_Class) clazz.umlx_autoCreateImplicitComponent! } end |
#umlx_autoImplementOperation! ⇒ Object
91 92 93 94 95 96 97 98 99 100 |
# File 'lib/ontomde-uml2/autoImplement.rb', line 91 def umlx_autoImplementOperation! uml_Class_all.each { |c| next unless c.kind_of?(Muml_Class) c.umlx_autoImplementOperation! } uml_Component_all.each { |c| #next unless c.kind_of?(Muml_Class) c.umlx_autoImplementOperation! } end |
#umlx_autoImplementProperty! ⇒ Object
7 8 9 10 11 12 |
# File 'lib/ontomde-uml2/autoImplement.rb', line 7 def umlx_autoImplementProperty! uml_Class_all.each {|c| next unless c.kind_of?(Muml_Class) c.umlx_autoImplementProperty! } end |
#umlx_checkAbstractAndInheritance ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ontomde-uml2/check.rb', line 4 def umlx_checkAbstractAndInheritance() return unless context[:checkForAbstractAndInheritance,false] msg="" uml_Class_all.each { |c| next if c.kind_of?(Muml_Enumeration) next if c.kind_of?(Muml_Interface) next if c.umlx_external? next if c.uml_isAbstract? next if c.uml_general_inv.empty? msg=msg+"\n**** #{c.uml_name}" } return if msg.empty? log.error { %{ ******************* INCORRECT MODEL ******************* This model contains incorrect constructions. The following classe(s) has (have) been found guilty of being *not* abstract and having inheriting classes. Please, check your model and mark these classes abstract #{msg} ******************* INCORRECT MODEL ******************* }} #exit(1) end |
#umlx_classesWithMultipleInheritance(ret = Set.new) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/ontomde-uml2/multipleInheritance.rb', line 12 def umlx_classesWithMultipleInheritance(ret=Set.new) uml_Class_all.each {|c| next if c.kind_of?(Muml_Interface) || c.kind_of?(Muml_Enumeration) next if c.uml_generalization.length <2 ret << c } return ret end |
#umlx_composition_dotDiagram ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/ontomde-uml2/dotDiagram.rb', line 12 def umlx_composition_dotDiagram write "digraph {\nrankdir=LR\nNode[shape=box,fontsize=10,color=darkolivegreen1]\n" uml_Class_all.each { |c| next if c.kind_of?(Muml_Enumeration) style="" ster="" if c.uml_isAbstract? style=",color=pink" elsif c.kind_of?(Muml_Interface) style=",color=khaki" ster="<<interface>>\\n" elsif ! (c.uml_general_inv.empty?) # incorrect class # not abstract with inheriting class style=",color=red,style=filled" else style=",color=red,style=filled" style=",style=filled" end write(%{#{c.dotId} [label="#{ster}#{c.uml_name}" #{style}]\n}) #Implements if c.kind_of?(Muml_Class) c.uml_implementation.each { |g| o=g.uml_supplier_one write( %{#{c.dotId} -> #{o.dotId} [arrowtail=none,arrowhead=onormal,style=dotted]\n} ) } end c.uml_generalization.each { |g| o=g.uml_general_one write( %{#{c.dotId} -> #{o.dotId} [arrowtail=none,arrowhead=onormal,color=indianred3]\n} ) } } #Composition each { |k,p| next unless p.kind_of?(Muml_Association) ce=nil #composante ci=nil #composite p.uml_memberEnd.each {|a| if a.uml_aggregation_one.isComposite? ci=a else ce=a end } next if ci.nil? || ce.nil? next if ci.uml_type_one.kind_of?(Muml_Stereotype) next if ce.uml_type_one.kind_of?(Muml_Stereotype) write( %{#{ce.uml_type_one.dotId} -> #{ci.uml_type_one.dotId} [arrowhead="none" arrowtail="diamond"]\n} ) } write("}\n") end |
#umlx_computeIsAnException ⇒ Object
TO BE DONE
193 194 |
# File 'lib/ontomde-uml2/umlx.rb', line 193 def umlx_computeIsAnException end |
#umlx_generateCompositonDotDiagram ⇒ Object
6 7 8 9 10 11 |
# File 'lib/ontomde-uml2/dotDiagram.rb', line 6 def umlx_generateCompositonDotDiagram return unless context[:generateCompositionDiagram,false] mtk_writeSession("#{context[:javaDir]}/composition.dot") { umlx_composition_dotDiagram } end |
#umlx_makeCompositionNavigable! ⇒ Object
Modify every composition so navigability is enabled from composante to composite. Composition between interface is not made navigable
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 |
# File 'lib/ontomde-uml2/umlx.rb', line 484 def umlx_makeCompositionNavigable! return unless context[:makeCompositionBiNavigable,true] each { |k,p| next unless p.kind_of?(Muml_Association) ce=nil #composante ci=nil #composite p.uml_memberEnd.each {|a| if a.uml_aggregation_one.isComposite? ci=a else ce=a end } next if ci.nil? || ce.nil? next if ci.uml_type_one.kind_of?(Muml_Stereotype) next if ce.uml_type_one.kind_of?(Muml_Stereotype) #next if ce.uml_type_one.kind_of?(Muml_Interface) return if ce.umlx_isNavigable? #log.debug { "making composition bi-navigable #{p}"} if ce.uml_name.empty? #replace blank name with default name for composite. ce.uml_name=context[:defaultBiNavigableCompositionName,"owner"] end #ce.uml_ownedAttribute_inv=ci.uml_type #ce.uml_ownedAttribute_inv_one.uml_ownedAttribute_add(ce) ci.uml_type_one.uml_ownedAttribute_add(ce) } end |
#umlx_mapMultipleInheritanceToInterface! ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/ontomde-uml2/multipleInheritance.rb', line 5 def umlx_mapMultipleInheritanceToInterface! nl=Set.new umlx_classesWithMultipleInheritance.each {|c| c.umlx_mapMultipleInheritanceToInterface!(nl) } end |
#umlx_MarkAllAsbusinessMethod! ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/ontomde-uml2/umlx.rb', line 16 def umlx_MarkAllAsbusinessMethod! each { |k,m| next unless m.kind_of?(Muml_Operation) || m.kind_of?(Muml_Classifier) #do not force value if already set next unless m.umlx_businessMethod.empty? m.umlx_businessMethod=RDF_TRUE } end |
#umlx_model ⇒ Object
return first uml model found in model
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/ontomde-uml2/umlx.rb', line 265 def umlx_model ret=[] each { |k,c| #next unless c.kind_of?(Muml_Class) #p=c.umlx_model #next if p.kind_of?(Muml_Profile) #next if c.umlx_model.uml_name=="UML2" #return p next unless c.kind_of?(Muml_Model) next if c.kind_of?(Muml_Profile) next if UMLX_IGNORE_MODELS.include?(c.uml_name.to_s) ret<< c } if ret.empty? log.error { "umlx_model:no model found in rdf_Repository" } return nil elsif ret.length > 1 ms=""; ret.each { |m| ms=ms+m.uml_name.to_s+"," } if ! #log.debug { "umlx_model:found multiple models: #{ms}. Returning first one found.(#{ret[0]})" } =true end end return ret[0] end |
#umlx_processShortcuts! ⇒ Object
Transform a set of UML models with links into a single model with uml_ownedMember.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ontomde-uml2/shortcut.rb', line 6 def umlx_processShortcuts! each_value { |s| next unless s.respond_to?(:umlx_shortcut) next if s.umlx_shortcut.nil? s.umlx_shortcut.each {|p| #remove link with package p.uml_ownedMember_inv.each { |m| m.uml_ownedMember.delete(p) } #replace shortcut with ownership s.uml_ownedMember_add(p) } } end |
#umlx_processUnrootedElements! ⇒ Object
attached unrooted elements to umlx_reserved_model This processing is necessery to handle properly incremental export for enterprise architect. For every XMI export, EA creates a fix uml model. This repository is the same for every export (top level or subs) OntoMDE import filter deletes UML model from EA export to solve this issues. This operation finishes the job by relinking when necessary. Sub exports are fine because object are already linked !
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ontomde-uml2/shortcut.rb', line 31 def umlx_processUnrootedElements! model=self model.umlx_reserved_model # create umlx_reserved_model model.each { |c,package| next unless package.kind_of?(Muml_Package) next unless package.umlx_owner_one.nil? next if package.kind_of?(Muml_Model) #puts "UNROOTED PACKAGE #{package}" model.umlx_reserved_model.uml_ownedMember_add(package) } end |
#umlx_pruneEmptyEnums! ⇒ Object
prune empty enumeration (without literal) with a dummy value this can be usefull to hide bug in third party sofware which do not support this. This is however usefull in a code generation context because an enum could have values in one configuration and not in another.
29 30 31 32 33 34 35 36 |
# File 'lib/ontomde-uml2/umlx.rb', line 29 def umlx_pruneEmptyEnums! uml_Enumeration_all.each { |enu| next if enu.uml_ownedLiteral.empty? puts "WARNING: empty enum found in model. (#{enu}). Because this may cause bugs in some software (hibernate spring), a dummy vaue has been added. You may disable this feature using appropriate command line option."; lit=enu.umlx_createAndAddLiteral("dummy") lit.umlx_createAndAddComment("#{lit.rdf_uri}-comment", "dummy literal value added by generator to avoid bugs in third party sofwares (hibernate spring)") } end |
#umlx_reserved_model ⇒ Object
651 652 653 654 655 656 657 658 |
# File 'lib/ontomde-uml2/umlx.rb', line 651 def umlx_reserved_model r=self[UMLX_RESERVED_MODEL_URI] return r unless r.nil? r=self r=Cuml_Model.new(self,UMLX_RESERVED_MODEL_URI) #log.debug { "Creating reserved model (uri=#{r.uri})" } return r end |
#umlx_sanitizeAbstractsInHierarchy! ⇒ Object
A properly behaved model should not have inheritance from non abstract class. This transformation enforces that inheritance is always from an abstract class
471 472 473 474 475 476 477 478 479 480 |
# File 'lib/ontomde-uml2/umlx.rb', line 471 def umlx_sanitizeAbstractsInHierarchy! each { |k,gen| next unless gen.kind_of?(Muml_Generalization) g=gen.uml_general_one sp=gen.uml_specific_one next if g.uml_isAbstract? next unless g.kind_of?(Muml_Class) g.umlx_sanitizeAbstractsInHierarchy! } end |
#umlx_tryToSalvageErrors! ⇒ Object
Tries to fix a broken UML model. This feature is not meant for serious work and should only be used for quick demonstration.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/ontomde-uml2/salvageErrors.rb', line 9 def umlx_tryToSalvageErrors! return unless context[:salvage,false] log.error { "\n************ salvage mode is on ***************\nSalvage mode should only be used for quick\ndemonstration purposes and never for any serious\nwork.\n************ salvage mode is on ***************\n" } each { |k,v| # fix untyped property if v.kind_of?(Muml_Property) v.uml_type=v.umlx_owner_one.umlx_dataType_string if v.uml_type.empty? # id is generated if persistence is enabled v.uml_name="business Id" if context[:db] && v.uml_name.to_s=="id" end #fix blank or missing names if v.kind_of?(Muml_NamedElement) v.uml_name="missing_name_in_model_"+v.rdf_uri if v.uml_name.empty? || v.uml_name.to_s=="" end } each { |k,v| #fix visibility (force to public) if v.respond_to?(:uml_visibility) v.uml_visibility=::Cuml_VisibilityKind::Public end # ejb service should not be abstract if v.kind_of?(Muml_Class) && v.umlx_hasStereotype?("Service") v.uml_isAbstract="false" end #no duplicate attribute (in one single class) if v.kind_of?(Muml_Class) names=Set.new i=1 v.uml_ownedAttribute.each { |a| n=a.uml_name.to_s if a.respond_to?(:java_Name) #in case java is loaded n=a.java_Name.to_s end if names.include?(n) i=i+1 a.uml_name="#{v.uml_name}_duplicate_#{i}" else names.add(n) end } end } end |