Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1.  
  2. convertType out.Organization toSet {
  3. def S1 = "СПАРК"
  4. def S = Dict("Source","Name",S1)
  5.  
  6. logInfo("внешняя онтология объект: " + INN + ", kpp " + KPP + " источник " + S + ", " + Source)
  7. def ORG_1 = object("Organization", SPARKID:SparkID, Source:S, DateFirstReg: DateFirstReg, ShortName:ShortName, OrgName: OrgName,
  8. NormName:NormName,SparkGUID :SparkGUID, INN:INN,KPP:KPP,OGRN:OGRN,OKPO:OKPO, OKVEDList: OKVEDList,OKVED2List:OKVED2List,
  9. CharterCapital:CharterCapital,ChangesInName:ChangesInName_json, IncludeInList: IncludeInList, IndexOfDueDiligence : IndexOfDueDiligence,
  10. CompanySize: CompanySize, SubmittedStatements: SubmittedStatements, StateContracts: StateContracts,ArbitrationCases: ArbitrationCases,
  11. ExecutionProceedings: ExecutionProceedings, OKOPFName: OKOPFName,OKOPFCode:OKOPFCode, OKOPFCodeNew: OKOPFCodeNew, OKATO:OKATO)
  12.  
  13. logInfo("созданые объект Организация, ИНН: ${ORG_1.INN}, kpp ${ORG_1.KPP} источник ${ORG_1.Source} ShortName: ${ORG_1.ShortName}")
  14. }
  15.  
  16.  
  17. convertType out.Person toSet {
  18. logInfo("старт конвертации объекта Персона")
  19.  
  20. def S1 = "СПАРК"
  21. def S = Dict("Source","Name",S1)
  22.  
  23. Utils.logInfo("внешняя онтология объект Персона, ИНН: " + INN + " источник " + S + ", " + Source)
  24. def PERSON_1 = object ("Person", FullName: FullName,INN: INN,Source:S,YearBirh: YearBirh,Header:Header )
  25. Utils.logInfo("созданые объект Персона, ИНН: " +PERSON_1.INN + " источник " + PERSON_1.Source)
  26. }
  27.  
  28. convertLink out.Founder(from: Organization, to: Organization) to in.Founder(from: Organization, to: Organization)
  29. convertLink out.Filial(from: Organization, to: Organization) to in.Filial(from: Organization, to: Organization)
  30. convertLink out.Header(from: Person, to: Organization) to in.Header(from: Person, to: Organization)
  31.  
  32.  
  33.  
  34. convertObjectSet OUT to IN using {
  35. logInfo('---convertObjectSet-----------------------------')
  36.  
  37. def links = in.links('Founder','Filial')
  38.  
  39. for(def link : links) {
  40. def from = link.from().@delegate
  41. def to = link.to().@delegate
  42. logInfo("${from.class.name}")
  43. logInfo("link: ${link.type()}\n\tfrom: \'${from.schema.alias}\' ${link.from().toMap()}\n\tto: \'${to.schema.alias}\' ${link.to().toMap()}")
  44.  
  45. def fromIsOk = isMatchableObject(from)
  46. def toIsOk = isMatchableObject(to)
  47.  
  48. if (fromIsOk && toIsOk) {
  49. logInfo('from and to is matchable')
  50. } else if (!fromIsOk && toIsOk) {
  51. logInfo('\n\tfrom is not matchable')
  52. } else if (fromIsOk && !toIsOk){
  53. logInfo('\n\tto is not matchable')
  54. } else {
  55. logInfo('\n\t \'from\' and \'to\' both are not matchable')
  56. }
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement