@bentley/bis-core-schema 1.0.26-dev.1 → 1.0.26-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2471,6 +2471,11 @@
2471
2471
  </Target>
2472
2472
  </ECRelationshipClass>
2473
2473
 
2474
+ <ECEntityClass typeName="FormatSet" modifier="Sealed" displayLabel="Format Set" description="A bis:DefinitionElement that captures the settings of a set of formats in need to be maintained in BIS Repositories.">
2475
+ <BaseClass>DefinitionElement</BaseClass>
2476
+ <ECProperty propertyName="Settings" typeName="string" extendedTypeName="Json" displayLabel="Settings" description="The settings for the format set in a versioned JSON format." />
2477
+ </ECEntityClass>
2478
+
2474
2479
  <ECEntityClass typeName="LineStyle" modifier="Sealed" displayLabel="Line Style">
2475
2480
  <BaseClass>DefinitionElement</BaseClass>
2476
2481
  <ECCustomAttributes>
@@ -558,6 +558,10 @@ This behavior applies to all `RoleElement` subclasses.
558
558
 
559
559
  Concrete implementations may offer a way to override the default `TextStyle` instance referenced through the _DefaultTextStyle_ navigation property accordingly.
560
560
 
561
+ ### FormatSet
562
+
563
+ A [Format](https://www.itwinjs.org/reference/ecschema-metadata/metadata/format/) is used to control how unitized values shall be displayed in the user-interface. [FormatSets](https://www.itwinjs.org/reference/ecschema-metadata/metadata/formatset/) are typically maintained outside of BIS Repositories. However, there are use-cases that need FormatSets to be stored in BIS Repositories as `DefinitionElement`s (shared data). The latter cases shall use the `FormatSet` BIS class to capture their settings.
564
+
561
565
  ## Relationship Classes
562
566
 
563
567
  ### PhysicalTypeComposesSubTypes
@@ -578,4 +582,211 @@ The scenario presented in such example is addressed by introducing a `SpatialLoc
578
582
 
579
583
  ![Class diagram](media/SpatialLocationTypeRepresents-classes.png)
580
584
 
581
- ![Instance diagram](media/SpatialLocationTypeRepresents-instances.png)
585
+ ![Instance diagram](media/SpatialLocationTypeRepresents-instances.png)
586
+
587
+ ## Sample ECSQL queries
588
+
589
+ - `DrawingGraphic`s representing `GeometricElement3d`s, organized per `Drawing`
590
+
591
+ ```sql
592
+ SELECT
593
+ dr.ECInstanceId [DrawingId],
594
+ d.ECInstanceId [DrawingGraphicId],
595
+ g.ECInstanceId [GeometricElement3dId]
596
+ FROM
597
+ bis.GeometricElement3d g INNER JOIN
598
+ bis.DrawingGraphicRepresentsElement r ON g.ECInstanceId = r.TargetECInstanceId INNER JOIN
599
+ bis.DrawingGraphic d ON d.ECInstanceId = r.SourceECInstanceId INNER JOIN
600
+ bis.DrawingModel dm ON dm.ECInstanceId = d.Model.Id INNER JOIN
601
+ bis.Drawing dr ON dr.ECInstanceId = dm.ModeledElement.Id
602
+ ORDER BY
603
+ dr.ECInstanceId
604
+ ```
605
+
606
+ - Count of `GeometricElement3d`s that have assigned _Geometry_, per concrete _ECClass_.
607
+
608
+ ```sql
609
+ SELECT
610
+ ec_classname(ECClassId),
611
+ COUNT(*)
612
+ FROM
613
+ bis.GeometricElement3d
614
+ WHERE
615
+ GeometryStream IS NOT NULL
616
+ GROUP BY
617
+ ECClassId
618
+ ```
619
+
620
+ - Count of `PhysicalElement`s per `PhysicalMaterial`.
621
+
622
+ ```sql
623
+ SELECT
624
+ pm.CodeValue,
625
+ COUNT(*)
626
+ FROM
627
+ (SELECT
628
+ pe.ECInstanceId,
629
+ coalesce(pe.PhysicalMaterial.Id, pt.PhysicalMaterial.Id) [PhysicalMaterialId]
630
+ FROM bis.PhysicalElement pe
631
+ LEFT JOIN bis.PhysicalType pt ON pe.TypeDefinition.Id = pt.ECInstanceId) pmat
632
+ INNER JOIN bis.PhysicalMaterial pm ON pmat.PhysicalMaterialId = pm.ECInstanceId
633
+ GROUP BY
634
+ pm.ECInstanceId
635
+ ```
636
+
637
+ - Count of `Element`s per associated `RepositoryLink` (provenance).
638
+
639
+ ```sql
640
+ SELECT
641
+ rl.CodeValue,
642
+ rl.UserLabel,
643
+ COUNT(*)
644
+ FROM
645
+ bis.RepositoryLink rl INNER JOIN
646
+ bis.ExternalSource s ON s.Repository.Id = rl.ECInstanceId INNER JOIN
647
+ bis.ExternalSourceAspect xsa ON xsa.Source.Id = s.ECInstanceId
648
+ WHERE
649
+ rl.ECInstanceId = :repositoryLinkId
650
+ ```
651
+
652
+ - _Name_ and _Version_ of the iModel Connector that synchronized a particular Element (if any):
653
+
654
+ ```sql
655
+ SELECT
656
+ xs.ConnectorName,
657
+ xs.ConnectorVersion
658
+ FROM
659
+ bis.Element e
660
+ INNER JOIN bis.ExternalSourceAspect xsa ON e.ECInstanceId = xsa.Element.Id
661
+ INNER JOIN bis.ExternalSource xs ON xs.ECInstanceId = xsa.Source.Id
662
+ WHERE
663
+ e.ECInstanceId = :elementId
664
+ ```
665
+
666
+ - Subject hierarchy reported according to element-creation order.
667
+
668
+ ```sql
669
+ SELECT
670
+ ECInstanceId,
671
+ CodeValue,
672
+ Parent.Id,
673
+ ec_classname(ECClassId),
674
+ UserLabel,
675
+ JsonProperties
676
+ FROM
677
+ bis.Element
678
+ WHERE
679
+ ECClassId IS (bis.Subject, bis.InformationPartitionElement)
680
+ ORDER BY
681
+ ECInstanceId
682
+ ```
683
+
684
+ - Subject hierarchy (elements in the Repository Model) traversed recursively (i.e. Depth-First search) starting at the _Root Subject_.
685
+
686
+ ```sql
687
+ WITH RECURSIVE elementsInHierarchy(id) AS (
688
+ VALUES(0x1)
689
+ UNION ALL
690
+ SELECT
691
+ ECInstanceId
692
+ FROM
693
+ bis.Element e,
694
+ elementsInHierarchy h
695
+ WHERE
696
+ e.Parent.Id = h.id)
697
+ SELECT
698
+ e.ECInstanceId,
699
+ e.CodeValue,
700
+ e.UserLabel,
701
+ ec_classname(e.ECClassId)
702
+ FROM
703
+ elementsInHierarchy h,
704
+ bis.Element e
705
+ WHERE
706
+ e.ECInstanceId = h.id
707
+ ```
708
+
709
+ - All elements under a particular `Subject`, queried recursively.
710
+
711
+ ```sql
712
+ WITH RECURSIVE elementsInHierarchy(id) AS (
713
+ VALUES(:subjectId)
714
+ UNION ALL
715
+ SELECT
716
+ e.ECInstanceId
717
+ FROM
718
+ bis.Element e,
719
+ elementsInHierarchy h,
720
+ bis.Element he
721
+ WHERE
722
+ (he.ECInstanceId = h.id) AND ((he.ECClassId IS (bis.IParentElement) AND e.Parent.Id = h.id)
723
+ OR (he.ECClassId IS (bis.ISubModeledElement) AND e.Model.Id = h.id)))
724
+ SELECT
725
+ e.ECInstanceId,
726
+ e.CodeValue,
727
+ e.UserLabel,
728
+ ec_classname(e.ECClassId)
729
+ FROM
730
+ elementsInHierarchy h,
731
+ bis.Element e
732
+ WHERE
733
+ e.ECInstanceId = h.id
734
+ ```
735
+
736
+ - Query for the _Channel_ (Key and Version) in which a particular _Element_ is in. Returns '<shared>' if the _Element_ is not in any Channel explicitely.
737
+
738
+ ```sql
739
+ WITH RECURSIVE ancestors(id) AS (
740
+ VALUES(:elementId)
741
+ UNION ALL
742
+ SELECT
743
+ coalesce(p.ECInstanceId, m.ECInstanceId)
744
+ FROM
745
+ bis.Element e,
746
+ bis.Element m,
747
+ ancestors a
748
+ LEFT JOIN bis.Element p ON e.Parent.Id = p.ECInstanceId
749
+ WHERE
750
+ e.ECInstanceId = a.id AND e.Model.Id = m.ECInstanceId AND e.Model.id <> e.ECInstanceId)
751
+ SELECT
752
+ coalesce(cra.Owner, '<shared>') [Channel Key],
753
+ coalesce(cra.Version, NULL) [Channel Version]
754
+ FROM
755
+ bis.Subject e LEFT JOIN bis.ChannelRootAspect cra ON cra.Element.Id = e.ECInstanceId,
756
+ ancestors a
757
+ WHERE
758
+ e.ECInstanceId = a.id AND (cra.ECInstanceId IS NOT NULL OR e.ECInstanceId = 0x1)
759
+ ORDER BY
760
+ e.ECInstanceId DESC
761
+ LIMIT
762
+ 1
763
+ ```
764
+
765
+ - Query for all _Channels_ and return its _channel key_, _channel version_ and count of elements on each. Returns '<shared>' to account for any elements that are not in any particular _Channel_.
766
+
767
+ ```sql
768
+ WITH RECURSIVE descendents(id, channelId) AS (
769
+ VALUES(0x1, 0x1)
770
+ UNION ALL
771
+ SELECT
772
+ e.ECInstanceId,
773
+ coalesce(cra.Element.Id, d.channelId)
774
+ FROM
775
+ bis.Element e,
776
+ descendents d,
777
+ bis.Element he LEFT JOIN bis.ChannelRootAspect cra ON cra.Element.Id = he.ECInstanceId
778
+ WHERE
779
+ (he.ECInstanceId = d.id) AND ((he.ECClassId IS (bis.IParentElement) AND e.Parent.Id = d.id)
780
+ OR (he.ECClassId IS (bis.ISubModeledElement) AND e.Model.Id = d.id)))
781
+ SELECT
782
+ coalesce(channel.Owner, '<shared>') [Channel Key],
783
+ coalesce(channel.Version, NULL) [Channel Version],
784
+ COUNT(*)
785
+ FROM
786
+ bis.Subject s LEFT JOIN bis.ChannelRootAspect channel ON s.ECInstanceId = channel.Element.Id,
787
+ descendents d
788
+ WHERE
789
+ d.channelId = s.ECInstanceId
790
+ GROUP BY
791
+ s.ECInstanceId
792
+ ```
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright © 2017-2025 Bentley Systems, Incorporated. All rights reserved.
3
+ Copyright © 2017-2026 Bentley Systems, Incorporated. All rights reserved.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bentley/bis-core-schema",
3
3
  "license": "MIT",
4
- "version": "1.0.26-dev.1",
4
+ "version": "1.0.26-dev.2",
5
5
  "homepage": "https://www.itwinjs.org/",
6
6
  "keywords": [
7
7
  "Bentley",
@@ -12,5 +12,9 @@
12
12
  "author": {
13
13
  "name": "Bentley Systems, Inc.",
14
14
  "url": "http://www.bentley.com"
15
+ },
16
+ "exports" : {
17
+ "./BisCore.ecschema.xml": "./BisCore.ecschema.xml",
18
+ "./BisCore.ecschema.json": "./BisCore.ecschema.json"
15
19
  }
16
20
  }