Definição de SemanticModel

Este artigo fornece um detalhamento da estrutura de definição para itens de modelo semântico.

Formatos com suporte

Definições de modelo semântico podem usar ou TMDLTMSL formatar, mas não ambas ao mesmo tempo.

Por padrão, o TMDL formato é usado.

Partes de definição

Caminho da parte de definição tipo Obrigatório Descrição
definition/ definição/partes (TMDL) true 1 Definição tabular do Analysis Services usando o formato TMDL .
model.bim Parte model.bim (TMSL) true 1 Definição de tabela do Analysis Services usando o formato TMSL .
diagramLayout.json diagramLayout.json parte falso Contém metadados de diagrama do modelo semântico.
definition.pbism parte definition.pbism verdadeiro Contém as configurações principais sobre o modelo semântico e a versão de formato de arquivo.

1 – A definition/ parte é necessária para TMDL o formato, enquanto model.bim é necessária para TMSL o formato. Eles são mutuamente exclusivos - um modelo semântico usa um formato ou outro, não ambos.

Saiba mais sobre arquivos de definição de modelo semântico na documentação do Projeto do Power BI.

Exemplo de conteúdo usando TMDL o formato:

SemanticModel/
├── definition/ 
│   ├── tables/
│   │   ├── product.tmdl
│   │   ├── sales.tmdl
│   │   ├── calendar.tmdl
│   ├── relationships.tmdl
│   ├── model.tmdl
│   ├── database.tmdl
├── Copilot/
│   ├── Instructions/
│   │   ├── instructions.md
│   │   ├── version.json
│   ├── VerifiedAnswers/
│   ├── schema.json
│   ├── examplePrompts.json
│   ├── settings.json
│   └── version.json
├── diagramLayout.json 
└── definition.pbism 
{
    "parts": [
        {
            "path": "definition/database.tmdl",
            "payload": "<base64 encoded string>",
            "payloadType": "InlineBase64"
        },
        {
            "path": "definition/model.tmdl",
            "payload": "<base64 encoded string>",
            "payloadType": "InlineBase64"
        },
        {
            "path": "definition/tables/product.tmdl",
            "payload": "<base64 encoded string>",
            "payloadType": "InlineBase64"
        },
        {
            "path": "definition/tables/sales.tmdl",
            "payload": "<base64 encoded string>",
            "payloadType": "InlineBase64"
        },
        ...
        {
            "path": "definition.pbism",
            "payload": "<base64 encoded string>",
            "payloadType": "InlineBase64"
        },
        {
            "path": "diagramLayout.json",
            "payload": "<base64 encoded string>",
            "payloadType": "InlineBase64"
        }
    ]
}

definição/parte

Exemplo de definition/ pasta:

definition/ 
├── tables/
│   ├── product.tmdl
│   ├── sales.tmdl
│   ├── calendar.tmdl
├── relationships.tmdl
├── model.tmdl
├── database.tmdl

Exemplo de tables/product.tmdl

table Product

	measure '# Products' = COUNTROWS('Product')
		formatString: #,##0

	column Product
		dataType: string
		isDefaultLabel
		summarizeBy: none
		sourceColumn: Product

	column ProductKey
		dataType: int64
		isHidden
		isKey
		summarizeBy: none
		sourceColumn: ProductKey

	column Category
		dataType: string
		summarizeBy: none
		sourceColumn: Category		

	partition Product-171f48b3-e0ea-4ea3-b9a0-c8c673eb0648 = m
		mode: import
		source =
				let				    
				    ...
				in
				    #"FinalStep"

parte model.bim

Exemplo de model.bim arquivo:

{
  "compatibilityLevel": 1702,
  "model": {
    "annotations": [],
    "culture": "en-US",
    "sourceQueryCulture": "en-US",
    "cultures": [],
    "dataAccessOptions": {
      "legacyRedirects": true,
      "returnErrorValuesAsNull": true
    },
    "defaultPowerBIDataSourceVersion": "powerBI_V3",
    "discourageImplicitMeasures": true,
    "expressions": [],
    "functions": [],
    "perspectives": [],
    "relationships": [],
    "roles": [],    
    "tables": [      
      {
        "name": "Product",
        "annotations": [],
        "columns": [
          {
            "name": "Product",
            "dataType": "string",
            "isDefaultLabel": true,            
            "sourceColumn": "Product",
            "summarizeBy": "none"
          },
          {
            "name": "ProductKey",        
            "dataType": "int64",
            "formatString": "0",
            "isAvailableInMdx": false,
            "isHidden": true,
            "isKey": true,            
            "sourceColumn": "ProductKey",
            "summarizeBy": "none"
          }
          ,
          {
            "name": "Category",
            "dataType": "string",            
            "sourceColumn": "Category",
            "summarizeBy": "none"
          }
        ],        
        "measures": [
          {
            "name": "# Products",
            "expression": "COUNTROWS('Product')",
            "formatString": "#,##0",
            "lineageTag": "1f8f1a2a-06b6-4989-8af7-212719cf3617"
          }
        ],
        "partitions": [
          {
            "name": "Product-171f48b3-e0ea-4ea3-b9a0-c8c673eb0648",
            "mode": "import",
            "source": {
              "expression": [
                "let",
                "    ...",
                "in",
                "    #\"FinalStep\""
              ],
              "type": "m"
            }
          }
        ]
      }
    ]
  }
}

diagramLayout.json parte

Exemplo de diagramLayout.json arquivo:

{
  "version": "1.1.0",
  "diagrams": [
    {
      "ordinal": 0,
      "scrollPosition": {
        "x": 0,
        "y": 74.883720930232556
      },
      "nodes": [
        {
          "location": {
            "x": 942.5095849858792,
            "y": 14.090768666666882
          },
          "nodeIndex": "[Table Name]",
          "nodeLineageTag": "[Table Lineage Tag]",
          "size": {
            "height": 1000,
            "width": 254
          },
          "zIndex": 5
        },
        {
          "location": {
            "x": 537.83428438628755,
            "y": 836.33418866666739
          },
          "nodeIndex": "[Table Name]",
          "nodeLineageTag": "[Table Lineage Tag]",
          "size": {
            "height": 481,
            "width": 276
          },
          "zIndex": 2
        }
      ],
      "name": "All tables",
      "zoomValue": 74.782608695652172,
      "pinKeyFieldsToTop": false,
      "showExtraHeaderInfo": false,
      "hideKeyFieldsWhenCollapsed": false,
      "tablesLocked": false
    }
  ],
  "selectedDiagram": "All tables",
  "defaultDiagram": "All tables"
}

parte definition.pbism

Exemplo de definition.pbism arquivo:

{
  "$schema": "https://developer.microsoft.com/json-schemas/fabric/item/semanticModel/definitionProperties/1.0.0/schema.json",
  "version": "5.0",
  "settings": {
    "qnaEnabled": false
  }
}