@@ -22,7 +22,7 @@ import S3Interaction from '../../sbol3/S3Interaction'
22
22
import S3Participation from '../../sbol3/S3Participation'
23
23
import S2ModuleInstance from '../../sbol2/S2ModuleInstance'
24
24
import S3Model from '../../sbol3/S3Model'
25
- import S3MapsTo from '../../sbol3/S3MapsTo '
25
+ import S3MapsTo from '../../sbol3/S3ComponentReference '
26
26
27
27
import S2Experiment from '../../sbol2/S2Experiment'
28
28
import S2ExperimentalData from '../../sbol2/S2ExperimentalData'
@@ -38,7 +38,7 @@ import { Graph, node, Node, triple } from 'rdfoo'
38
38
import S3Measure from '../../sbol3/S3Measure' ;
39
39
import SBOL3GraphView from '../../SBOL3GraphView'
40
40
import SBOL2GraphView from '../../SBOL2GraphView'
41
- import { S2Attachment , S3OrientedLocation , S2Cut , S3Location , S2OrientedLocation } from '../..'
41
+ import { S2Attachment , S3OrientedLocation , S2Cut , S3Location , S2OrientedLocation , S3Constraint } from '../..'
42
42
import S3Attachment from '../../sbol3/S3Attachment'
43
43
import S3Implementation from '../../sbol3/S3Implementation'
44
44
import S2Facade from '../../sbol2/S2Facade'
@@ -48,6 +48,7 @@ import S3CombinatorialDerivation from '../../sbol3/S3CombinatorialDerivation'
48
48
import S2VariableComponent from '../../sbol2/S2VariableComponent'
49
49
import S3VariableFeature from '../../sbol3/S3VariableFeature'
50
50
import S3Interface from '../../sbol3/S3Interface'
51
+ import S3ComponentReference from '../../sbol3/S3ComponentReference'
51
52
52
53
export default function convert2to3 ( graph :Graph ) {
53
54
@@ -127,17 +128,37 @@ export default function convert2to3(graph:Graph) {
127
128
b = new S3SubComponent ( sbol3View , mapsTo . remote . subject )
128
129
}
129
130
130
- let newMapsTo = new S3MapsTo ( sbol3View , mapsTo . subject )
131
- newMapsTo . setUriProperty ( Predicates . a , Types . SBOL3 . MapsTo )
131
+ /// Each MapsTo turns into a ComponentReference and a Constraint
132
132
133
- newMapsTo . local = a
134
- newMapsTo . remote = b
135
- newMapsTo . refinement = mapsTo . refinement
136
-
137
- subModule . addMapping ( newMapsTo )
133
+ let constraint = new S3Constraint ( sbol3View , mapsTo . subject )
134
+
135
+ let cR = new S3ComponentReference ( sbol3View , node . createUriNode ( mapsTo . subject + '_reference' ) )
136
+ cR . setUriProperty ( Predicates . a , Prefixes . sbol3 + 'ComponentReference' )
137
+
138
+ subModule . insertProperty ( Predicates . SBOL3 . hasFeature , cR . subject )
139
+
140
+ cR . setProperty ( Predicates . SBOL3 + 'inChildOf' , sm . subject )
141
+ cR . setProperty ( Predicates . SBOL3 + 'remote' , b . subject )
142
+
143
+ switch ( mapsTo . refinement ) {
144
+
145
+ case Specifiers . SBOL2 . MapsToRefinement . UseRemote :
146
+ default :
147
+ // restriction is replaces, subject is the CR, object is the SC
148
+ break
149
+
150
+ case Specifiers . SBOL2 . MapsToRefinement . UseLocal :
151
+ // restriction is replaces, subject is the SC, object is the CR
152
+ break
138
153
139
- //subModule.createMapping(a as S3SubComponent, b as S3SubComponent)
154
+ case Prefixes . sbol2 + 'verifyIdentical' :
155
+ // restriction is vI, subject is the CR, object is the SC
156
+ break
140
157
158
+
159
+
160
+
161
+ }
141
162
}
142
163
}
143
164
@@ -435,6 +456,20 @@ export default function convert2to3(graph:Graph) {
435
456
436
457
}
437
458
459
+
460
+ let interfaceRequired = cd . components . filter ( fc => fc . access !== Specifiers . SBOL2 . Access . PrivateAccess ) . length > 0
461
+
462
+ if ( interfaceRequired ) {
463
+ let iface = new S3Interface ( sbol3View , node . createUriNode ( component3 . subject . value + '/interface' ) )
464
+ iface . setUriProperty ( Predicates . a , Types . SBOL3 . Interface )
465
+
466
+ component3 . insertProperty ( Predicates . SBOL3 . hasInterface , iface . subject )
467
+
468
+ for ( let c of cd . components ) {
469
+ iface . insertProperty ( Predicates . SBOL3 . nondirectional , c . subject )
470
+ }
471
+ }
472
+
438
473
return component3
439
474
440
475
}
@@ -569,7 +604,7 @@ export default function convert2to3(graph:Graph) {
569
604
component3 . addModel ( modelToModel ( model ) )
570
605
}
571
606
572
- let interfaceRequired = md . functionalComponents . filter ( fc => fc . direction !== Specifiers . SBOL2 . Direction . InputAndOutput ) . length > 0
607
+ let interfaceRequired = md . functionalComponents . filter ( fc => fc . direction !== Specifiers . SBOL2 . Direction . None ) . length > 0
573
608
574
609
if ( interfaceRequired ) {
575
610
let iface = new S3Interface ( sbol3View , node . createUriNode ( component3 . subject . value + '/interface' ) )
@@ -586,15 +621,10 @@ export default function convert2to3(graph:Graph) {
586
621
iface . insertProperty ( Predicates . SBOL3 . output , fc . subject )
587
622
break
588
623
case Specifiers . SBOL2 . Direction . InputAndOutput :
589
- iface . insertProperty ( Predicates . SBOL3 . input , fc . subject )
590
- iface . insertProperty ( Predicates . SBOL3 . output , fc . subject )
624
+ iface . insertProperty ( Predicates . SBOL3 . nondirectional , fc . subject )
591
625
break
592
626
case Specifiers . SBOL2 . Direction . None :
593
- // I guess this is the same as the absence of the feature in the interface?
594
- break
595
- default :
596
- // not sure nondirectional can actually be represented in sbol2
597
- //iface.insertProperty(Predicates.SBOL3.nondirectional, fc.subject)
627
+ // this is the same as the absence of the feature in the interface
598
628
break
599
629
}
600
630
}
0 commit comments