diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..9affc17b --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +#GUSINFO:MS API Platform +* @aml-org/team-amf diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..e0325e5a --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v16.17.1 diff --git a/.scalafmt.conf b/.scalafmt.conf index 3261ab35..6e2a1804 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,6 @@ -style = defaultWithAlign +version = "3.5.0" maxColumn = 120 -continuationIndent.callSite=4 -continuationIndent.defnSite=4 +project.git = true +runner.dialect = scala212 +preset = default +align.preset = more diff --git a/.sdkmanrc b/.sdkmanrc new file mode 100644 index 00000000..3f67b8be --- /dev/null +++ b/.sdkmanrc @@ -0,0 +1,5 @@ +# Enable auto-env through the sdkman_auto_env config +# Add key=value pairs of SDKs to use below +java=17.0.10-tem +scala=2.12.20 +sbt=1.10.4 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 58a76c26..c39f2120 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,65 +1 @@ -FROM ubuntu:18.04 - -ARG USER_HOME_DIR="/root" - -ENV SCALA_VERSION 2.12.11 -ENV SBT_VERSION 1.3.9 - -# Update the repository sources list and install dependencies -RUN apt-get update - -RUN apt-get install -y software-properties-common unzip htop rsync openssh-client jq - -# Set the locale -RUN apt-get update && apt-get install -y locales -RUN echo "en_US UTF-8" >> /etc/locale.gen -RUN dpkg-reconfigure locales -RUN locale-gen en_US.UTF-8 -RUN localedef -c -i en_US -f UTF-8 en_US.UTF-8 -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 - -# install Java -USER root -RUN mkdir -p /usr/share/man/man1 && \ - apt-get update -y && \ - apt-get install -y openjdk-8-jdk - -RUN apt-get install unzip -y && \ - apt-get autoremove -y && \ - apt-get install git -y - -# Install Scala -## Piping curl directly in tar -RUN \ - apt-get install curl --assume-yes && \ - curl -fsL http://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz | tar xfz - -C /root/ && \ - echo >> /root/.bashrc && \ - echo 'export PATH=~/scala-$SCALA_VERSION/bin:$PATH' >> /root/.bashrc - -# Install sbt -RUN \ - curl -L -o sbt-$SBT_VERSION.deb https://scala.jfrog.io/artifactory/debian/sbt-$SBT_VERSION.deb && \ - dpkg -i sbt-$SBT_VERSION.deb && \ - rm sbt-$SBT_VERSION.deb && \ - sbt sbtVersion - -VOLUME "$USER_HOME_DIR/.sbt" - -# Install nodejs -RUN \ - curl -sL https://deb.nodesource.com/setup_8.x | bash - - -RUN \ - apt-get install nodejs --assume-yes - -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 -ENV JAVA_TOOL_OPTIONS -Dfile.encoding=UTF8 - -# Final user and home config -RUN useradd --create-home --shell /bin/bash jenkins -USER jenkins -WORKDIR /home/jenkins +FROM ghcr.io/aml-org/amf-ci-tools-base-image:1.4.0 \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index 4420bf11..e8841665 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,76 +1,120 @@ #!groovy +@Library('amf-jenkins-library') _ + +import groovy.transform.Field + +def SLACK_CHANNEL = '#amf-jenkins' +def PRODUCT_NAME = "amf-aml" +def lastStage = "" +def color = '#FF8C00' +def headerFlavour = "WARNING" +@Field AMF_JOB = "application/AMF/amf/develop" +@Field AMF_CUSTOM_VALIDATOR_SCALAJS_JOB = "application/AMF/amf-custom-validator-scalajs/develop" pipeline { - agent { - dockerfile { - filename 'Dockerfile' - registryCredentialsId 'dockerhub-pro-credentials' + options { + timeout(time: 30, unit: 'MINUTES') + ansiColor('xterm') } - } - environment { - NEXUS = credentials('exchange-nexus') - GITHUB_ORG = 'aml-org' - GITHUB_REPO = 'amf-aml' - } - stages { - stage('Test') { - steps { - wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) { - sh 'sbt -mem 4096 -Dfile.encoding=UTF-8 clean coverage test coverageReport' + agent { + dockerfile { + registryCredentialsId 'dockerhub-pro-credentials' + registryCredentialsId 'github-salt' + registryUrl 'https://ghcr.io' } - } } - stage('Coverage') { - when { - anyOf { - branch 'master' - branch 'develop' + environment { + NEXUS = credentials('exchange-nexus') + NEXUSIQ = credentials('nexus-iq') + GITHUB_ORG = 'aml-org' + GITHUB_REPO = 'amf-aml' + BUILD_NUMBER = "${env.BUILD_NUMBER}" + BRANCH_NAME = "${env.BRANCH_NAME}" + NPM_TOKEN = credentials('npm-mulesoft') + CURRENT_VERSION = sh(script: "cat dependencies.properties | grep \"version\" | cut -d '=' -f 2", returnStdout: true) + } + stages { + stage('Test') { + steps { + script { + lastStage = env.STAGE_NAME + sh 'sbt -mem 4096 -Dfile.encoding=UTF-8 clean coverage test coverageAggregate' + } + } } - } - steps { - wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) { - withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'sonarqube-official', passwordVariable: 'SONAR_SERVER_TOKEN', usernameVariable: 'SONAR_SERVER_URL']]) { - sh 'sbt -Dsonar.host.url=${SONAR_SERVER_URL} sonarScan' - } + stage('Coverage') { + when { + anyOf { + branch 'master' + branch 'develop' + } + } + steps { + withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'sf-sonarqube-official', passwordVariable: 'SONAR_SERVER_TOKEN', usernameVariable: 'SONAR_SERVER_URL']]) { + script { + lastStage = env.STAGE_NAME + sh 'sbt -Dsonar.host.url=${SONAR_SERVER_URL} -Dsonar.login=${SONAR_SERVER_TOKEN} sonarScan' + } + } + } } - } - } - stage('Publish') { - when { - anyOf { - branch 'master' - branch 'develop' + stage('Publish') { + when { + anyOf { + branch 'master' + branch 'develop' + } + } + steps { + script { + lastStage = env.STAGE_NAME + sh ''' + echo "about to publish in sbt" + sbt publish + echo "sbt publishing successful" + ''' + } + } + } + stage('Triggers') { + when { + anyOf { + branch 'develop' + } + } + steps { + script { + lastStage = env.STAGE_NAME + echo "Triggering amf on develop branch" + build job: AMF_JOB, wait: false + echo "Triggering amf-custom-validator-scalajs on develop branch" + build job: AMF_CUSTOM_VALIDATOR_SCALAJS_JOB, wait: false + } + } } - } - steps { - wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) { - sh ''' - echo "about to publish in sbt" - sbt publish - echo "sbt publishing successful" - ''' + stage('Tag version') { + when { + anyOf { + branch 'master' + } + } + steps { + withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'github-salt', passwordVariable: 'GITHUB_PASS', usernameVariable: 'GITHUB_USER']]) { + script { + lastStage = env.STAGE_NAME + def version = sbtArtifactVersion("amlJVM") + tagCommitToGithub(version) + } + } + } } - } } - stage('Tag version') { - when { - anyOf { - branch 'master' - branch 'support/*' + post { + unsuccessful { + failureSlackNotify(lastStage, SLACK_CHANNEL, PRODUCT_NAME) } - } - steps { - withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'github-salt', passwordVariable: 'GITHUB_PASS', usernameVariable: 'GITHUB_USER']]) { - sh '''#!/bin/bash - echo "about to tag the commit with the new version:" - version=$(sbt version | tail -n 1 | grep -o '[0-9].[0-9].[0-9].*') - url="https://${GITHUB_USER}:${GITHUB_PASS}@github.com/${GITHUB_ORG}/${GITHUB_REPO}" - git tag $version - git push $url $version && echo "tagging successful" - ''' + success { + successSlackNotify(SLACK_CHANNEL, PRODUCT_NAME) } - } } - } } - diff --git a/amf-aml/js/src/test/scala/amf/dialects/JsDialectInstancesValidationTest.scala b/amf-aml/js/src/test/scala/amf/dialects/JsDialectInstancesValidationTest.scala index e4a12915..5ca1265c 100644 --- a/amf-aml/js/src/test/scala/amf/dialects/JsDialectInstancesValidationTest.scala +++ b/amf-aml/js/src/test/scala/amf/dialects/JsDialectInstancesValidationTest.scala @@ -4,9 +4,11 @@ import amf.testing.validation.DialectInstancesValidationTest class JsDialectInstancesValidationTest extends DialectInstancesValidationTest { test("validation mule_config example 1 incorrect") { - validate("mule_config_dialect1.yaml", - "mule_config_instance_incorrect1.yaml", - Some("mule_config_instance_incorrect1.report.js.json")) + validate( + "mule_config_dialect1.yaml", + "mule_config_instance_incorrect1.yaml", + Some("mule_config_instance_incorrect1.report.js.json") + ) } test("validation dialect 4 example 1 incorrect") { diff --git a/amf-aml/jvm/src/test/scala/amf/dialects/JvmDialectInstancesValidationTest.scala b/amf-aml/jvm/src/test/scala/amf/dialects/JvmDialectInstancesValidationTest.scala index 57cbf127..be812504 100644 --- a/amf-aml/jvm/src/test/scala/amf/dialects/JvmDialectInstancesValidationTest.scala +++ b/amf-aml/jvm/src/test/scala/amf/dialects/JvmDialectInstancesValidationTest.scala @@ -4,9 +4,11 @@ import amf.testing.validation.DialectInstancesValidationTest class JvmDialectInstancesValidationTest extends DialectInstancesValidationTest { test("validation mule_config example 1 incorrect") { - validate("mule_config_dialect1.yaml", - "mule_config_instance_incorrect1.yaml", - Some("mule_config_instance_incorrect1.report.jvm.json")) + validate( + "mule_config_dialect1.yaml", + "mule_config_instance_incorrect1.yaml", + Some("mule_config_instance_incorrect1.report.jvm.json") + ) } test("validation dialect 4 example 1 incorrect") { diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/platform/AMLConfiguration.scala b/amf-aml/shared/src/main/scala/amf/aml/client/platform/AMLConfiguration.scala index 7928ad5e..f992dc73 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/platform/AMLConfiguration.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/platform/AMLConfiguration.scala @@ -4,6 +4,7 @@ import amf.aml.client.platform.model.document.Dialect import amf.aml.client.platform.model.document.DialectInstance import amf.aml.client.scala.{AMLConfiguration => InternalAMLConfiguration} import amf.aml.internal.convert.VocabulariesClientConverter._ +import amf.core.client.platform.adoption.IdAdopterProvider import amf.core.client.platform.config.{AMFEventListener, ParsingOptions, RenderOptions} import amf.core.client.platform.errorhandling.ErrorHandlerProvider import amf.core.client.platform.execution.BaseExecutionEnvironment @@ -31,10 +32,11 @@ class AMLConfiguration private[amf] (private[amf] override val _internal: Intern /** Contains methods to get information about the current state of the configuration */ def configurationState(): AMLConfigurationState = new AMLConfigurationState(this) - /** - * Set [[ParsingOptions]] - * @param parsingOptions [[ParsingOptions]] to add to configuration object - * @return [[AMLConfiguration]] with [[ParsingOptions]] added + /** Set [[ParsingOptions]] + * @param parsingOptions + * [[ParsingOptions]] to add to configuration object + * @return + * [[AMLConfiguration]] with [[ParsingOptions]] added */ override def withParsingOptions(parsingOptions: ParsingOptions): AMLConfiguration = _internal.withParsingOptions(parsingOptions) @@ -45,76 +47,88 @@ class AMLConfiguration private[amf] (private[amf] override val _internal: Intern override def withErrorHandlerProvider(provider: ErrorHandlerProvider): AMLConfiguration = _internal.withErrorHandlerProvider(() => provider.errorHandler()) - /** - * Add a [[ResourceLoader]] - * @param rl [[ResourceLoader]] to add to configuration object - * @return [[AMLConfiguration]] with the [[ResourceLoader]] added + /** Add a [[ResourceLoader]] + * @param rl + * [[ResourceLoader]] to add to configuration object + * @return + * [[AMLConfiguration]] with the [[ResourceLoader]] added */ override def withResourceLoader(rl: ResourceLoader): AMLConfiguration = _internal.withResourceLoader(ResourceLoaderMatcher.asInternal(rl)) - /** - * Set the configuration [[ResourceLoader]]s - * @param rl a list of [[ResourceLoader]] to set to the configuration object - * @return [[AMLConfiguration]] with [[ResourceLoader]]s set + /** Set the configuration [[ResourceLoader]]s + * @param rl + * a list of [[ResourceLoader]] to set to the configuration object + * @return + * [[AMLConfiguration]] with [[ResourceLoader]]s set */ override def withResourceLoaders(rl: ClientList[ResourceLoader]): AMLConfiguration = _internal.withResourceLoaders(rl.asInternal.toList) - /** - * Set [[UnitCache]] - * @param cache [[UnitCache]] to add to configuration object - * @return [[AMLConfiguration]] with [[UnitCache]] added + /** Set [[UnitCache]] + * @param cache + * [[UnitCache]] to add to configuration object + * @return + * [[AMLConfiguration]] with [[UnitCache]] added */ override def withUnitCache(cache: UnitCache): AMLConfiguration = _internal.withUnitCache(UnitCacheMatcher.asInternal(cache)) - /** - * Add a [[TransformationPipeline]] - * @param pipeline [[TransformationPipeline]] to add to configuration object - * @return [[AMLConfiguration]] with [[TransformationPipeline]] added + /** Add a [[TransformationPipeline]] + * @param pipeline + * [[TransformationPipeline]] to add to configuration object + * @return + * [[AMLConfiguration]] with [[TransformationPipeline]] added */ override def withTransformationPipeline(pipeline: TransformationPipeline): AMLConfiguration = _internal.withTransformationPipeline(pipeline) - /** - * Add an [[AMFEventListener]] - * @param listener [[AMFEventListener]] to add to configuration object - * @return [[AMLConfiguration]] with [[AMFEventListener]] added + /** Add an [[AMFEventListener]] + * @param listener + * [[AMFEventListener]] to add to configuration object + * @return + * [[AMLConfiguration]] with [[AMFEventListener]] added */ override def withEventListener(listener: AMFEventListener): AMLConfiguration = _internal.withEventListener(listener) - /** - * Set [[BaseExecutionEnvironment]] - * @param executionEnv [[BaseExecutionEnvironment]] to set to configuration object - * @return [[AMLConfiguration]] with [[BaseExecutionEnvironment]] set + /** Set [[BaseExecutionEnvironment]] + * @param executionEnv + * [[BaseExecutionEnvironment]] to set to configuration object + * @return + * [[AMLConfiguration]] with [[BaseExecutionEnvironment]] set */ override def withExecutionEnvironment(executionEnv: BaseExecutionEnvironment): AMLConfiguration = _internal.withExecutionEnvironment(executionEnv._internal) - /** - * Register a Dialect - * @param dialect [[Dialect]] to register - * @return [[AMLConfiguration]] with [[Dialect]] registered + /** Register a Dialect + * @param dialect + * [[Dialect]] to register + * @return + * [[AMLConfiguration]] with [[Dialect]] registered */ override def withDialect(dialect: Dialect): AMLConfiguration = _internal.withDialect(dialect) - /** - * Register a Dialect - * @param url URL of the Dialect to register - * @return A CompletableFuture of [[AMLConfiguration]] + /** Register a Dialect + * @param url + * URL of the Dialect to register + * @return + * A CompletableFuture of [[AMLConfiguration]] */ def withDialect(url: String): ClientFuture[AMLConfiguration] = _internal.withDialect(url).asClient - /** - * Register a [[Dialect]] linked from a [[DialectInstance]] - * @param url of the [[DialectInstance]] - * @return A CompletableFuture of [[AMLConfiguration]] + /** Register a [[Dialect]] linked from a [[DialectInstance]] + * @param url + * of the [[DialectInstance]] + * @return + * A CompletableFuture of [[AMLConfiguration]] */ def forInstance(url: String): ClientFuture[AMLConfiguration] = _internal.forInstance(url).asClient override def withShapePayloadPlugin(plugin: AMFShapePayloadValidationPlugin): AMLConfiguration = _internal.withPlugin(PayloadValidationPluginMatcher.asInternal(plugin)) + + override def withIdAdopterProvider(idAdopterProvider: IdAdopterProvider): AMLConfiguration = + _internal.withIdAdopterProvider(idAdopterProvider) } @JSExportAll diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/platform/AMLConfigurationState.scala b/amf-aml/shared/src/main/scala/amf/aml/client/platform/AMLConfigurationState.scala index 5d4d551d..584664ac 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/platform/AMLConfigurationState.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/platform/AMLConfigurationState.scala @@ -14,30 +14,33 @@ class AMLConfigurationState private[amf] (private val _internal: InternalAMLConf this(new InternalAMLConfigurationState(configuration._internal)) } - /** - * Get all instances of registered dialects - * @return a list of [[Dialect]] + /** Get all instances of registered dialects + * @return + * a list of [[Dialect]] */ def getDialects(): ClientList[Dialect] = _internal.getDialects().asClient - /** - * Find an instance of registered dialect with the provided name - * @param name of the dialect to find - * @return a list with the different versions of [[Dialect]] with the same name + /** Find an instance of registered dialect with the provided name + * @param name + * of the dialect to find + * @return + * a list with the different versions of [[Dialect]] with the same name */ def getDialect(name: String): ClientList[Dialect] = _internal.getDialect(name).asClient - /** - * Find an instance of registered dialect with the provided name and version - * @param name of the dialect to find - * @param version of dialect to find - * @return an optional [[Dialect]] + /** Find an instance of registered dialect with the provided name and version + * @param name + * of the dialect to find + * @param version + * of dialect to find + * @return + * an optional [[Dialect]] */ def getDialect(name: String, version: String): ClientOption[Dialect] = getDialect(name, version) - /** - * Get all instances of SemanticExtensions present in the registered dialects - * @return a list of [[SemanticExtension]] + /** Get all instances of SemanticExtensions present in the registered dialects + * @return + * a list of [[SemanticExtension]] */ def getExtensions(): ClientList[SemanticExtension] = _internal.getExtensions().asClient } diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/platform/AMLElementClient.scala b/amf-aml/shared/src/main/scala/amf/aml/client/platform/AMLElementClient.scala index abbb2d24..dcc51cde 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/platform/AMLElementClient.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/platform/AMLElementClient.scala @@ -17,10 +17,10 @@ class AMLElementClient private[amf] (private val _internal: InternalAMLElementCl this(new InternalAMLElementClient(configuration)) } - /** - * Currently supports rendering of dialect domain elements + /** Currently supports rendering of dialect domain elements * - * @param references : optional parameter which will improve emission of references defined in element + * @param references + * : optional parameter which will improve emission of references defined in element */ override def renderToBuilder[T](element: DomainElement, builder: DocBuilder[T]): Unit = { AmlDomainElementEmitter.emitToBuilder(element, getConfiguration(), builder) diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/platform/BaseAMLBaseUnitClient.scala b/amf-aml/shared/src/main/scala/amf/aml/client/platform/BaseAMLBaseUnitClient.scala index 148bef55..3795dc95 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/platform/BaseAMLBaseUnitClient.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/platform/BaseAMLBaseUnitClient.scala @@ -16,28 +16,31 @@ abstract class BaseAMLBaseUnitClient private[amf] (private val _internal: Intern protected implicit val ec: ExecutionContext = _internal.getConfiguration.getExecutionContext - /** - * parse a [[amf.aml.client.scala.model.document.Dialect]] + /** parse a [[amf.aml.client.scala.model.document.Dialect]] * - * @param url of the resource to parse - * @return a CompletableFuture [[AMLDialectResult]] + * @param url + * of the resource to parse + * @return + * a CompletableFuture [[AMLDialectResult]] */ def parseDialect(url: String): ClientFuture[AMLDialectResult] = _internal.parseDialect(url).asClient - /** - * parse a [[amf.aml.client.scala.model.document.DialectInstance]] + /** parse a [[amf.aml.client.scala.model.document.DialectInstance]] * - * @param url of the resource to parse - * @return a CompletableFuture [[AMLDialectInstanceResult]] + * @param url + * of the resource to parse + * @return + * a CompletableFuture [[AMLDialectInstanceResult]] */ def parseDialectInstance(url: String): ClientFuture[AMLDialectInstanceResult] = _internal.parseDialectInstance(url).asClient - /** - * parse a [[amf.aml.client.scala.model.document.Vocabulary]] + /** parse a [[amf.aml.client.scala.model.document.Vocabulary]] * - * @param url of the resource to parse - * @return a CompletableFuture [[AMLVocabularyResult]] + * @param url + * of the resource to parse + * @return + * a CompletableFuture [[AMLVocabularyResult]] */ def parseVocabulary(url: String): ClientFuture[AMLVocabularyResult] = _internal.parseVocabulary(url).asClient } diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/platform/BaseAMLConfiguration.scala b/amf-aml/shared/src/main/scala/amf/aml/client/platform/BaseAMLConfiguration.scala index f95a0a51..a3f6818c 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/platform/BaseAMLConfiguration.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/platform/BaseAMLConfiguration.scala @@ -4,6 +4,7 @@ import amf.aml.client.platform.model.document.Dialect import amf.aml.client.scala.{AMLConfiguration => InternalAMLConfiguration} import amf.aml.internal.convert.VocabulariesClientConverter._ import amf.core.client.platform.AMFGraphConfiguration +import amf.core.client.platform.adoption.IdAdopterProvider import amf.core.client.platform.config.{AMFEventListener, ParsingOptions, RenderOptions} import amf.core.client.platform.errorhandling.ErrorHandlerProvider import amf.core.client.platform.reference.UnitCache @@ -47,4 +48,7 @@ class BaseAMLConfiguration private[amf] (private[amf] override val _internal: In def withDialect(dialect: Dialect): BaseAMLConfiguration = new BaseAMLConfiguration(_internal.withDialect(dialect)) + + override def withIdAdopterProvider(idAdopterProvider: IdAdopterProvider): BaseAMLConfiguration = + new BaseAMLConfiguration(_internal.withIdAdopterProvider(idAdopterProvider)) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/platform/BaseAMLElementClient.scala b/amf-aml/shared/src/main/scala/amf/aml/client/platform/BaseAMLElementClient.scala index ada65c00..db84ef8a 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/platform/BaseAMLElementClient.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/platform/BaseAMLElementClient.scala @@ -12,9 +12,9 @@ import scala.scalajs.js.annotation.JSExportAll abstract class BaseAMLElementClient private[amf] (private val _internal: InternalAMLClient) extends AMFGraphElementClient(_internal) { - /** - * Currently supports rendering of dialect domain elements - * @param references : optional parameter which will improve emission of references defined in element + /** Currently supports rendering of dialect domain elements + * @param references + * : optional parameter which will improve emission of references defined in element */ def renderToBuilder[T](element: DomainElement, builder: DocBuilder[T]): Unit diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/document/Dialect.scala b/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/document/Dialect.scala index b74e4cf0..601433af 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/document/Dialect.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/document/Dialect.scala @@ -5,6 +5,7 @@ import amf.core.client.platform.model.StrField import amf.aml.client.platform.model.domain.{DocumentsModel, External, SemanticExtension} import amf.core.client.platform.model.document.{BaseUnit, DeclaresModel, EncodesModel} import amf.aml.client.scala.model.document.{Dialect => InternalDialect} +import com.github.ghik.silencer.silent import scala.scalajs.js.annotation.{JSExportAll, JSExportTopLevel} @@ -17,16 +18,34 @@ case class Dialect(private[amf] val _internal: InternalDialect) extends BaseUnit def name: StrField = _internal.name() def version: StrField = _internal.version() def nameAndVersion: String = _internal.nameAndVersion() - def header: String = _internal.header - def isLibraryHeader(header: String): Boolean = _internal.isLibraryHeader(header) - def isFragmentHeader(header: String): Boolean = _internal.isFragmentHeader(header) - def libraryHeader: ClientOption[String] = _internal.libraryHeader.asClient - def fragmentHeaders: ClientList[String] = _internal.fragmentHeaders.asClient - def allHeaders: ClientList[String] = _internal.allHeaders.asClient def externals: ClientList[External] = _internal.externals.asClient def documents(): DocumentsModel = DocumentsModel(_internal.documents()) def extensions(): ClientList[SemanticExtension] = _internal.extensions().asClient +// @deprecated("Useless functionality", "AML 6.0.3") + @silent + def header: String = _internal.header + +// @deprecated("Useless functionality", "AML 6.0.3") + @silent + def isLibraryHeader(header: String): Boolean = _internal.isLibraryHeader(header) + +// @deprecated("Useless functionality", "AML 6.0.3") + @silent + def isFragmentHeader(header: String): Boolean = _internal.isFragmentHeader(header) + +// @deprecated("Useless functionality", "AML 6.0.3") + @silent + def libraryHeader: ClientOption[String] = _internal.libraryHeader.asClient + +// @deprecated("Useless functionality", "AML 6.0.3") + @silent + def fragmentHeaders: ClientList[String] = _internal.fragmentHeaders.asClient + +// @deprecated("Useless functionality", "AML 6.0.3") + @silent + def allHeaders: ClientList[String] = _internal.allHeaders.asClient + def withName(name: String): Dialect = { _internal.withName(name) this diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/document/DialectInstanceUnit.scala b/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/document/DialectInstanceUnit.scala index 42a022c0..6afc488a 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/document/DialectInstanceUnit.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/document/DialectInstanceUnit.scala @@ -4,6 +4,7 @@ import amf.aml.internal.convert.VocabulariesClientConverter._ import amf.aml.internal.convert.VocabulariesClientConverter.ClientList import amf.core.client.platform.model.StrField import amf.core.client.platform.model.document.BaseUnit +import com.github.ghik.silencer.silent import scala.scalajs.js.annotation.JSExportAll @@ -18,19 +19,23 @@ trait DialectInstanceUnit extends BaseUnit { this } - @deprecated("Use processingData.definedBy instead", "AML 6.0.0") +// @deprecated("Use processingData.definedBy instead", "AML 6.0.0") + @silent def definedBy(): StrField = _internal.definedBy() - @deprecated("Use processingData.graphDependencies instead", "AML 6.0.0") +// @deprecated("Use processingData.graphDependencies instead", "AML 6.0.0") + @silent def graphDependencies(): ClientList[StrField] = _internal.graphDependencies.asClient - @deprecated("Use processingData.withDefinedBy instead", "AML 6.0.0") +// @deprecated("Use processingData.withDefinedBy instead", "AML 6.0.0") + @silent def withDefinedBy(dialectId: String): this.type = { _internal.withDefinedBy(dialectId) this } - @deprecated("Use processingData.withGraphDependencies instead", "AML 6.0.0") +// @deprecated("Use processingData.withGraphDependencies instead", "AML 6.0.0") + @silent def withGraphDependencies(ids: ClientList[String]): this.type = { _internal.withGraphDependencies(ids.asInternal) this diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/AnnotationMapping.scala b/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/AnnotationMapping.scala index 3ce69d8d..8f131462 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/AnnotationMapping.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/AnnotationMapping.scala @@ -16,7 +16,7 @@ case class AnnotationMapping(override private[amf] val _internal: InternalAnnota def name(): StrField = _internal.name def nodePropertyMapping(): StrField = _internal.nodePropertyMapping() - def domain(): StrField = _internal.domain() + def domain(): ClientList[StrField] = _internal.domain().asClient def literalRange(): StrField = _internal.literalRange() def objectRange(): ClientList[StrField] = _internal.objectRange().asClient def minCount(): IntField = _internal.minCount() @@ -28,12 +28,10 @@ case class AnnotationMapping(override private[amf] val _internal: InternalAnnota def sorted(): BoolField = _internal.sorted() def typeDiscriminator(): ClientMap[String] = Option(_internal.typeDiscriminator()) match { case Some(m) => - m.foldLeft(mutable.Map[String, String]()) { - case (acc, (k, v)) => - acc.put(k, v) - acc - } - .asClient + m.foldLeft(mutable.Map[String, String]()) { case (acc, (k, v)) => + acc.put(k, v) + acc + }.asClient case None => mutable.Map[String, String]().asClient } def typeDiscriminatorName(): StrField = _internal.typeDiscriminatorName() @@ -59,6 +57,10 @@ case class AnnotationMapping(override private[amf] val _internal: InternalAnnota _internal.withAllowMultiple(allow) this } + def withDomain(domains: ClientList[String]): AnnotationMapping = { + _internal.withDomain(domains.asInternal) + this + } def withEnum(values: ClientList[Any]): AnnotationMapping = { _internal.withEnum(values.asInternal) this @@ -90,7 +92,7 @@ case class AnnotationMapping(override private[amf] val _internal: InternalAnnota this } - def withDomain(domainIri: String): AnnotationMapping = { + def withDomain(domainIri: Seq[String]): AnnotationMapping = { _internal.withDomain(domainIri) this } diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/AnyMapping.scala b/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/AnyMapping.scala new file mode 100644 index 00000000..6cf93829 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/AnyMapping.scala @@ -0,0 +1,44 @@ +package amf.aml.client.platform.model.domain + +import amf.aml.client.scala.model.domain.{AnyMapping => InternalAnyMapping} +import amf.aml.internal.convert.VocabulariesClientConverter._ +import amf.core.client.platform.model.StrField +import amf.core.client.platform.model.domain.DomainElement + +import scala.scalajs.js.annotation.JSExportAll + +@JSExportAll +abstract class AnyMapping(override private[amf] val _internal: InternalAnyMapping) extends DomainElement { + + def and(): ClientList[StrField] = _internal.and.asClient + def or(): ClientList[StrField] = _internal.or.asClient + def components(): ClientList[StrField] = _internal.components.asClient + def ifMapping(): StrField = _internal.ifMapping + def thenMapping(): StrField = _internal.thenMapping + def elseMapping(): StrField = _internal.elseMapping + + def withAnd(andMappings: ClientList[String]): AnyMapping = { + _internal.withAnd(andMappings.asInternal) + this + } + def withOr(orMappings: ClientList[String]): AnyMapping = { + _internal.withOr(orMappings.asInternal) + this + } + def withComponents(components: ClientList[String]): AnyMapping = { + _internal.withOr(components.asInternal) + this + } + def withIfMapping(ifMapping: String): AnyMapping = { + _internal.withIfMapping(ifMapping) + this + } + def withThenMapping(thenMapping: String): AnyMapping = { + _internal.withIfMapping(thenMapping) + this + } + def withElseMapping(elseMapping: String): AnyMapping = { + _internal.withIfMapping(elseMapping) + this + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/ClassTerm.scala b/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/ClassTerm.scala index fd531e08..1b27d4ff 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/ClassTerm.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/ClassTerm.scala @@ -7,8 +7,7 @@ import amf.aml.client.scala.model.domain.{ClassTerm => InternalClassTerm} import scala.scalajs.js.annotation.{JSExportAll, JSExportTopLevel} -/** - * Class term from a vocabulary model +/** Class term from a vocabulary model */ @JSExportAll case class ClassTerm(override private[amf] val _internal: InternalClassTerm) extends DomainElement { @@ -16,38 +15,32 @@ case class ClassTerm(override private[amf] val _internal: InternalClassTerm) ext @JSExportTopLevel("ClassTerm") def this() = this(InternalClassTerm()) - /** - * Name of the term used as the basis of the term URI identifeir + /** Name of the term used as the basis of the term URI identifeir * @return */ def name: StrField = _internal.name - /** - * Human readable name for the term + /** Human readable name for the term * @return */ def displayName: StrField = _internal.displayName - /** - * Human readable long description of the term + /** Human readable long description of the term * @return */ def description: StrField = _internal.description - /** - * Properties that have the class term in the domain + /** Properties that have the class term in the domain * @return */ def properties: ClientList[StrField] = _internal.properties.asClient - /** - * List of super terms for the class term + /** List of super terms for the class term * @return */ def subClassOf: ClientList[StrField] = _internal.subClassOf.asClient - /** - * Sets the name for the class term + /** Sets the name for the class term * @param name * @return */ @@ -56,8 +49,7 @@ case class ClassTerm(override private[amf] val _internal: InternalClassTerm) ext this } - /** - * Sets the human readable name of the term + /** Sets the human readable name of the term * @param displayName * @return */ @@ -66,8 +58,7 @@ case class ClassTerm(override private[amf] val _internal: InternalClassTerm) ext this } - /** - * Sets the description of the class term + /** Sets the description of the class term * @param description * @return */ @@ -76,8 +67,7 @@ case class ClassTerm(override private[amf] val _internal: InternalClassTerm) ext this } - /** - * Sets the class term in the domain of the provaded properties + /** Sets the class term in the domain of the provaded properties * @param properties * @return */ @@ -86,8 +76,7 @@ case class ClassTerm(override private[amf] val _internal: InternalClassTerm) ext this } - /** - * Sets the super classes for this class term + /** Sets the super classes for this class term * @param superClasses * @return */ diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/NodeMapping.scala b/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/NodeMapping.scala index 1a799241..7d2b4894 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/NodeMapping.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/NodeMapping.scala @@ -1,14 +1,17 @@ package amf.aml.client.platform.model.domain -import amf.aml.internal.convert.VocabulariesClientConverter._ -import amf.core.client.platform.model.domain.{DomainElement, Linkable} import amf.aml.client.scala.model.domain.{NodeMapping => InternalNodeMapping} +import amf.aml.internal.convert.VocabulariesClientConverter._ import amf.core.client.platform.model.StrField +import amf.core.client.platform.model.domain.Linkable +import amf.core.client.scala.model.BoolField import scala.scalajs.js.annotation.{JSExportAll, JSExportTopLevel} @JSExportAll -case class NodeMapping(override private[amf] val _internal: InternalNodeMapping) extends DomainElement with Linkable { +case class NodeMapping(override private[amf] val _internal: InternalNodeMapping) + extends AnyMapping(_internal) + with Linkable { @JSExportTopLevel("NodeMapping") def this() = this(InternalNodeMapping()) @@ -18,6 +21,7 @@ case class NodeMapping(override private[amf] val _internal: InternalNodeMapping) def propertiesMapping(): ClientList[PropertyMapping] = _internal.propertiesMapping().asClient def idTemplate: StrField = _internal.idTemplate def mergePolicy: StrField = _internal.mergePolicy + def closed: BoolField = _internal.closed def withName(name: String): NodeMapping = { _internal.withName(name) diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/PropertyMapping.scala b/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/PropertyMapping.scala index fb3fec14..6ce97050 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/PropertyMapping.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/PropertyMapping.scala @@ -24,96 +24,99 @@ case class PropertyMapping(override private[amf] val _internal: InternalProperty @JSExportTopLevel("PropertyMapping") def this() = this(InternalPropertyMapping()) + def name(): StrField = _internal.name() + def nodePropertyMapping(): StrField = _internal.nodePropertyMapping() + def literalRange(): StrField = _internal.literalRange() + def objectRange(): ClientList[StrField] = _internal.objectRange().asClient + def mapKeyProperty(): StrField = _internal.mapKeyProperty() + def mapValueProperty(): StrField = _internal.mapKeyProperty() + def minCount(): IntField = _internal.minCount() + def pattern(): StrField = _internal.pattern() + def minimum(): DoubleField = _internal.minimum() + def maximum(): DoubleField = _internal.maximum() + def allowMultiple(): BoolField = _internal.allowMultiple() + def enum(): ClientList[AnyField] = _internal.enum().asClient + def sorted(): BoolField = _internal.sorted() + def typeDiscriminatorName(): StrField = _internal.typeDiscriminatorName() + def externallyLinkable(): BoolField = _internal.externallyLinkable() + def mandatory(): BoolField = _internal.mandatory() + def typeDiscriminator(): ClientMap[String] = Option(_internal.typeDiscriminator()) match { + case Some(m) => + m.foldLeft(mutable.Map[String, String]()) { case (acc, (k, v)) => + acc.put(k, v) + acc + }.asClient + case None => mutable.Map[String, String]().asClient + } + def withName(name: String): PropertyMapping = { _internal.withName(name) this } - def name(): StrField = _internal.name() def withNodePropertyMapping(propertyId: String): PropertyMapping = { _internal.withNodePropertyMapping(propertyId) this } - def nodePropertyMapping(): StrField = _internal.nodePropertyMapping() def withLiteralRange(range: String): PropertyMapping = { _internal.withLiteralRange(range) this } - def literalRange(): StrField = _internal.literalRange() def withObjectRange(range: ClientList[String]): PropertyMapping = { _internal.withObjectRange(range.asInternal) this } - def objectRange(): ClientList[StrField] = _internal.objectRange().asClient - def mapKeyProperty(): StrField = _internal.mapKeyProperty() def withMapKeyProperty(key: String): PropertyMapping = { _internal.withMapKeyProperty(key) this } - def mapValueProperty(): StrField = _internal.mapKeyProperty() def withMapValueProperty(value: String): PropertyMapping = { _internal.withMapValueProperty(value) this } - def minCount(): IntField = _internal.minCount() def withMinCount(minCount: Int): PropertyMapping = { _internal.withMinCount(minCount) this } - def pattern(): StrField = _internal.pattern() def withPattern(pattern: String): PropertyMapping = { _internal.withPattern(pattern) this } - def minimum(): DoubleField = _internal.minimum() def withMinimum(min: Double): PropertyMapping = { _internal.withMinimum(min) this } - def maximum(): DoubleField = _internal.maximum() def withMaximum(max: Double): PropertyMapping = { _internal.withMaximum(max) this } - def allowMultiple(): BoolField = _internal.allowMultiple() def withAllowMultiple(allow: Boolean): PropertyMapping = { _internal.withAllowMultiple(allow) this } - def enum(): ClientList[AnyField] = _internal.enum().asClient def withEnum(values: ClientList[Any]): PropertyMapping = { _internal.withEnum(values.asInternal) this } - def sorted(): BoolField = _internal.sorted() def withSorted(sorted: Boolean): PropertyMapping = { _internal.withSorted(sorted) this } - def typeDiscriminator(): ClientMap[String] = Option(_internal.typeDiscriminator()) match { - case Some(m) => - m.foldLeft(mutable.Map[String, String]()) { - case (acc, (k, v)) => - acc.put(k, v) - acc - } - .asClient - case None => mutable.Map[String, String]().asClient - } - def withTypeDiscriminator(typesMapping: ClientMap[String]): PropertyMapping = { _internal.withTypeDiscriminator(typesMapping.asInternal) this } - - def typeDiscriminatorName(): StrField = _internal.typeDiscriminatorName() - def withTypeDiscriminatorName(name: String): PropertyMapping = { _internal.withTypeDiscriminatorName(name) this } - - def withExternallyLinkable(linkable: Boolean): PropertyMapping = _internal.withExternallyLinkable(linkable) - def externallyLinkable(): BoolField = _internal.externallyLinkable() + def withExternallyLinkable(linkable: Boolean): PropertyMapping = { + _internal.withExternallyLinkable(linkable) + this + } + def withMandatory(mandatory: Boolean): PropertyMapping = { + _internal.withMandatory(mandatory) + this + } def classification(): String = { _internal.classification() match { diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/PropertyTerm.scala b/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/PropertyTerm.scala index e289cf45..bd6f6d1e 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/PropertyTerm.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/PropertyTerm.scala @@ -43,8 +43,7 @@ abstract class PropertyTerm(override private[amf] val _internal: InternalPropert } } -/** - * Object property term from a vocabulary +/** Object property term from a vocabulary * @param _internal */ @JSExportAll @@ -56,8 +55,7 @@ case class ObjectPropertyTerm(override private[amf] val _internal: InternalObjec } -/** - * Datatype property term from a vocabulary +/** Datatype property term from a vocabulary * @param _internal */ @JSExportAll diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/UnionNodeMapping.scala b/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/UnionNodeMapping.scala index e2a39cb5..e4cc0358 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/UnionNodeMapping.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/UnionNodeMapping.scala @@ -1,15 +1,15 @@ package amf.aml.client.platform.model.domain -import amf.core.client.platform.model.StrField +import amf.aml.client.scala.model.domain.{UnionNodeMapping => InternalUnionNodeMapping} import amf.aml.internal.convert.VocabulariesClientConverter._ -import amf.core.client.platform.model.domain.{DomainElement, Linkable} +import amf.core.client.platform.model.StrField +import amf.core.client.platform.model.domain.Linkable import scala.scalajs.js.annotation.{JSExportAll, JSExportTopLevel} -import amf.aml.client.scala.model.domain.{UnionNodeMapping => InternalUnionNodeMapping} @JSExportAll case class UnionNodeMapping(override private[amf] val _internal: InternalUnionNodeMapping) - extends DomainElement + extends AnyMapping(_internal) with Linkable { @JSExportTopLevel("UnionNodeMapping") diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/VocabularyReference.scala b/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/VocabularyReference.scala index 033c2560..603b1ac3 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/VocabularyReference.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/platform/model/domain/VocabularyReference.scala @@ -8,8 +8,7 @@ import amf.aml.client.scala.model.domain.{VocabularyReference => InternalVocabul import scala.scalajs.js.annotation.{JSExportAll, JSExportTopLevel} @JSExportAll -case class VocabularyReference(override private[amf] val _internal: InternalVocabularyReference) - extends DomainElement { +case class VocabularyReference(override private[amf] val _internal: InternalVocabularyReference) extends DomainElement { @JSExportTopLevel("VocabularyReference") def this() = this(InternalVocabularyReference()) diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/platform/render/AmlDomainElementEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/client/platform/render/AmlDomainElementEmitter.scala index 88b82fe4..4b8cee45 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/platform/render/AmlDomainElementEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/platform/render/AmlDomainElementEmitter.scala @@ -19,9 +19,10 @@ object AmlDomainElementEmitter { .configurationState() .getDialects() .find( - _.declares - .collectFirst({ case nm: NodeMapping if internalElement.meta.`type`.exists(_.iri() == nm.id) => nm }) - .isDefined) + _.declares + .collectFirst({ case nm: NodeMapping if internalElement.meta.`type`.exists(_.iri() == nm.id) => nm }) + .isDefined + ) .foreach { emissionStructure => val handler = amlConfig._internal.errorHandlerProvider.errorHandler() val node = InternalAmlDomainElementEmitter.emit(internalElement, emissionStructure, handler) diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/AMLBaseUnitClient.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/AMLBaseUnitClient.scala index b2ce7432..ceef7cf4 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/AMLBaseUnitClient.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/AMLBaseUnitClient.scala @@ -18,10 +18,11 @@ class AMLBaseUnitClient private[amf] (protected override val configuration: AMLC override def getConfiguration: AMLConfiguration = configuration - /** - * parse a [[Dialect]] - * @param url of the resource to parse - * @return a Future [[AMLDialectResult]] + /** parse a [[Dialect]] + * @param url + * of the resource to parse + * @return + * a Future [[AMLDialectResult]] */ def parseDialect(url: String): Future[AMLDialectResult] = AMFParser.parse(url, configuration).map { case result: AMFParseResult if result.baseUnit.isInstanceOf[Dialect] => @@ -30,10 +31,11 @@ class AMLBaseUnitClient private[amf] (protected override val configuration: AMLC throw InvalidBaseUnitTypeException.forMeta(other.baseUnit.meta, DialectModel) } - /** - * parse a [[DialectInstance]] - * @param url of the resource to parse - * @return a Future [[AMLDialectInstanceResult]] + /** parse a [[DialectInstance]] + * @param url + * of the resource to parse + * @return + * a Future [[AMLDialectInstanceResult]] */ def parseDialectInstance(url: String): Future[AMLDialectInstanceResult] = AMFParser.parse(url, configuration).map { case result: AMFParseResult if result.baseUnit.isInstanceOf[DialectInstance] => @@ -42,10 +44,11 @@ class AMLBaseUnitClient private[amf] (protected override val configuration: AMLC throw InvalidBaseUnitTypeException.forMeta(other.baseUnit.meta, DialectInstanceModel) } - /** - * parse a [[Vocabulary]] - * @param url of the resource to parse - * @return a Future [[AMLVocabularyResult]] + /** parse a [[Vocabulary]] + * @param url + * of the resource to parse + * @return + * a Future [[AMLVocabularyResult]] */ def parseVocabulary(url: String): Future[AMLVocabularyResult] = AMFParser.parse(url, configuration).map { case result: AMFParseResult if result.baseUnit.isInstanceOf[Vocabulary] => diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/AMLConfiguration.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/AMLConfiguration.scala index 5eac3000..d5d1624d 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/AMLConfiguration.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/AMLConfiguration.scala @@ -2,7 +2,6 @@ package amf.aml.client.scala import amf.aml.client.scala.AMLConfiguration.platform import amf.aml.client.scala.model.document.{Dialect, DialectInstance} -import amf.aml.client.scala.model.domain.SemanticExtension import amf.aml.internal.annotations.serializable.AMLSerializableAnnotations import amf.aml.internal.entities.AMLEntities import amf.aml.internal.parse.plugin.{ @@ -19,25 +18,20 @@ import amf.aml.internal.render.plugin.{ } import amf.aml.internal.transform.pipelines.{DefaultAMLTransformationPipeline, DialectTransformationPipeline} import amf.aml.internal.utils.{DialectRegister, VocabulariesRegister} -import amf.aml.internal.validate.{AMFDialectValidations, AMLValidationPlugin} +import amf.aml.internal.validate.{AMFDialectValidations, AMLValidationPlugin, DialectEnumValidationPlugin} import amf.core.client.scala.AMFGraphConfiguration +import amf.core.client.scala.adoption.{DefaultIdAdopterProvider, IdAdopterProvider} import amf.core.client.scala.config._ -import amf.core.client.scala.errorhandling.{ - AMFErrorHandler, - DefaultErrorHandlerProvider, - ErrorHandlerProvider, - UnhandledErrorHandler -} +import amf.core.client.scala.errorhandling.{DefaultErrorHandlerProvider, ErrorHandlerProvider, UnhandledErrorHandler} import amf.core.client.scala.execution.ExecutionEnvironment import amf.core.client.scala.model.domain.AnnotationGraphLoader +import amf.core.client.scala.parse.AMFParsePlugin import amf.core.client.scala.resource.ResourceLoader import amf.core.client.scala.transform.{TransformationPipeline, TransformationPipelineRunner} -import amf.core.internal.annotations.serializable.CoreSerializableAnnotations -import amf.core.internal.entities.CoreEntities +import amf.core.client.scala.vocabulary.NamespaceAliases import amf.core.internal.metamodel.ModelDefaultBuilder import amf.core.internal.parser.{AMFCompiler, CompilerContextBuilder} import amf.core.internal.plugins.AMFPlugin -import amf.core.internal.plugins.document.graph.entities.DataNodeEntities import amf.core.internal.plugins.parse.DomainParsingFallback import amf.core.internal.registries.AMFRegistry import amf.core.internal.resource.AMFResolvers @@ -48,30 +42,46 @@ import org.mulesoft.common.collections.FilterType import scala.concurrent.{ExecutionContext, Future} -/** - * The configuration object required for using AML +/** The configuration object required for using AML * - * @param resolvers [[AMFResolvers]] - * @param errorHandlerProvider [[ErrorHandlerProvider]] - * @param registry [[AMLRegistry]] - * @param listeners a Set of [[AMFEventListener]] - * @param options [[AMFOptions]] + * @param resolvers + * [[AMFResolvers]] + * @param errorHandlerProvider + * [[ErrorHandlerProvider]] + * @param registry + * [[AMLRegistry]] + * @param listeners + * a Set of [[AMFEventListener]] + * @param options + * [[AMFOptions]] */ -class AMLConfiguration private[amf] (override private[amf] val resolvers: AMFResolvers, - override private[amf] val errorHandlerProvider: ErrorHandlerProvider, - override private[amf] val registry: AMLRegistry, - override private[amf] val listeners: Set[AMFEventListener], - override private[amf] val options: AMFOptions) - extends AMFGraphConfiguration(resolvers, errorHandlerProvider, registry, listeners, options) { +class AMLConfiguration private[amf] ( + override private[amf] val resolvers: AMFResolvers, + override private[amf] val errorHandlerProvider: ErrorHandlerProvider, + override private[amf] val registry: AMLRegistry, + override private[amf] val listeners: Set[AMFEventListener], + override private[amf] val options: AMFOptions, + override private[amf] val idAdopterProvider: IdAdopterProvider +) extends AMFGraphConfiguration(resolvers, errorHandlerProvider, registry, listeners, options, idAdopterProvider) { private implicit val ec: ExecutionContext = this.getExecutionContext - override protected[amf] def copy(resolvers: AMFResolvers = resolvers, - errorHandlerProvider: ErrorHandlerProvider = errorHandlerProvider, - registry: AMFRegistry = registry, - listeners: Set[AMFEventListener] = listeners, - options: AMFOptions = options): AMLConfiguration = - new AMLConfiguration(resolvers, errorHandlerProvider, registry.asInstanceOf[AMLRegistry], listeners, options) + override protected[amf] def copy( + resolvers: AMFResolvers = resolvers, + errorHandlerProvider: ErrorHandlerProvider = errorHandlerProvider, + registry: AMFRegistry = registry, + listeners: Set[AMFEventListener] = listeners, + options: AMFOptions = options, + idAdopterProvider: IdAdopterProvider = idAdopterProvider + ): AMLConfiguration = + new AMLConfiguration( + resolvers, + errorHandlerProvider, + registry.asInstanceOf[AMLRegistry], + listeners, + options, + idAdopterProvider + ) /** Contains common AMF graph operations associated to documents */ override def baseUnitClient(): AMLBaseUnitClient = new AMLBaseUnitClient(this) @@ -82,34 +92,38 @@ class AMLConfiguration private[amf] (override private[amf] val resolvers: AMFRes /** Contains methods to get information about the current state of the configuration */ def configurationState(): AMLConfigurationState = new AMLConfigurationState(this) - /** - * Set [[ParsingOptions]] - * @param parsingOptions [[ParsingOptions]] to add to configuration object - * @return [[AMLConfiguration]] with [[ParsingOptions]] added + /** Set [[ParsingOptions]] + * @param parsingOptions + * [[ParsingOptions]] to add to configuration object + * @return + * [[AMLConfiguration]] with [[ParsingOptions]] added */ override def withParsingOptions(parsingOptions: ParsingOptions): AMLConfiguration = super._withParsingOptions(parsingOptions) - /** - * Add a [[ResourceLoader]] - * @param rl [[ResourceLoader]] to add to configuration object - * @return [[AMLConfiguration]] with the [[ResourceLoader]] added + /** Add a [[ResourceLoader]] + * @param rl + * [[ResourceLoader]] to add to configuration object + * @return + * [[AMLConfiguration]] with the [[ResourceLoader]] added */ override def withResourceLoader(rl: ResourceLoader): AMLConfiguration = super._withResourceLoader(rl) - /** - * Set the configuration [[ResourceLoader]]s - * @param rl a list of [[ResourceLoader]] to set to the configuration object - * @return [[AMLConfiguration]] with [[ResourceLoader]]s set + /** Set the configuration [[ResourceLoader]]s + * @param rl + * a list of [[ResourceLoader]] to set to the configuration object + * @return + * [[AMLConfiguration]] with [[ResourceLoader]]s set */ override def withResourceLoaders(rl: List[ResourceLoader]): AMLConfiguration = super._withResourceLoaders(rl) - /** - * Set [[UnitCache]] - * @param cache [[UnitCache]] to add to configuration object - * @return [[AMLConfiguration]] with [[UnitCache]] added + /** Set [[UnitCache]] + * @param cache + * [[UnitCache]] to add to configuration object + * @return + * [[AMLConfiguration]] with [[UnitCache]] added */ override def withUnitCache(cache: UnitCache): AMLConfiguration = super._withUnitCache(cache) @@ -119,6 +133,18 @@ class AMLConfiguration private[amf] (override private[amf] val resolvers: AMFRes override def withPlugin(amfPlugin: AMFPlugin[_]): AMLConfiguration = super._withPlugin(amfPlugin) + override def withRootParsePlugin(amfParsePlugin: AMFParsePlugin): AMLConfiguration = + super._withRootParsePlugin(amfParsePlugin) + + override def withReferenceParsePlugin(amfPlugin: AMFParsePlugin): AMLConfiguration = + super._withReferenceParsePlugin(amfPlugin) + + override def withRootParsePlugins(amfParsePlugin: List[AMFParsePlugin]): AMLConfiguration = + super._withRootParsePlugins(amfParsePlugin) + + override def withReferenceParsePlugins(amfPlugin: List[AMFParsePlugin]): AMLConfiguration = + super._withReferenceParsePlugins(amfPlugin) + override def withPlugins(plugins: List[AMFPlugin[_]]): AMLConfiguration = super._withPlugins(plugins) @@ -126,20 +152,22 @@ class AMLConfiguration private[amf] (override private[amf] val resolvers: AMFRes super._withValidationProfile(profile) // Keep AMF internal, done to avoid recomputing validations every time a config is requested - private[amf] override def withValidationProfile(profile: ValidationProfile, - effective: EffectiveValidations): AMLConfiguration = + private[amf] override def withValidationProfile( + profile: ValidationProfile, + effective: EffectiveValidations + ): AMLConfiguration = super._withValidationProfile(profile, effective) - /** - * Add a [[TransformationPipeline]] - * @param pipeline [[TransformationPipeline]] to add to configuration object - * @return [[AMLConfiguration]] with [[TransformationPipeline]] added + /** Add a [[TransformationPipeline]] + * @param pipeline + * [[TransformationPipeline]] to add to configuration object + * @return + * [[AMLConfiguration]] with [[TransformationPipeline]] added */ override def withTransformationPipeline(pipeline: TransformationPipeline): AMLConfiguration = super._withTransformationPipeline(pipeline) - /** - * AMF internal method just to facilitate the construction + /** AMF internal method just to facilitate the construction * @param pipelines * @return */ @@ -149,18 +177,20 @@ class AMLConfiguration private[amf] (override private[amf] val resolvers: AMFRes override def withRenderOptions(renderOptions: RenderOptions): AMLConfiguration = super._withRenderOptions(renderOptions) - /** - * Set [[ErrorHandlerProvider]] - * @param provider [[ErrorHandlerProvider]] to set to configuration object - * @return [[AMLConfiguration]] with [[ErrorHandlerProvider]] set + /** Set [[ErrorHandlerProvider]] + * @param provider + * [[ErrorHandlerProvider]] to set to configuration object + * @return + * [[AMLConfiguration]] with [[ErrorHandlerProvider]] set */ override def withErrorHandlerProvider(provider: ErrorHandlerProvider): AMLConfiguration = super._withErrorHandlerProvider(provider) - /** - * Add an [[AMFEventListener]] - * @param listener [[AMFEventListener]] to add to configuration object - * @return [[AMLConfiguration]] with [[AMFEventListener]] added + /** Add an [[AMFEventListener]] + * @param listener + * [[AMFEventListener]] to add to configuration object + * @return + * [[AMLConfiguration]] with [[AMFEventListener]] added */ override def withEventListener(listener: AMFEventListener): AMLConfiguration = super._withEventListener(listener) @@ -174,18 +204,23 @@ class AMLConfiguration private[amf] (override private[amf] val resolvers: AMFRes copy(registry = registry.withExtensions(dialect)) } - /** - * Set [[BaseExecutionEnvironment]] - * @param executionEnv [[BaseExecutionEnvironment]] to set to configuration object - * @return [[AMLConfiguration]] with [[BaseExecutionEnvironment]] set + override def withAliases(aliases: NamespaceAliases): AMLConfiguration = + super._withAliases(aliases) + + /** Set [[BaseExecutionEnvironment]] + * @param executionEnv + * [[BaseExecutionEnvironment]] to set to configuration object + * @return + * [[AMLConfiguration]] with [[BaseExecutionEnvironment]] set */ override def withExecutionEnvironment(executionEnv: ExecutionEnvironment): AMLConfiguration = super._withExecutionEnvironment(executionEnv) - /** - * Register a Dialect - * @param url URL of the Dialect to register - * @return A CompletableFuture of [[AMLConfiguration]] + /** Register a Dialect + * @param url + * URL of the Dialect to register + * @return + * A CompletableFuture of [[AMLConfiguration]] */ def withDialect(url: String): Future[AMLConfiguration] = { baseUnitClient().parseDialect(url).map { @@ -194,17 +229,19 @@ class AMLConfiguration private[amf] (override private[amf] val resolvers: AMFRes } } - /** - * Register a Dialect - * @param dialect [[Dialect]] to register - * @return [[AMLConfiguration]] with [[Dialect]] registered + /** Register a Dialect + * @param dialect + * [[Dialect]] to register + * @return + * [[AMLConfiguration]] with [[Dialect]] registered */ def withDialect(dialect: Dialect): AMLConfiguration = DialectRegister(dialect, this).register() - /** - * Register a [[Dialect]] linked from a [[DialectInstance]] - * @param url of the [[DialectInstance]] - * @return A CompletableFuture of [[AMLConfiguration]] + /** Register a [[Dialect]] linked from a [[DialectInstance]] + * @param url + * of the [[DialectInstance]] + * @return + * A CompletableFuture of [[AMLConfiguration]] */ def forInstance(url: String): Future[AMLConfiguration] = { val collector = new DialectReferencesCollector @@ -226,11 +263,16 @@ class AMLConfiguration private[amf] (override private[amf] val resolvers: AMFRes } } } + + override def withIdAdopterProvider(idAdopterProvider: IdAdopterProvider): AMLConfiguration = + super._withIdAdopterProvider(idAdopterProvider) } object AMLConfiguration extends PlatformSecrets { - /** Predefined environment to deal with AML documents based on AMFGraphConfiguration {@link amf.core.client.scala.AMFGraphConfiguration.predefined predefined()} method */ + /** Predefined environment to deal with AML documents based on AMFGraphConfiguration {@link + * amf.core.client.scala.AMFGraphConfiguration.predefined predefined()} method + */ def predefined(): AMLConfiguration = { val predefinedGraphConfiguration: AMFGraphConfiguration = AMFGraphConfiguration.predefined().emptyEntities() VocabulariesRegister.register() // TODO ARM remove when APIMF-3000 is done @@ -239,28 +281,31 @@ object AMLConfiguration extends PlatformSecrets { new AMLDialectRenderingPlugin() :: new AMLVocabularyRenderingPlugin() :: new AMLValidationPlugin() :: + DialectEnumValidationPlugin :: Nil // we might need to register editing pipeline as well because of legacy behaviour. new AMLConfiguration( - predefinedGraphConfiguration.resolvers, - predefinedGraphConfiguration.errorHandlerProvider, - AMLRegistry(predefinedGraphConfiguration.getRegistry) - .withEntities(AMLEntities.entities) - .withAnnotations(AMLSerializableAnnotations.annotations), - predefinedGraphConfiguration.listeners, - predefinedGraphConfiguration.options + predefinedGraphConfiguration.resolvers, + predefinedGraphConfiguration.errorHandlerProvider, + AMLRegistry(predefinedGraphConfiguration.getRegistry) + .withEntities(AMLEntities.entities) + .withAnnotations(AMLSerializableAnnotations.annotations), + predefinedGraphConfiguration.listeners, + predefinedGraphConfiguration.options, + predefinedGraphConfiguration.idAdopterProvider ).withPlugins(predefinedPlugins) .withTransformationPipeline(DefaultAMLTransformationPipeline()) } def empty(): AMLConfiguration = { new AMLConfiguration( - AMFResolvers.predefined(), - DefaultErrorHandlerProvider, - AMLRegistry.empty, - Set.empty, - AMFOptions.default() + AMFResolvers.predefined(), + DefaultErrorHandlerProvider, + AMLRegistry.empty, + Set.empty, + AMFOptions.default(), + new DefaultIdAdopterProvider() ) } } @@ -270,10 +315,10 @@ private class DialectReferencesCollector(implicit val ec: ExecutionContext) { val ctx = new CompilerContextBuilder(url, platform, amfConfig.compilerConfiguration).build() val compiler = new AMFCompiler(ctx) for { - content <- compiler.fetchContent() - eitherContentOrAst <- Future.successful(compiler.parseSyntax(content)) - root <- Future.successful(eitherContentOrAst.right.get) if eitherContentOrAst.isRight - plugin <- Future.successful(compiler.getDomainPluginFor(root)) + content <- compiler.fetchContent() + eitherContentOrAst = compiler.parseSyntax(content) + root = eitherContentOrAst.right.get if eitherContentOrAst.isRight + plugin = compiler.getDomainPluginFor(root) documentWithReferences <- compiler.parseReferences(root, plugin.get) if plugin.isDefined } yield { documentWithReferences.references.toStream diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/AMLConfigurationState.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/AMLConfigurationState.scala index e770f383..58e8a743 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/AMLConfigurationState.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/AMLConfigurationState.scala @@ -4,6 +4,8 @@ import amf.aml.client.scala.model.document.{Dialect, DialectInstance} import amf.aml.client.scala.model.domain.SemanticExtension import amf.aml.internal.parse.plugin.AMLDialectInstanceParsingPlugin import amf.aml.internal.semantic.SemanticExtensionHelper +import amf.core.client.scala.resource.ResourceLoader +import amf.core.client.scala.transform.TransformationPipeline import com.github.ghik.silencer.silent import scala.collection.immutable @@ -11,72 +13,92 @@ import scala.collection.immutable /** Contains methods to get information about the current state of the configuration */ class AMLConfigurationState private[amf] (protected val configuration: AMLConfiguration) { - /** - * Get all instances of registered dialects - * @return a Seq of [[Dialect]] + /** Get all the ResourceLoaders of the configuration + * @return + * a Seq of [[ResourceLoader]] + */ + def getResourceLoaders(): immutable.Seq[ResourceLoader] = configuration.getResourceLoaders + + /** Get all instances of registered dialects + * @return + * a Seq of [[Dialect]] */ def getDialects(): immutable.Seq[Dialect] = getDialectsByCondition(_ => true) - /** - * Find an instance of registered dialect with the provided name and version - * @param name of the dialect to find - * @return a Seq of [[Dialect]] + /** Find an instance of registered dialect with the provided name and version + * @param name + * of the dialect to find + * @return + * a Seq of [[Dialect]] */ def getDialect(name: String): immutable.Seq[Dialect] = getDialectsByCondition(dialectNameFilter(name)) - /** - * Find an instance of registered dialect with the provided name and version - * @param name of the dialect to find - * @param version of dialect to find - * @return an Option of [[Dialect]] + /** Find an instance of registered dialect with the provided name and version + * @param name + * of the dialect to find + * @param version + * of dialect to find + * @return + * an Option of [[Dialect]] */ def getDialect(name: String, version: String): Option[Dialect] = getDialectsByCondition(dialectNameAndVersionFilter(name, version)).headOption - /** - * Get all instances of SemanticExtensions present in the registered dialects - * @return a Seq of [[SemanticExtension]] + /** Get all instances of SemanticExtensions present in the registered dialects + * @return + * a Seq of [[SemanticExtension]] */ def getExtensions(): Seq[SemanticExtension] = SemanticExtensionHelper.getExtensions(configuration) - /** - * Find all instances of semantic extensions in the provided dialect filtering by the param - * @param uri of the propertyTerm of the semantic extension to search - * @return a Seq of [[SemanticExtension]] + /** Find all instances of semantic extensions in the provided dialect filtering by the param + * @param uri + * of the propertyTerm of the semantic extension to search + * @return + * a Seq of [[SemanticExtension]] */ def findSemanticByPropertyTerm(uri: String): Option[(SemanticExtension, Dialect)] = SemanticExtensionHelper.byPropertyTerm(configuration).find(uri).headOption - /** - * Find all instances of semantic extensions in the provided dialect filtering by the param - * @param uri of the target field of the semantic extension to search - * @return a Seq of [[SemanticExtension]] + /** Find all instances of semantic extensions in the provided dialect filtering by the param + * @param uri + * of the target field of the semantic extension to search + * @return + * a Seq of [[SemanticExtension]] */ def findSemanticByTarget(uri: String): Seq[(SemanticExtension, Dialect)] = SemanticExtensionHelper.byTargetFinder(configuration).find(uri) - /** - * Find all instances of semantic extensions in the provided dialect filtering by the param - * @param name of the semantic extension to search - * @return a Option of [[SemanticExtension]] + /** Find all instances of semantic extensions in the provided dialect filtering by the param + * @param name + * of the semantic extension to search + * @return + * a Option of [[SemanticExtension]] */ def findSemanticByName(name: String): Option[(SemanticExtension, Dialect)] = SemanticExtensionHelper.byNameFinder(configuration).find(name).headOption def findDialectFor(dialectInstance: DialectInstance): Option[Dialect] = { @silent("deprecated") // Silent can only be used in assignment expressions - val a = getDialects().find( - dialect => - dialectInstance.processingData - .definedBy() - .option() - .orElse(dialectInstance.definedBy().option()) - .contains(dialect.id)) + val a = getDialects().find(dialect => + dialectInstance.processingData + .definedBy() + .option() + .orElse(dialectInstance.definedBy().option()) + .contains(dialect.id) + ) a } + /** Get all the transformation pipelines of the configuration + * + * @return + * a Seq of [[TransformationPipeline]] + */ + def getTransformationPipelines(): Seq[TransformationPipeline] = + configuration.registry.getTransformationPipelines.values.toSeq + private def getDialectsByCondition(filter: AMLDialectInstanceParsingPlugin => Boolean): immutable.Seq[Dialect] = - configuration.registry.getPluginsRegistry.parsePlugins.collect { + configuration.registry.getPluginsRegistry.rootParsePlugins.collect { case plugin: AMLDialectInstanceParsingPlugin if filter(plugin) => plugin.dialect } diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/AMLDialectResult.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/AMLDialectResult.scala index a0a9c32e..0236c8d2 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/AMLDialectResult.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/AMLDialectResult.scala @@ -4,8 +4,12 @@ import amf.aml.client.scala.model.document.{Dialect, DialectInstance, Vocabulary import amf.core.client.scala.{AMFParseResult, AMFResult} import amf.core.client.scala.validation.AMFValidationResult -class AMLDialectResult(val dialect: Dialect, results: Seq[AMFValidationResult]) - extends AMFParseResult(dialect, results) +private[amf] object AMLDialectResult { + def unapply(result: AMLDialectResult): Option[(Dialect, Seq[AMFValidationResult])] = + Some((result.dialect, result.results)) +} + +class AMLDialectResult(val dialect: Dialect, results: Seq[AMFValidationResult]) extends AMFParseResult(dialect, results) class AMLDialectInstanceResult(val dialectInstance: DialectInstance, results: Seq[AMFValidationResult]) extends AMFParseResult(dialectInstance, results) diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/AMLElementClient.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/AMLElementClient.scala index 31bbf915..ff1ec1f9 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/AMLElementClient.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/AMLElementClient.scala @@ -14,9 +14,9 @@ class AMLElementClient private[amf] (protected override val configuration: AMLCo override def getConfiguration: AMLConfiguration = configuration - /** - * Currently supports rendering of dialect domain elements - * @param references : optional parameter which will improve emission of references defined in element + /** Currently supports rendering of dialect domain elements + * @param references + * : optional parameter which will improve emission of references defined in element */ def renderElement(element: DomainElement, references: Seq[BaseUnit] = Nil): YNode = { @@ -24,9 +24,10 @@ class AMLElementClient private[amf] (protected override val configuration: AMLCo .configurationState() .getDialects() .find( - _.declares - .collectFirst({ case nm: NodeMapping if element.meta.`type`.exists(_.iri() == nm.id) => nm }) - .isDefined) + _.declares + .collectFirst({ case nm: NodeMapping if element.meta.`type`.exists(_.iri() == nm.id) => nm }) + .isDefined + ) .map { d => AmlDomainElementEmitter.emit(element, d, configuration.errorHandlerProvider.errorHandler(), references) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/Dialect.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/Dialect.scala index 9b819bf5..efa8880a 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/Dialect.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/Dialect.scala @@ -9,7 +9,7 @@ import amf.core.client.common.validation.ProfileName import amf.core.client.scala.model.StrField import amf.core.client.scala.model.document.{BaseUnit, DeclaresModel, EncodesModel} import amf.core.client.scala.model.domain.DomainElement -import amf.core.internal.metamodel.{Obj, Type} +import amf.core.internal.metamodel.Type import amf.core.internal.metamodel.document.DocumentModel.Encodes import amf.core.internal.metamodel.document.ModuleModel.{Declares, References} import amf.core.internal.parser.domain.{Annotations, Fields} @@ -29,47 +29,57 @@ case class Dialect(fields: Fields, annotations: Annotations) def version(): StrField = fields.field(Version) def documents(): DocumentsModel = fields.field(Documents) def extensions(): Seq[SemanticExtension] = fields.field(Extensions) - def annotationMappings(): Seq[AnnotationMapping] = declares.collect { - case mapping: AnnotationMapping => mapping + def annotationMappings(): Seq[AnnotationMapping] = declares.collect { case mapping: AnnotationMapping => + mapping } def nameAndVersion(): String = s"${name().value()} ${version().value()}" + @deprecated("Useless functionality", "AML 6.0.3") def header: String = s"%${nameAndVersion()}".stripSpaces override protected[amf] def profileName: Option[ProfileName] = Some(ProfileName(nameAndVersion())) - private[amf] override def componentId: String = "" + override def componentId: String = "" def withName(name: String): Dialect = set(Name, name) def withVersion(version: String): Dialect = set(Version, version) def withDocuments(documentsMapping: DocumentsModel): Dialect = set(Documents, documentsMapping) def withExtensions(extensions: Seq[SemanticExtension]): Dialect = setArrayWithoutId(Extensions, extensions) + @deprecated("Useless functionality", "AML 6.0.3") def libraryHeader: Option[String] = Option(documents()).map(d => Option(d.library())).map(_ => s"%Library/${header.stripPrefix("%")}") + @deprecated("Useless functionality", "AML 6.0.3") def patchHeader: String = s"%Patch/${header.stripPrefix("%")}" + @deprecated("Useless functionality", "AML 6.0.3") def isLibraryHeader(h: String): Boolean = libraryHeader.contains(h.stripSpaces) + @deprecated("Useless functionality", "AML 6.0.3") def isPatchHeader(h: String): Boolean = patchHeader == h.stripSpaces + @deprecated("Useless functionality", "AML 6.0.3") def isInstanceHeader(h: String): Boolean = header == h.stripSpaces + @deprecated("Useless functionality", "AML 6.0.3") def fragmentHeaders: Seq[String] = Option(documents()) .map(_.fragments().map(f => s"%${f.documentName().value().stripSpaces}/${header.stripPrefix("%")}")) .getOrElse(Seq.empty) + @deprecated("Useless functionality", "AML 6.0.3") def isFragmentHeader(h: String): Boolean = fragmentHeaders.contains(h.stripSpaces) def hasValidHeader: Boolean = !name().isNullOrEmpty && !version().isNullOrEmpty + @deprecated("Useless functionality", "AML 6.0.3") def allHeaders: Seq[String] = Seq(header) ++ libraryHeader ++ fragmentHeaders ++ Seq(patchHeader) def meta: DialectModel.type = DialectModel + @deprecated("Use amf.aml.internal.parse.hints.DialectInstanceGuess.from instead", "AML 6.0.3") def documentKindFor(header: String): Option[DialectInstanceDocumentKind] = { header match { case h if isLibraryHeader(h) => Some(kind.DialectInstanceLibrary) @@ -80,6 +90,7 @@ case class Dialect(fields: Fields, annotations: Annotations) } } + @deprecated("Useless functionality", "AML 6.0.3") def acceptsHeader(header: String): Boolean = documentKindFor(header).isDefined private[amf] def usesKeyPropertyMatching: Boolean = { @@ -92,14 +103,26 @@ case class Dialect(fields: Fields, annotations: Annotations) usesKeyProperty.contains(true) } + private[amf] def hasExtensions(): Boolean = this.extensions().nonEmpty + private[amf] def usesHeaderMatching: Boolean = !usesKeyPropertyMatching private[amf] def extensionIndex: Map[String, Dialect] = extensions().map(e => e.extensionName().value() -> this).toMap - private[amf] def extensionModels: Map[String, Type] = - extensions().map { semantic => - val annotation = SemanticExtensionHelper.findAnnotationMapping(this, semantic) - annotation.nodePropertyMapping().value() -> annotation.toField().`type` - }.toMap + private[amf] def extensionModels: Map[String, Map[String, Type]] = { + extensions() + .flatMap { semantic => + val annotation = SemanticExtensionHelper.findAnnotationMapping(this, semantic) + annotation.domain().map { domain => + domain.value() -> (annotation.nodePropertyMapping().value() -> annotation.toField().`type`) + } + } + .groupBy(x => x._1) + .mapValues(values => + values.map { x => + x._2 + }.toMap + ) + } } object Dialect { diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectFragment.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectFragment.scala index 9773a50c..7079f77e 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectFragment.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectFragment.scala @@ -14,7 +14,7 @@ case class DialectFragment(fields: Fields, annotations: Annotations) def references: Seq[BaseUnit] = fields.field(References) override def encodes: NodeMapping = fields.field(Encodes) - private[amf] override def componentId: String = "" + override def componentId: String = "" def withEncodes(nodeMapping: NodeMapping): DialectFragment = set(Encodes, nodeMapping) diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectInstance.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectInstance.scala index 52704c5b..77e83520 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectInstance.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectInstance.scala @@ -28,11 +28,12 @@ case class DialectInstance(fields: Fields, annotations: Annotations) def encodes: DomainElement = fields.field(Encodes) def declares: Seq[DomainElement] = fields.field(Declares) - private[amf] override def componentId: String = "" + override def componentId: String = "" - override def transform(selector: DomainElement => Boolean, - transformation: (DomainElement, Boolean) => Option[DomainElement])( - implicit errorHandler: AMFErrorHandler): BaseUnit = { + override def transform( + selector: DomainElement => Boolean, + transformation: (DomainElement, Boolean) => Option[DomainElement] + )(implicit errorHandler: AMFErrorHandler): BaseUnit = { val domainElementAdapter = new DomainElementSelectorAdapter(selector) val transformationAdapter = new DomainElementTransformationAdapter(transformation) val transformationData = TransformationData(domainElementAdapter, transformationAdapter) diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectInstanceFragment.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectInstanceFragment.scala index 17b46800..a7979874 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectInstanceFragment.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectInstanceFragment.scala @@ -18,7 +18,7 @@ case class DialectInstanceFragment(fields: Fields, annotations: Annotations) def fragment(): StrField = fields.field(Fragment) - private[amf] override def componentId: String = "" + override def componentId: String = "" def withFragment(fragmentId: String): DialectInstanceFragment = set(Fragment, fragmentId) diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectInstanceLibrary.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectInstanceLibrary.scala index 4d7f346a..04558573 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectInstanceLibrary.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectInstanceLibrary.scala @@ -15,7 +15,7 @@ case class DialectInstanceLibrary(fields: Fields, annotations: Annotations) def declares: Seq[DomainElement] = fields.field(Declares) - private[amf] override def componentId: String = "" + override def componentId: String = "" } object DialectInstanceLibrary { diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectInstancePatch.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectInstancePatch.scala index 3c600879..c556e2fe 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectInstancePatch.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectInstancePatch.scala @@ -18,7 +18,7 @@ case class DialectInstancePatch(fields: Fields, annotations: Annotations) def extendsModel: StrField = fields.field(DialectInstancePatchModel.Extends) override def encodes: DomainElement = fields.field(Encodes) - private[amf] override def componentId: String = "" + override def componentId: String = "" def withExtendsModel(target: String): DialectInstancePatch = set(DialectInstancePatchModel.Extends, target) diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectLibrary.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectLibrary.scala index a2f60dd6..895d00eb 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectLibrary.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/DialectLibrary.scala @@ -15,7 +15,7 @@ case class DialectLibrary(fields: Fields, annotations: Annotations) def references: Seq[BaseUnit] = fields.field(References) def declares: Seq[DomainElement] = fields.field(Declares) - private[amf] override def componentId: String = "" + override def componentId: String = "" def meta: DialectLibraryModel.type = DialectLibraryModel } diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/MappingDeclarer.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/MappingDeclarer.scala index 9925218f..c54a86f9 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/MappingDeclarer.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/MappingDeclarer.scala @@ -10,9 +10,8 @@ trait MappingDeclarer { this: BaseUnit with DeclaresModel => case Some(mapping: NodeMapping) => Some(mapping) case _ => references - .collect { - case lib: MappingDeclarer => - lib + .collect { case lib: MappingDeclarer => + lib } .map { dec => dec.findNodeMapping(mappingId) diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/Vocabulary.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/Vocabulary.scala index 1960d3cd..be9f21d2 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/Vocabulary.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/document/Vocabulary.scala @@ -33,7 +33,7 @@ case class Vocabulary(fields: Fields, annotations: Annotations) override def meta: VocabularyModel.type = VocabularyModel /** Value , path + field value that is used to compose the id when the object its adopted */ - private[amf] override def componentId: String = "" + override def componentId: String = "" } object Vocabulary { diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/AmlScalars.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/AmlScalars.scala index efa1f572..5cfbd0fc 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/AmlScalars.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/AmlScalars.scala @@ -3,18 +3,20 @@ package amf.aml.client.scala.model.domain import amf.core.client.scala.vocabulary.ValueType object AmlScalars { - val all: Seq[String] = Seq("string", - "integer", - "boolean", - "float", - "decimal", - "double", - "duration", - "dateTime", - "time", - "date", - "anyUri", - "uri", - "anyType", - "any") + val all: Seq[String] = Seq( + "string", + "integer", + "boolean", + "float", + "decimal", + "double", + "duration", + "dateTime", + "time", + "date", + "anyUri", + "uri", + "anyType", + "any" + ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/AnnotationMapping.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/AnnotationMapping.scala index 9fc6db8e..4d765f7d 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/AnnotationMapping.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/AnnotationMapping.scala @@ -16,17 +16,17 @@ class AnnotationMapping(override val fields: Fields, override val annotations: A override def name: StrField = super[NodeMappable].name override def withName(name: String): this.type = set(meta.Name, name) - def domain(): StrField = fields.field(Domain) - def withDomain(domainIri: String): AnnotationMapping = set(Domain, domainIri) + def domain(): Seq[StrField] = fields.field(Domain) + def withDomain(domainIri: Seq[String]): AnnotationMapping = set(Domain, domainIri) def appliesTo(element: AmfObject): Boolean = appliesTo(element.meta.`type`.map(_.iri())) - def appliesTo(types: Seq[String]): Boolean = domain().option().exists(domain => types.contains(domain)) + def appliesTo(types: Seq[String]): Boolean = domain().flatMap(_.option()).exists(domain => types.contains(domain)) override def meta: AnnotationMappingModel.type = AnnotationMappingModel /** Value , path + field value that is used to compose the id when the object its adopted */ - private[amf] override def componentId: String = s"annotation-mappings/${name.value()}" + override def componentId: String = s"annotation-mappings/${name.value()}" override def linkCopy(): Linkable = AnnotationMapping().withId(id) diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/AnyMapping.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/AnyMapping.scala new file mode 100644 index 00000000..653a77a9 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/AnyMapping.scala @@ -0,0 +1,30 @@ +package amf.aml.client.scala.model.domain + +import amf.aml.internal.metamodel.domain.AnyMappingModel._ +import amf.core.client.scala.model.StrField +import amf.core.client.scala.model.domain.DomainElement +import amf.core.internal.parser.domain.Fields + +// TODO This should inherit from NodeMappable and be a class (a simple allof or oneOf should be of this class). +// But the meta field of NodeMappable make impossible to have hierarchy of classes currently. Thats why this is abstract. +abstract class AnyMapping(fields: Fields) extends DomainElement { + + def and: Seq[StrField] = fields.field(And) + def or: Seq[StrField] = fields.field(Or) + def components: Seq[StrField] = fields.field(Components) + def ifMapping: StrField = fields.field(If) + def thenMapping: StrField = fields.field(Then) + def elseMapping: StrField = fields.field(Else) + + def withAnd(andMapping: Seq[String]): AnyMapping = set(And, andMapping) + def withOr(orMapping: Seq[String]): AnyMapping = set(Or, orMapping) + def withComponents(components: Seq[String]): AnyMapping = set(Components, components) + def withIfMapping(ifMapping: String): AnyMapping = set(If, ifMapping) + def withThenMapping(thenMapping: String): AnyMapping = set(Then, thenMapping) + def withElseMapping(elseMapping: String): AnyMapping = set(Else, elseMapping) + + private[amf] def hasAny: Boolean = and.nonEmpty + private[amf] def hasOr: Boolean = or.nonEmpty + private[amf] def hasConditional: Boolean = ifMapping.nonEmpty + +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/ClassTerm.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/ClassTerm.scala index 8106bf67..56d6f32d 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/ClassTerm.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/ClassTerm.scala @@ -30,7 +30,7 @@ case class ClassTerm(fields: Fields, annotations: Annotations) extends DomainEle def withSubClassOf(superClasses: Seq[String]): ClassTerm = set(SubClassOf, AmfArray(superClasses.map(AmfScalar(_)))) /** Value , path + field value that is used to compose the id when the object its adopted */ - private[amf] override def componentId: String = "" + override def componentId: String = "" } object ClassTerm { diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/DialectDomainElement.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/DialectDomainElement.scala index 83cfb2a2..e266f1b0 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/DialectDomainElement.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/DialectDomainElement.scala @@ -2,6 +2,7 @@ package amf.aml.client.scala.model.domain import amf.aml.internal.annotations.YNodeAnnotationOperations.getAnnotationsOf import amf.aml.internal.metamodel.domain.DialectDomainElementModel +import amf.aml.internal.parse.instances.DialectInstanceParser.typesFrom import amf.core.client.scala.model.domain._ import amf.core.client.scala.model.{BoolField, StrField} import amf.core.client.scala.vocabulary.Namespace @@ -41,7 +42,8 @@ case class DialectDomainElement(override val fields: Fields, annotations: Annota if (isLink) linkTarget.map(_.id.split("#").last.split("/").last).getOrElse { throw new Exception(s"Cannot produce local reference without linked element at elem $id") - } else id.split("#").last.split("/").last + } + else id.split("#").last.split("/").last } def includeName: String = { @@ -49,9 +51,10 @@ case class DialectDomainElement(override val fields: Fields, annotations: Annota linkLabel .option() .getOrElse( - linkTarget - .map(_.id.split("#").head) - .getOrElse(throw new Exception(s"Cannot produce include reference without linked element at elem $id"))) + linkTarget + .map(_.id.split("#").head) + .getOrElse(throw new Exception(s"Cannot produce include reference without linked element at elem $id")) + ) else throw new Exception(s"Cannot produce include reference without linked element at elem $id") } @@ -106,27 +109,33 @@ case class DialectDomainElement(override val fields: Fields, annotations: Annota def withLiteralProperty(propertyIri: String, value: List[Any]): this.type = setLiteralPropertyBase(propertyIri, value) - private[amf] def setObjectField(property: PropertyMapping, - value: DialectDomainElement, - node: YNode): DialectDomainElement = + private[amf] def setObjectField( + property: PropertyMapping, + value: DialectDomainElement, + node: YNode + ): DialectDomainElement = withObjectField(property, value, Left(node)) - private[amf] def withObjectField(property: PropertyLikeMapping[_], - value: DialectDomainElement, - node: Either[YNode, YMapEntry]): DialectDomainElement = { + private[amf] def withObjectField( + property: PropertyLikeMapping[_], + value: DialectDomainElement, + node: Either[YNode, YMapEntry] + ): DialectDomainElement = { val (annotations, _) = getAnnotationsOf(node) if (value.isUnresolved) { value.toFutureRef { case resolvedDialectDomainElement: DialectDomainElement => val f = property.toField() set( - f, - resolveUnreferencedLink(value.refName, - value.annotations, - resolvedDialectDomainElement, - value.supportsRecursion.option().getOrElse(false)) - .withId(value.id), - annotations + f, + resolveUnreferencedLink( + value.refName, + value.annotations, + resolvedDialectDomainElement, + value.supportsRecursion.option().getOrElse(false) + ) + .withId(value.id), + annotations ) case resolved => throw new Exception(s"Cannot resolve reference with not dialect domain element value ${resolved.id}") @@ -139,14 +148,18 @@ case class DialectDomainElement(override val fields: Fields, annotations: Annota this } - private[amf] def withObjectCollectionProperty(property: PropertyLikeMapping[_], - value: Seq[DialectDomainElement], - node: YNode): DialectDomainElement = + private[amf] def withObjectCollectionProperty( + property: PropertyLikeMapping[_], + value: Seq[DialectDomainElement], + node: YNode + ): DialectDomainElement = withObjectCollectionProperty(property, value, Left(node)) - private[amf] def withObjectCollectionProperty(property: PropertyLikeMapping[_], - value: Seq[DialectDomainElement], - node: Either[YNode, YMapEntry]): DialectDomainElement = { + private[amf] def withObjectCollectionProperty( + property: PropertyLikeMapping[_], + value: Seq[DialectDomainElement], + node: Either[YNode, YMapEntry] + ): DialectDomainElement = { val f = property.toField() val (annotations, annotationsValue) = getAnnotationsOf(node) value match { @@ -169,6 +182,16 @@ case class DialectDomainElement(override val fields: Fields, annotations: Annota this } + private[amf] def setProperty( + property: PropertyLikeMapping[_], + value: Any, + scalarAnn: Annotations, + fieldAnn: Annotations + ): DialectDomainElement = { + set(property.toField(), AmfScalar(value, scalarAnn), fieldAnn) + this + } + private[amf] def setProperty(property: PropertyLikeMapping[_], value: Any, entry: YMapEntry): DialectDomainElement = { set(property.toField(), AmfScalar(value, Annotations(entry.value)), Annotations(entry)) this @@ -180,19 +203,21 @@ case class DialectDomainElement(override val fields: Fields, annotations: Annota this } - private[amf] def setProperty(property: PropertyLikeMapping[_], - value: Seq[Any], - entry: YMapEntry): DialectDomainElement = { + private[amf] def setProperty( + property: PropertyLikeMapping[_], + value: Seq[Any], + entry: YMapEntry + ): DialectDomainElement = { set(property.toField(), AmfArray(value.map(AmfScalar(_)), Annotations(entry.value)), Annotations(entry)) this } private[amf] def objectCollectionProperty(f: Field): Seq[DialectDomainElement] = getObjectByProperty(f.value.iri()) - private[amf] def objectProperty(f: Field): Option[DialectDomainElement] = objectCollectionProperty(f).headOption - private[amf] def literalProperty(f: Field): Option[Any] = literalProperties(f).headOption - private[amf] def literalProperties(f: Field): Seq[Any] = graph.scalarByField(f) + private[amf] def objectProperty(f: Field): Option[DialectDomainElement] = objectCollectionProperty(f).headOption + private[amf] def literalProperty(f: Field): Option[Any] = literalProperties(f).headOption + private[amf] def literalProperties(f: Field): Seq[Any] = graph.scalarByField(f) - private[amf] override def componentId: String = "" + override def componentId: String = "element" private def setObjInCollection(f: Field, node: Either[YNode, YMapEntry], newObj: DialectDomainElement) = { val (annotations, _) = getAnnotationsOf(node) @@ -225,9 +250,11 @@ case class DialectDomainElement(override val fields: Fields, annotations: Annota override def meta: DialectDomainElementModel = if (instanceTypes.isEmpty) DialectDomainElementModel() else { - new DialectDomainElementModel(instanceTypes.distinct, - instanceDefinedBy.map(_.propertiesMapping().map(_.toField)).getOrElse(Seq.empty), - instanceDefinedBy) + new DialectDomainElementModel( + instanceTypes.distinct, + instanceDefinedBy.map(_.propertiesMapping().map(_.toField)).getOrElse(Seq.empty), + instanceDefinedBy + ) } override def linkCopy(): DialectDomainElement = { @@ -237,10 +264,12 @@ case class DialectDomainElement(override val fields: Fields, annotations: Annota .withInstanceTypes(instanceTypes) } - override def resolveUnreferencedLink[T](label: String, - annotations: Annotations, - unresolved: T, - supportsRecursion: Boolean): T = { + override def resolveUnreferencedLink[T]( + label: String, + annotations: Annotations, + unresolved: T, + supportsRecursion: Boolean + ): T = { val unresolvedNodeMapping = unresolved.asInstanceOf[DialectDomainElement] val linked: T = unresolvedNodeMapping.link(label, annotations) if (supportsRecursion && linked.isInstanceOf[Linkable]) @@ -264,4 +293,12 @@ object DialectDomainElement { def apply(annotations: Annotations): DialectDomainElement = DialectDomainElement(Fields(), annotations) + + def apply(id: String, mapping: NodeMapping, annotations: Annotations): DialectDomainElement = { + DialectDomainElement(annotations) + .withDefinedBy(mapping) + .withId(id) + .withDefinedBy(mapping) + .withInstanceTypes(typesFrom(mapping)) + } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/DocumentMapping.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/DocumentMapping.scala index e96bd2bd..34842240 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/DocumentMapping.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/DocumentMapping.scala @@ -28,7 +28,7 @@ case class DocumentMapping(fields: Fields, annotations: Annotations) extends Dom } /** Value , path + field value that is used to compose the id when the object its adopted */ - private[amf] override def componentId: String = "" + override def componentId: String = "" } object DocumentMapping { diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/DocumentsModel.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/DocumentsModel.scala index 2b7da48e..d830980d 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/DocumentsModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/DocumentsModel.scala @@ -27,7 +27,7 @@ case class DocumentsModel(fields: Fields, annotations: Annotations) extends Doma override def meta: DocumentsModelModel.type = DocumentsModelModel /** Value , path + field value that is used to compose the id when the object its adopted */ - private[amf] override def componentId: String = "/documents" + override def componentId: String = "/documents" } object DocumentsModel { diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/External.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/External.scala index 7b94af70..2a229368 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/External.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/External.scala @@ -19,7 +19,7 @@ case class External(fields: Fields, annotations: Annotations) extends DomainElem override def meta: ExternalModel.type = ExternalModel /** Value , path + field value that is used to compose the id when the object its adopted */ - private[amf] override def componentId: String = alias.option() match { + override def componentId: String = alias.option() match { case Some(alias) => "/externals/" + alias.urlComponentEncoded case None => throw new Exception("Cannot set ID of external without alias") } diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/NodeMapping.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/NodeMapping.scala index 7a93fd1e..78fcb924 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/NodeMapping.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/NodeMapping.scala @@ -1,15 +1,15 @@ package amf.aml.client.scala.model.domain -import amf.core.client.scala.model.StrField +import amf.aml.internal.metamodel.domain.NodeMappingModel +import amf.aml.internal.metamodel.domain.NodeMappingModel._ import amf.core.client.scala.model.domain.{DomainElement, Linkable} +import amf.core.client.scala.model.{BoolField, StrField} import amf.core.internal.parser.domain.{Annotations, Fields} import amf.core.internal.utils._ -import amf.aml.internal.metamodel.domain.NodeMappingModel -import amf.aml.internal.metamodel.domain.NodeMappingModel._ import org.yaml.model.YMap class NodeMapping(override val fields: Fields, override val annotations: Annotations) - extends DomainElement + extends AnyMapping(fields) with Linkable with MergeableMapping with NodeMappable[NodeMappingModel.type] { @@ -19,16 +19,18 @@ class NodeMapping(override val fields: Fields, override val annotations: Annotat def nodetypeMapping: StrField = fields.field(NodeTypeMapping) def propertiesMapping(): Seq[PropertyMapping] = fields.field(PropertiesMapping) def idTemplate: StrField = fields.field(IdTemplate) + def closed: BoolField = fields.field(Closed) def resolvedExtends: Seq[String] = fields.field(ResolvedExtends) def withNodeTypeMapping(nodeType: String): NodeMapping = set(NodeTypeMapping, nodeType) def withPropertiesMapping(props: Seq[PropertyMapping]): NodeMapping = setArrayWithoutId(PropertiesMapping, props) + def withClosed(value: Boolean): NodeMapping = set(Closed, value) def withIdTemplate(idTemplate: String): NodeMapping = set(IdTemplate, idTemplate) def withResolvedExtends(ids: Seq[String]): NodeMapping = set(ResolvedExtends, ids) - /** - * Returns the properties forming the primary key for this node. - * Properties are already sorted. + private[amf] def hasProperties: Boolean = propertiesMapping().nonEmpty + + /** Returns the properties forming the primary key for this node. Properties are already sorted. */ def primaryKey(): Seq[PropertyMapping] = propertiesMapping() @@ -37,10 +39,12 @@ class NodeMapping(override val fields: Fields, override val annotations: Annotat override def linkCopy(): NodeMapping = NodeMapping().withId(id) - override def resolveUnreferencedLink[T](label: String, - annotations: Annotations, - unresolved: T, - supportsRecursion: Boolean): T = { + override def resolveUnreferencedLink[T]( + label: String, + annotations: Annotations, + unresolved: T, + supportsRecursion: Boolean + ): T = { val unresolvedNodeMapping = unresolved.asInstanceOf[NodeMapping] val linked: T = link(label, annotations) if (supportsRecursion && linked.isInstanceOf[Linkable]) @@ -53,7 +57,7 @@ class NodeMapping(override val fields: Fields, override val annotations: Annotat } /** Value , path + field value that is used to compose the id when the object its adopted */ - private[amf] override def componentId: String = { + override def componentId: String = { "/" + name.value().urlComponentEncoded } diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/NodeWithDiscriminator.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/NodeWithDiscriminator.scala index f7d02919..0723986a 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/NodeWithDiscriminator.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/NodeWithDiscriminator.scala @@ -9,20 +9,23 @@ trait NodeWithDiscriminator[M <: NodeWithDiscriminatorModel] extends DomainEleme def typeDiscriminatorName(): StrField = fields.field(meta.TypeDiscriminatorName) def typeDiscriminator(): Map[String, String] = Option(fields(meta.TypeDiscriminator)).map { disambiguator: String => - disambiguator.split(",").foldLeft(Map[String, String]()) { - case (acc, typeMapping) => - val pair = typeMapping.split("->") - acc + (pair.lift(1).getOrElse("") -> pair(0)) + disambiguator.split(",").foldLeft(Map[String, String]()) { case (acc, typeMapping) => + val pair = typeMapping.split("->") + acc + (pair.lift(1).getOrElse("") -> pair(0)) } }.orNull def withTypeDiscriminatorName(name: String): this.type = set(meta.TypeDiscriminatorName, name) - def withTypeDiscriminator(typesMapping: Map[String, String], - entryAnnotations: Annotations = Annotations(), - valueAnnotations: Annotations = Annotations()): this.type = - set(meta.TypeDiscriminator, - AmfScalar(typesMapping.map { case (a, b) => s"$a->$b" }.mkString(","), valueAnnotations), - entryAnnotations) + def withTypeDiscriminator( + typesMapping: Map[String, String], + entryAnnotations: Annotations = Annotations(), + valueAnnotations: Annotations = Annotations() + ): this.type = + set( + meta.TypeDiscriminator, + AmfScalar(typesMapping.map { case (a, b) => s"$a->$b" }.mkString(","), valueAnnotations), + entryAnnotations + ) override def meta: M diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PropertyLikeMapping.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PropertyLikeMapping.scala index 345bbf68..5cab8bfe 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PropertyLikeMapping.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PropertyLikeMapping.scala @@ -1,9 +1,10 @@ package amf.aml.client.scala.model.domain -import amf.core.client.scala.model.{AnyField, BoolField, DoubleField, IntField, StrField} -import amf.core.client.scala.model.domain.{AmfScalar, DomainElement} import amf.aml.internal.metamodel.domain.PropertyLikeMappingModel +import amf.core.client.scala.model._ +import amf.core.client.scala.model.domain.{AmfScalar, DomainElement} import amf.core.internal.metamodel.Field +import amf.core.internal.parser.domain.Annotations trait PropertyLikeMapping[M <: PropertyLikeMappingModel] extends DomainElement @@ -22,6 +23,7 @@ trait PropertyLikeMapping[M <: PropertyLikeMappingModel] def enum(): Seq[AnyField] = fields.field(meta.Enum) def unique(): BoolField = fields.field(meta.Unique) def externallyLinkable(): BoolField = fields.field(meta.ExternallyLinkable) + def mandatory(): BoolField = fields.field(meta.Mandatory) def nodesInRange: Seq[String] = { val range = objectRange() if (range.isEmpty) { @@ -45,10 +47,33 @@ trait PropertyLikeMapping[M <: PropertyLikeMappingModel] def withSorted(sorted: Boolean): this.type = set(meta.Sorted, sorted) def withUnique(unique: Boolean): this.type = set(meta.Unique, unique) def withExternallyLinkable(linkable: Boolean): this.type = set(meta.ExternallyLinkable, linkable) + def withMandatory(mandatory: Boolean): this.type = set(meta.Mandatory, mandatory) + + def mapKeyProperty(): StrField = fields.field(meta.MapKeyProperty) + + def mapValueProperty(): StrField = fields.field(meta.MapValueProperty) + + def mapTermKeyProperty(): StrField = fields.field(meta.MapTermKeyProperty) + + def mapTermValueProperty(): StrField = fields.field(meta.MapTermValueProperty) + + def withMapKeyProperty(key: String, annotations: Annotations = Annotations()): this.type = + set(meta.MapKeyProperty, AmfScalar(key, annotations)) + + def withMapValueProperty(value: String, annotations: Annotations = Annotations()): this.type = + set(meta.MapValueProperty, AmfScalar(value, annotations)) + + def withMapTermKeyProperty(key: String, annotations: Annotations = Annotations()): this.type = + set(meta.MapTermKeyProperty, AmfScalar(key, annotations)) + + def withMapTermValueProperty(value: String, annotations: Annotations = Annotations()): this.type = + set(meta.MapTermValueProperty, AmfScalar(value, annotations)) def classification(): PropertyClassification = PropertyLikeMappingClassifier.classification(this) def toField(): Field = PropertyLikeMappingToFieldConverter.convert(this) + private[amf] def isMultiple: Boolean = allowMultiple().option().getOrElse(false) + def meta: M } diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PropertyLikeMappingClassifier.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PropertyLikeMappingClassifier.scala index a219b3cf..40a903e6 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PropertyLikeMappingClassifier.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PropertyLikeMappingClassifier.scala @@ -8,11 +8,12 @@ object PropertyLikeMappingClassifier { val isAnyNode = propertyLike.objectRange().exists { obj => obj.value() == (Namespace.Meta + "anyNode").iri() } - val isLiteral = propertyLike.literalRange().nonNull - val isObject = propertyLike.objectRange().nonEmpty - val multiple = propertyLike.allowMultiple().option().getOrElse(false) - val (isMap, isMapValue) = hasMapTermValue(propertyLike) - val isExternalLink = propertyLike.externallyLinkable().option().getOrElse(false) + val isLiteral = propertyLike.literalRange().nonNull + val isObject = propertyLike.objectRange().nonEmpty + val multiple = propertyLike.allowMultiple().option().getOrElse(false) + val hasMapKey_ = hasMapKey(propertyLike) + val hasMapValue_ = hasMapValue(propertyLike) + val isExternalLink = propertyLike.externallyLinkable().option().getOrElse(false) if (isExternalLink) ExternalLinkProperty @@ -22,9 +23,9 @@ object PropertyLikeMappingClassifier { LiteralProperty else if (isLiteral) LiteralPropertyCollection - else if (isObject && isMap && isMapValue) + else if (isObject && hasMapKey_ && hasMapValue_) ObjectPairProperty - else if (isObject && isMap) + else if (isObject && hasMapKey_) ObjectMapProperty else if (isObject && !multiple) ObjectProperty @@ -32,10 +33,11 @@ object PropertyLikeMappingClassifier { ObjectPropertyCollection } - private def hasMapTermValue(propertyLikeMapping: PropertyLikeMapping[_]): (Boolean, Boolean) = { - propertyLikeMapping match { - case mapping: PropertyMapping => (mapping.mapTermKeyProperty().nonNull, mapping.mapValueProperty().nonNull) - case _ => (false, false) - } + private def hasMapKey(plm: PropertyLikeMapping[_]): Boolean = { + plm.mapTermKeyProperty().nonNull || plm.mapKeyProperty().nonNull + } + + private def hasMapValue(plm: PropertyLikeMapping[_]): Boolean = { + plm.mapTermValueProperty().nonNull || plm.mapValueProperty().nonNull } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PropertyLikeMappingToFieldConverter.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PropertyLikeMappingToFieldConverter.scala index d6ce6b0f..f046e13a 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PropertyLikeMappingToFieldConverter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PropertyLikeMappingToFieldConverter.scala @@ -33,10 +33,9 @@ object PropertyLikeMappingToFieldConverter { case Some(literal) if literal.endsWith("number") => Type.Float case Some(literal) if literal == DataType.Integer => Type.Int case Some(literal) if literal == DataType.Float => Type.Float - case Some(literal) if literal == DataType.Double => - Type.Double - case Some(literal) if literal == DataType.Boolean => - Type.Bool + case Some(literal) if literal == DataType.Double => Type.Double + case Some(literal) if literal == DataType.Long => Type.Long + case Some(literal) if literal == DataType.Boolean => Type.Bool case Some(literal) if literal == DataType.Decimal => Type.Int case Some(literal) if literal == DataType.Time => Type.Time case Some(literal) if literal == DataType.Date => Type.Date diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PropertyMapping.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PropertyMapping.scala index 0aebb11a..f71da14c 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PropertyMapping.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PropertyMapping.scala @@ -1,12 +1,13 @@ package amf.aml.client.scala.model.domain import amf.core.client.scala.model._ -import amf.core.client.scala.model.domain.AmfScalar +import amf.core.client.scala.model.domain.{AmfScalar, DataNode} import amf.core.client.scala.vocabulary.{Namespace, ValueType} import amf.core.internal.metamodel.{Field, Type} import amf.core.internal.parser.domain.{Annotations, Fields} import amf.aml.internal.metamodel.domain.PropertyMappingModel._ import amf.aml.internal.metamodel.domain.{DialectDomainElementModel, PropertyMappingModel} +import amf.core.internal.metamodel.domain.ShapeModel import org.yaml.model.YPart class PropertyClassification @@ -23,27 +24,13 @@ object ExternalLinkProperty extends PropertyClassification case class PropertyMapping(fields: Fields, annotations: Annotations) extends PropertyLikeMapping[PropertyMappingModel.type] with MergeableMapping - with NodeWithDiscriminator[PropertyMappingModel.type] { - - def mapKeyProperty(): StrField = fields.field(MapKeyProperty) - def mapValueProperty(): StrField = fields.field(MapValueProperty) - - def mapTermKeyProperty(): StrField = fields.field(MapTermKeyProperty) - def mapTermValueProperty(): StrField = fields.field(MapTermValueProperty) - - def withMapKeyProperty(key: String, annotations: Annotations = Annotations()): PropertyMapping = - set(MapKeyProperty, AmfScalar(key, annotations)) - def withMapValueProperty(value: String, annotations: Annotations = Annotations()): PropertyMapping = - set(MapValueProperty, AmfScalar(value, annotations)) - def withMapTermKeyProperty(key: String, annotations: Annotations = Annotations()): PropertyMapping = - set(MapTermKeyProperty, AmfScalar(key, annotations)) - def withMapTermValueProperty(value: String, annotations: Annotations = Annotations()): PropertyMapping = - set(MapTermValueProperty, AmfScalar(value, annotations)) + with NodeWithDiscriminator[PropertyMappingModel.type] + with WithDefaultFacet { override def meta: PropertyMappingModel.type = PropertyMappingModel /** Value , path + field value that is used to compose the id when the object its adopted */ - private[amf] override def componentId: String = "" + override def componentId: String = "" } object PropertyMapping { diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PropertyTerm.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PropertyTerm.scala index 276c7df2..9614c50c 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PropertyTerm.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PropertyTerm.scala @@ -16,12 +16,12 @@ abstract class PropertyTerm extends DomainElement { this } - private[amf] override def componentId: String = "" - def name: StrField = fields.field(Name) - def displayName: StrField = fields.field(DisplayName) - def description: StrField = fields.field(Description) - def range: StrField = fields.field(Range) - def subPropertyOf: Seq[StrField] = fields.field(SubPropertyOf) + override def componentId: String = "" + def name: StrField = fields.field(Name) + def displayName: StrField = fields.field(DisplayName) + def description: StrField = fields.field(Description) + def range: StrField = fields.field(Range) + def subPropertyOf: Seq[StrField] = fields.field(SubPropertyOf) def withName(name: String): PropertyTerm = set(Name, name) def withDisplayName(displayName: String): PropertyTerm = set(DisplayName, displayName) diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PublicNodeMapping.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PublicNodeMapping.scala index b43ce875..4c378074 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PublicNodeMapping.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/PublicNodeMapping.scala @@ -25,7 +25,7 @@ case class PublicNodeMapping(fields: Fields, annotations: Annotations) extends D } /** Value , path + field value that is used to compose the id when the object its adopted */ - private[amf] override def componentId: String = "" + override def componentId: String = "" } object PublicNodeMapping { diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/SemanticExtension.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/SemanticExtension.scala index dd4dc1bd..6a2286a7 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/SemanticExtension.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/SemanticExtension.scala @@ -18,7 +18,7 @@ case class SemanticExtension(fields: Fields, annotations: Annotations) extends D set(ExtensionMappingDefinition, annotationMapping) /** Value , path + field value that is used to compose the id when the object its adopted */ - private[amf] override def componentId: String = s"extensionMappings/${extensionName().value()}" + override def componentId: String = s"extensionMappings/${extensionName().value()}" } object SemanticExtension { diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/UnionNodeMapping.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/UnionNodeMapping.scala index a14df31e..5087b140 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/UnionNodeMapping.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/UnionNodeMapping.scala @@ -1,12 +1,12 @@ package amf.aml.client.scala.model.domain +import amf.aml.internal.metamodel.domain.UnionNodeMappingModel import amf.core.client.scala.model.domain.{DomainElement, Linkable} import amf.core.internal.parser.domain.{Annotations, Fields} import amf.core.internal.utils._ -import amf.aml.internal.metamodel.domain.UnionNodeMappingModel import org.yaml.model.YMap case class UnionNodeMapping(fields: Fields, annotations: Annotations) - extends DomainElement + extends AnyMapping(fields) with Linkable with MergeableMapping with NodeWithDiscriminator[UnionNodeMappingModel.type] @@ -17,7 +17,7 @@ case class UnionNodeMapping(fields: Fields, annotations: Annotations) override def linkCopy(): UnionNodeMapping = UnionNodeMapping().withId(id) override protected def classConstructor: (Fields, Annotations) => Linkable with DomainElement = UnionNodeMapping.apply - private[amf] override def componentId: String = "/" + name.value().urlComponentEncoded + override def componentId: String = "/" + name.value().urlComponentEncoded } object UnionNodeMapping { diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/VocabularyReference.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/VocabularyReference.scala index 5760fcaf..c59b7af7 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/VocabularyReference.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/VocabularyReference.scala @@ -21,7 +21,7 @@ case class VocabularyReference(fields: Fields, annotations: Annotations) extends override def meta: VocabularyReferenceModel.type = VocabularyReferenceModel /** Value , path + field value that is used to compose the id when the object its adopted */ - private[amf] override def componentId: String = alias.option() match { + override def componentId: String = alias.option() match { case Some(alias) => "/vocabularyReference/" + alias.urlComponentEncoded case None => throw new Exception("Cannot set ID of VocabularyReference without alias") } diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/WithDefaultFacet.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/WithDefaultFacet.scala new file mode 100644 index 00000000..3136ae92 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/model/domain/WithDefaultFacet.scala @@ -0,0 +1,10 @@ +package amf.aml.client.scala.model.domain + +import amf.core.client.scala.model.domain.{DataNode, DomainElement} +import amf.core.internal.metamodel.domain.ShapeModel + +trait WithDefaultFacet extends DomainElement { + + private[amf] def default(): Option[DataNode] = Option(fields.field(ShapeModel.Default)) + private[amf] def withDefault(node: DataNode) = set(ShapeModel.Default, node) +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/client/scala/render/AmlDomainElementEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/client/scala/render/AmlDomainElementEmitter.scala index de66a159..c35c4f35 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/client/scala/render/AmlDomainElementEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/client/scala/render/AmlDomainElementEmitter.scala @@ -9,39 +9,51 @@ import amf.core.client.scala.model.domain.DomainElement import amf.core.internal.render.SpecOrdering import amf.core.internal.render.emitters.DomainElementEmitter import amf.aml.internal.annotations.DiscriminatorField +import amf.aml.internal.registries.AMLRegistry import amf.aml.internal.render.emitters.instances.{DefaultNodeMappableFinder, DialectNodeEmitter} +import amf.core.internal.registries.AMFRegistry import org.yaml.model.YNode object AmlDomainElementEmitter extends DomainElementEmitter[Dialect] { - /** - * @param references : optional parameter which will improve emission of references defined in element + /** @param references + * : optional parameter which will improve emission of references defined in element */ - override def emit(element: DomainElement, - emissionStructure: Dialect, - eh: AMFErrorHandler, - references: Seq[BaseUnit] = Nil): YNode = { + override def emit( + element: DomainElement, + emissionStructure: Dialect, + eh: AMFErrorHandler, + references: Seq[BaseUnit] = Nil + ): YNode = { + val partEmitter = element match { - case element: DialectDomainElement => Some(dialectDomainElementEmitter(emissionStructure, references, element)) - case _ => None + case element: DialectDomainElement => + Some(dialectDomainElementEmitter(emissionStructure, references, element, AMLRegistry.empty)) + case _ => None } nodeOrError(partEmitter, element.id, eh) } - private def dialectDomainElementEmitter(dialect: Dialect, - references: Seq[BaseUnit], - element: DialectDomainElement) = { + private def dialectDomainElementEmitter( + dialect: Dialect, + references: Seq[BaseUnit], + element: DialectDomainElement, + registry: AMLRegistry + ) = { val renderOptions = RenderOptions() val nodeMappable = element.definedBy val discriminator = element.annotations.find(classOf[DiscriminatorField]).map(a => a.key -> a.value) val dialects = references.collect { case dialect: Dialect => dialect } val finder = DefaultNodeMappableFinder(dialects) - DialectNodeEmitter(element, - nodeMappable, - references, - dialect, - SpecOrdering.Lexical, - discriminator = discriminator, - renderOptions = renderOptions)(finder) + DialectNodeEmitter( + element, + nodeMappable, + references, + dialect, + SpecOrdering.Lexical, + discriminator = discriminator, + renderOptions = renderOptions, + registry = registry + )(finder) } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/annotations/DiscriminatorExtension.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/annotations/DiscriminatorExtension.scala new file mode 100644 index 00000000..f20d4047 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/annotations/DiscriminatorExtension.scala @@ -0,0 +1,5 @@ +package amf.aml.internal.annotations + +import amf.core.client.scala.model.domain.PerpetualAnnotation + +case class DiscriminatorExtension() extends PerpetualAnnotation {} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/annotations/FromUnionRangeMapping.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/annotations/FromUnionRangeMapping.scala new file mode 100644 index 00000000..d8e4a587 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/annotations/FromUnionRangeMapping.scala @@ -0,0 +1,9 @@ +package amf.aml.internal.annotations + +import amf.core.client.scala.model.domain.Annotation + +/* + If AMF can't determine a single range for the node this annotation is added to + distinguish which ranges where analyzed (ALS uses this to provide suggestions) + */ +case class FromUnionRangeMapping(possibleRanges: Seq[String]) extends Annotation diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/annotations/serializable/AMLSerializableAnnotations.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/annotations/serializable/AMLSerializableAnnotations.scala index 4e5a5f02..b2a255e2 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/annotations/serializable/AMLSerializableAnnotations.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/annotations/serializable/AMLSerializableAnnotations.scala @@ -2,22 +2,16 @@ package amf.aml.internal.annotations.serializable import amf.core.client.scala.model.domain.AnnotationGraphLoader import amf.core.internal.annotations.serializable.SerializableAnnotations -import amf.aml.internal.annotations.{ - AliasesLocation, - CustomBase, - CustomId, - JsonPointerRef, - RefInclude -} +import amf.aml.internal.annotations.{AliasesLocation, CustomBase, CustomId, JsonPointerRef, RefInclude} private[amf] object AMLSerializableAnnotations extends SerializableAnnotations { override val annotations: Map[String, AnnotationGraphLoader] = Map( - "aliases-location" -> AliasesLocation, - "custom-id" -> CustomId, - "custom-base" -> CustomBase, - "ref-include" -> RefInclude, - "json-pointer-ref" -> JsonPointerRef + "aliases-location" -> AliasesLocation, + "custom-id" -> CustomId, + "custom-base" -> CustomBase, + "ref-include" -> RefInclude, + "json-pointer-ref" -> JsonPointerRef ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/entities/AMLEntities.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/entities/AMLEntities.scala index 59a9cd8c..2d06291c 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/entities/AMLEntities.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/entities/AMLEntities.scala @@ -13,31 +13,32 @@ import amf.core.internal.metamodel.document.{ private[amf] object AMLEntities extends Entities { override protected val innerEntities: Seq[ModelDefaultBuilder] = Seq( - VocabularyModel, - ExternalModel, - VocabularyReferenceModel, - ClassTermModel, - ObjectPropertyTermModel, - DatatypePropertyTermModel, - DialectModel, - NodeMappingModel, - UnionNodeMappingModel, - PropertyMappingModel, - DocumentsModelModel, - PublicNodeMappingModel, - DocumentMappingModel, - DialectLibraryModel, - DialectFragmentModel, - DialectInstanceModel, - DialectInstanceLibraryModel, - DialectInstanceFragmentModel, - DialectInstancePatchModel, - DialectInstanceProcessingDataModel, - SemanticExtensionModel, - AnnotationMappingModel, - BaseUnitProcessingDataModel, - BaseUnitSourceInformationModel, - LocationInformationModel + VocabularyModel, + ExternalModel, + VocabularyReferenceModel, + ClassTermModel, + ObjectPropertyTermModel, + DatatypePropertyTermModel, + DialectModel, + NodeMappingModel, + UnionNodeMappingModel, + PropertyMappingModel, + DocumentsModelModel, + PublicNodeMappingModel, + DocumentMappingModel, + DialectLibraryModel, + DialectFragmentModel, + DialectInstanceModel, + DialectInstanceLibraryModel, + DialectInstanceFragmentModel, + DialectInstancePatchModel, + DialectInstanceProcessingDataModel, + SemanticExtensionModel, + AnnotationMappingModel, + BaseUnitProcessingDataModel, + BaseUnitSourceInformationModel, + LocationInformationModel, + AnyMappingModel ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/DialectFragmentModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/DialectFragmentModel.scala index 960e4366..7ce90aa4 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/DialectFragmentModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/DialectFragmentModel.scala @@ -16,8 +16,8 @@ object DialectFragmentModel extends FragmentModel with ExternalContextModel { override val fields: List[Field] = Externals :: Location :: FragmentModel.fields override val doc: ModelDoc = ModelDoc( - ModelVocabularies.Meta, - "DialectFragment", - "AML dialect mapping fragment that can be included in multiple AML dialects" + ModelVocabularies.Meta, + "DialectFragment", + "AML dialect mapping fragment that can be included in multiple AML dialects" ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/DialectInstanceProcessingDataModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/DialectInstanceProcessingDataModel.scala index 116f6f75..5eb91bff 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/DialectInstanceProcessingDataModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/DialectInstanceProcessingDataModel.scala @@ -10,16 +10,19 @@ import amf.core.internal.metamodel.domain.{ModelDoc, ModelVocabularies} object DialectInstanceProcessingDataModel extends BaseUnitProcessingDataModel { val DefinedBy: Field = Field( - Iri, - Namespace.Meta + "definedBy", - ModelDoc(ModelVocabularies.Meta, "definedBy", "Dialect used to parse this Dialect Instance")) + Iri, + Namespace.Meta + "definedBy", + ModelDoc(ModelVocabularies.Meta, "definedBy", "Dialect used to parse this Dialect Instance") + ) val GraphDependencies: Field = Field( - Array(Iri), - Namespace.Document + "graphDependencies", - ModelDoc(ModelVocabularies.Meta, - "graphDependencies", - "Other dialects referenced to parse specific nodes in this Dialect Instance") + Array(Iri), + Namespace.Document + "graphDependencies", + ModelDoc( + ModelVocabularies.Meta, + "graphDependencies", + "Other dialects referenced to parse specific nodes in this Dialect Instance" + ) ) override def modelInstance: DialectInstanceProcessingData = DialectInstanceProcessingData() @@ -29,9 +32,9 @@ object DialectInstanceProcessingDataModel extends BaseUnitProcessingDataModel { override val `type`: List[ValueType] = List(Document + "DialectInstanceProcessingData") override val doc: ModelDoc = ModelDoc( - ModelVocabularies.AmlDoc, - "APIContractProcessingData", - "Class that groups data related to how a Base Unit was processed", - Seq((Document + "BaseUnitProcessingData").iri()) + ModelVocabularies.AmlDoc, + "APIContractProcessingData", + "Class that groups data related to how a Base Unit was processed", + Seq((Document + "BaseUnitProcessingData").iri()) ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/DialectInstanceUnitModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/DialectInstanceUnitModel.scala index 38ecaa63..1db1ed1e 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/DialectInstanceUnitModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/DialectInstanceUnitModel.scala @@ -16,10 +16,12 @@ trait DialectInstanceUnitModel { self: BaseUnitModel => override val ProcessingData: Field = Field( - DialectInstanceProcessingDataModel, - Document + "processingData", - ModelDoc(ModelVocabularies.AmlDoc, - "processingData", - "Field with utility data to be used in Base Unit processing") + DialectInstanceProcessingDataModel, + Document + "processingData", + ModelDoc( + ModelVocabularies.AmlDoc, + "processingData", + "Field with utility data to be used in Base Unit processing" + ) ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/DialectLibraryModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/DialectLibraryModel.scala index fc8ec6ef..38862385 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/DialectLibraryModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/DialectLibraryModel.scala @@ -16,8 +16,8 @@ object DialectLibraryModel extends ModuleModel with ExternalContextModel { override val fields: List[Field] = Externals :: Location :: ModuleModel.fields override val doc: ModelDoc = ModelDoc( - ModelVocabularies.Meta, - "DialectLibrary", - "Library of AML mappings that can be reused in different AML dialects" + ModelVocabularies.Meta, + "DialectLibrary", + "Library of AML mappings that can be reused in different AML dialects" ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/DialectModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/DialectModel.scala index f5b7039c..e7bf624f 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/DialectModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/DialectModel.scala @@ -18,28 +18,32 @@ object DialectModel extends DocumentModel with ExternalContextModel { val Version: Field = Field(Str, Namespace.Core + "version", ModelDoc(ModelVocabularies.Core, "version", "Version of the dialect")) - val Documents: Field = Field(DocumentsModelModel, - Namespace.Meta + "documents", - ModelDoc(ModelVocabularies.Meta, "documents", "Document mapping for the the dialect")) + val Documents: Field = Field( + DocumentsModelModel, + Namespace.Meta + "documents", + ModelDoc(ModelVocabularies.Meta, "documents", "Document mapping for the the dialect") + ) val Extensions: Field = Field( - Array(SemanticExtensionModel), - Namespace.Meta + "extensions", - ModelDoc(ModelVocabularies.Meta, - "extensions", - "Extensions mappings derived from annotation mappings declarations in a dialect") + Array(SemanticExtensionModel), + Namespace.Meta + "extensions", + ModelDoc( + ModelVocabularies.Meta, + "extensions", + "Extensions mappings derived from annotation mappings declarations in a dialect" + ) ) override def modelInstance: AmfObject = Dialect() override val `type`: List[ValueType] = Namespace.Meta + "Dialect" :: DocumentModel.`type` - override val fields - : List[Field] = Name :: Version :: Extensions :: Externals :: Documents :: BaseUnitModel.Location :: DocumentModel.fields + override val fields: List[Field] = + Name :: Version :: Extensions :: Externals :: Documents :: BaseUnitModel.Location :: DocumentModel.fields override val doc: ModelDoc = ModelDoc( - ModelVocabularies.Meta, - "Dialect", - "Definition of an AML dialect, mapping AST nodes from dialect documents into an output semantic graph" + ModelVocabularies.Meta, + "Dialect", + "Definition of an AML dialect, mapping AST nodes from dialect documents into an output semantic graph" ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/VocabularyModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/VocabularyModel.scala index 74f206f2..91a8f05c 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/VocabularyModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/document/VocabularyModel.scala @@ -13,12 +13,16 @@ object VocabularyModel extends ModuleModel with ExternalContextModel { val Name = Field(Str, Namespace.Core + "name", ModelDoc(ModelVocabularies.Core, "name", "Name for an entity")) - val Base = Field(Str, - Namespace.Meta + "base", - ModelDoc(ModelVocabularies.Meta, "base", "Base URI prefix for definitions in this vocabulary")) - val Imports = Field(Array(VocabularyReferenceModel), - Namespace.Owl + "imports", - ModelDoc(ExternalModelVocabularies.Owl, "import", "import relationships between vocabularies")) + val Base = Field( + Str, + Namespace.Meta + "base", + ModelDoc(ModelVocabularies.Meta, "base", "Base URI prefix for definitions in this vocabulary") + ) + val Imports = Field( + Array(VocabularyReferenceModel), + Namespace.Owl + "imports", + ModelDoc(ExternalModelVocabularies.Owl, "import", "import relationships between vocabularies") + ) override def modelInstance: AmfObject = Vocabulary() @@ -29,8 +33,8 @@ object VocabularyModel extends ModuleModel with ExternalContextModel { Name :: Imports :: Externals :: Declares :: Base :: BaseUnitModel.Location :: BaseUnitModel.fields override val doc: ModelDoc = ModelDoc( - ModelVocabularies.Meta, - "Vocabulary", - "Basic primitives for the declaration of vocabularies." + ModelVocabularies.Meta, + "Vocabulary", + "Basic primitives for the declaration of vocabularies." ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/AnnotationMappingModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/AnnotationMappingModel.scala index f35f58bf..94232ddb 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/AnnotationMappingModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/AnnotationMappingModel.scala @@ -1,29 +1,30 @@ package amf.aml.internal.metamodel.domain -import amf.core.internal.metamodel.Field -import amf.core.internal.metamodel.Type.Iri -import amf.core.internal.metamodel.domain.{DomainElementModel, ExternalModelVocabularies, ModelDoc, ModelVocabularies} -import amf.core.client.scala.vocabulary.{Namespace, ValueType} import amf.aml.client.scala.model.domain.AnnotationMapping +import amf.core.client.scala.vocabulary.{Namespace, ValueType} +import amf.core.internal.metamodel.Type.Iri +import amf.core.internal.metamodel.domain.{DomainElementModel, ModelDoc, ModelVocabularies} +import amf.core.internal.metamodel.{Field, Type} object AnnotationMappingModel extends DomainElementModel with PropertyLikeMappingModel with NodeMappableModel { override val Name: Field = NodeMappingModel.Name val Domain: Field = Field( - Iri, - Namespace.AmfAml + "domain", - ModelDoc( - ModelVocabularies.AmlDoc, - "domain", - "Domain node type IRI for which a specific annotation mapping can be applied. Similar rdfs:domain but at an instance level, rather than schema level." - ) + Type.Array(Iri), + Namespace.AmfAml + "domain", + ModelDoc( + ModelVocabularies.AmlDoc, + "domain", + "Domain node type IRI for which a specific annotation mapping can be applied. Similar rdfs:domain but at an instance level, rather than schema level." + ) ) override def fields: List[Field] = NodePropertyMapping :: Name :: LiteralRange :: ObjectRange :: MinCount :: Pattern :: Minimum :: Maximum :: AllowMultiple :: Sorted :: Enum :: TypeDiscriminator :: - Unique :: ExternallyLinkable :: TypeDiscriminatorName :: Domain :: DomainElementModel.fields + Unique :: ExternallyLinkable :: TypeDiscriminatorName :: MapKeyProperty :: MapValueProperty :: + MapTermKeyProperty :: MapTermValueProperty :: Domain :: DomainElementModel.fields override def modelInstance: AnnotationMapping = AnnotationMapping() diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/AnyMappingModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/AnyMappingModel.scala new file mode 100644 index 00000000..48add0b5 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/AnyMappingModel.scala @@ -0,0 +1,83 @@ +package amf.aml.internal.metamodel.domain + +import amf.core.client.scala.vocabulary.{Namespace, ValueType} +import amf.core.internal.metamodel.Field +import amf.core.internal.metamodel.Type.{Array, Iri} +import amf.core.internal.metamodel.domain._ + +trait AnyMappingModel + extends DomainElementModel + with LinkableElementModel + with MergeableMappingModel + with NodeMappableModel { + + val And: Field = Field( + Array(Iri), + Namespace.AmfAml + "and", + ModelDoc(ExternalModelVocabularies.Shacl, "and", "Logical and composition of data") + ) + + val Or: Field = Field( + Array(Iri), + Namespace.AmfAml + "or", + ModelDoc(ExternalModelVocabularies.Shacl, "or", "Logical or composition of data") + ) + + val Components: Field = Field( + Array(Iri), + Namespace.AmfAml + "components", + ModelDoc( + ExternalModelVocabularies.Shacl, + "components", + "Array of component mappings in case of component combination generated mapping" + ) + ) + + val If: Field = Field( + Iri, + Namespace.AmfAml + "if", + ModelDoc( + ExternalModelVocabularies.Shacl, + "if", + "Conditional constraint if over the type of the mapped graph property" + ) + ) + + val Then: Field = Field( + Iri, + Namespace.AmfAml + "then", + ModelDoc( + ExternalModelVocabularies.Shacl, + "then", + "Conditional constraint then over the type of the mapped graph property" + ) + ) + + val Else: Field = Field( + Iri, + Namespace.AmfAml + "else", + ModelDoc( + ExternalModelVocabularies.Shacl, + "else", + "Conditional constraint else over the type of the mapped graph property" + ) + ) + + override val `type`: List[ValueType] = + Namespace.Meta + "AnyMapping" :: Namespace.Shacl + "Shape" :: DomainElementModel.`type` + +} + +object AnyMappingModel extends AnyMappingModel { + + override val doc: ModelDoc = ModelDoc( + ModelVocabularies.Shapes, + "AnyMapping", + "Base class for all mappings stored in the AML graph model", + superClasses = Seq((Namespace.Shacl + "Shape").iri()) + ) + + override def modelInstance = throw new Exception("AnyMapping is an abstract class") + + override val fields: List[Field] = List(And, Or, Components, If, Then, Else) +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/ClassTermModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/ClassTermModel.scala index 776ad4ff..35a3d77d 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/ClassTermModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/ClassTermModel.scala @@ -12,21 +12,26 @@ object ClassTermModel extends DomainElementModel { val Name: Field = Field(Str, Namespace.Core + "name", ModelDoc(ModelVocabularies.Core, "name", "Name of the ClassTerm")) - val DisplayName: Field = Field(Str, - Namespace.Core + "displayName", - ModelDoc(ModelVocabularies.Core, "displayName", "Human readable name for the term")) + val DisplayName: Field = Field( + Str, + Namespace.Core + "displayName", + ModelDoc(ModelVocabularies.Core, "displayName", "Human readable name for the term") + ) val Description: Field = Field( - Str, - Namespace.Core + "description", - ModelDoc(ModelVocabularies.Core, "description", "Human readable description for the term")) + Str, + Namespace.Core + "description", + ModelDoc(ModelVocabularies.Core, "description", "Human readable description for the term") + ) val Properties: Field = Field( - Array(Iri), - Namespace.Meta + "properties", - ModelDoc(ModelVocabularies.Meta, "properties", "Properties that have the ClassTerm in the domain")) + Array(Iri), + Namespace.Meta + "properties", + ModelDoc(ModelVocabularies.Meta, "properties", "Properties that have the ClassTerm in the domain") + ) val SubClassOf: Field = Field( - Array(Iri), - Namespace.Rdfs + "subClassOf", - ModelDoc(ExternalModelVocabularies.Rdfs, "subClassOf", "Subsumption relationship across terms")) + Array(Iri), + Namespace.Rdfs + "subClassOf", + ModelDoc(ExternalModelVocabularies.Rdfs, "subClassOf", "Subsumption relationship across terms") + ) override def modelInstance: AmfObject = ClassTerm() diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/DatatypePropertyTermModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/DatatypePropertyTermModel.scala index 23e88a0e..6556e0fa 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/DatatypePropertyTermModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/DatatypePropertyTermModel.scala @@ -6,7 +6,7 @@ import amf.core.client.scala.vocabulary.{Namespace, ValueType} import amf.aml.client.scala.model.domain.DatatypePropertyTerm object DatatypePropertyTermModel extends PropertyTermModel { - override val `type` - : List[ValueType] = Namespace.Owl + "DatatypeProperty" :: Namespace.Meta + "Property" :: DomainElementModel.`type` + override val `type`: List[ValueType] = + Namespace.Owl + "DatatypeProperty" :: Namespace.Meta + "Property" :: DomainElementModel.`type` override def modelInstance: AmfObject = DatatypePropertyTerm() } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/DialectDomainElementModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/DialectDomainElementModel.scala index 08e7dea3..a7db45b4 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/DialectDomainElementModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/DialectDomainElementModel.scala @@ -7,10 +7,11 @@ import amf.core.client.scala.model.domain.AmfObject import amf.core.client.scala.vocabulary.{Namespace, ValueType} import amf.aml.client.scala.model.domain.{DialectDomainElement, NodeMapping} -class DialectDomainElementModel(val typeIri: Seq[String] = Seq(), - val typeFields: Seq[Field] = Nil, - val nodeMapping: Option[NodeMapping] = None) - extends DomainElementModel +class DialectDomainElementModel( + val typeIri: Seq[String] = Seq(), + val typeFields: Seq[Field] = Nil, + val nodeMapping: Option[NodeMapping] = None +) extends DomainElementModel with LinkableElementModel { override val fields: List[Field] = diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/DocumentMappingModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/DocumentMappingModel.scala index 23888ffc..df7b5f98 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/DocumentMappingModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/DocumentMappingModel.scala @@ -10,19 +10,21 @@ import amf.aml.client.scala.model.domain.DocumentMapping object DocumentMappingModel extends DomainElementModel { val DocumentName: Field = Field( - Str, - Namespace.Core + "name", - ModelDoc(ModelVocabularies.Core, "name", "Name of the document for a dialect base unit")) + Str, + Namespace.Core + "name", + ModelDoc(ModelVocabularies.Core, "name", "Name of the document for a dialect base unit") + ) val EncodedNode: Field = Field( - Iri, - Namespace.Meta + "encodedNode", - ModelDoc(ModelVocabularies.Meta, "encodedNode", "Node in the dialect encoded in the target mapped base unit")) + Iri, + Namespace.Meta + "encodedNode", + ModelDoc(ModelVocabularies.Meta, "encodedNode", "Node in the dialect encoded in the target mapped base unit") + ) val DeclaredNodes: Field = Field( - Array(PublicNodeMappingModel), - Namespace.Meta + "declaredNode", - ModelDoc(ModelVocabularies.Meta, "declaredNode", "Node in the dialect declared in the target mappend base unit") + Array(PublicNodeMappingModel), + Namespace.Meta + "declaredNode", + ModelDoc(ModelVocabularies.Meta, "declaredNode", "Node in the dialect declared in the target mappend base unit") ) override def fields: List[Field] = DocumentName :: EncodedNode :: DeclaredNodes :: DomainElementModel.fields @@ -32,8 +34,8 @@ object DocumentMappingModel extends DomainElementModel { override val `type`: List[ValueType] = Namespace.Meta + "DocumentMapping" :: DomainElementModel.`type` override val doc: ModelDoc = ModelDoc( - ModelVocabularies.Meta, - "DocumentMapping", - "Mapping for a particular dialect document into a graph base unit" + ModelVocabularies.Meta, + "DocumentMapping", + "Mapping for a particular dialect document into a graph base unit" ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/DocumentsModelModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/DocumentsModelModel.scala index 3d300573..4f2b7ebc 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/DocumentsModelModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/DocumentsModelModel.scala @@ -10,54 +10,62 @@ import amf.aml.client.scala.model.domain.DocumentsModel object DocumentsModelModel extends DomainElementModel { val Root: Field = Field( - DocumentMappingModel, - Namespace.Meta + "rootDocument", - ModelDoc(ModelVocabularies.Meta, "rootDocument", "Root node encoded in a mapped document base unit") + DocumentMappingModel, + Namespace.Meta + "rootDocument", + ModelDoc(ModelVocabularies.Meta, "rootDocument", "Root node encoded in a mapped document base unit") ) val Fragments: Field = Field( - Array(DocumentMappingModel), - Namespace.Meta + "fragments", - ModelDoc(ModelVocabularies.Meta, "fragments", "Mapping of fragment base unit for a particular dialect") + Array(DocumentMappingModel), + Namespace.Meta + "fragments", + ModelDoc(ModelVocabularies.Meta, "fragments", "Mapping of fragment base unit for a particular dialect") ) val Library: Field = Field( - DocumentMappingModel, - Namespace.Meta + "library", - ModelDoc(ModelVocabularies.Meta, "library", "Mappig of module base unit for a particular dialect")) + DocumentMappingModel, + Namespace.Meta + "library", + ModelDoc(ModelVocabularies.Meta, "library", "Mappig of module base unit for a particular dialect") + ) // options: val SelfEncoded: Field = Field( - Bool, - Namespace.Meta + "selfEncoded", - ModelDoc( - ModelVocabularies.Meta, - "selfEncoded", - "Information about if the base unit URL should be the same as the URI of the parsed root nodes in the unit") + Bool, + Namespace.Meta + "selfEncoded", + ModelDoc( + ModelVocabularies.Meta, + "selfEncoded", + "Information about if the base unit URL should be the same as the URI of the parsed root nodes in the unit" + ) ) val DeclarationsPath: Field = Field( - Str, - Namespace.Meta + "declarationsPath", - ModelDoc(ModelVocabularies.Meta, - "declarationsPath", - "Information about the AST location of the declarations to be parsed as declared domain elements") + Str, + Namespace.Meta + "declarationsPath", + ModelDoc( + ModelVocabularies.Meta, + "declarationsPath", + "Information about the AST location of the declarations to be parsed as declared domain elements" + ) ) val KeyProperty: Field = Field( - Bool, - Namespace.Meta + "keyProperty", - ModelDoc(ModelVocabularies.Meta, - "keyProperty", - "Information about whether the dialect is defined by the header or a key property") + Bool, + Namespace.Meta + "keyProperty", + ModelDoc( + ModelVocabularies.Meta, + "keyProperty", + "Information about whether the dialect is defined by the header or a key property" + ) ) val ReferenceStyle: Field = Field( - Str, - Namespace.Meta + "referenceStyle", - ModelDoc(ModelVocabularies.Meta, - "referenceStyle", - "Determines the style for inclusions (RamlStyle or JsonSchemaStyle)") + Str, + Namespace.Meta + "referenceStyle", + ModelDoc( + ModelVocabularies.Meta, + "referenceStyle", + "Determines the style for inclusions (RamlStyle or JsonSchemaStyle)" + ) ) override def fields: List[Field] = @@ -68,8 +76,8 @@ object DocumentsModelModel extends DomainElementModel { override val `type`: List[ValueType] = Namespace.Meta + "DocumentsModel" :: DomainElementModel.`type` override val doc: ModelDoc = ModelDoc( - ModelVocabularies.Meta, - "DocumentsModel", - "Mapping from different type of dialect documents to base units in the parsed graph" + ModelVocabularies.Meta, + "DocumentsModel", + "Mapping from different type of dialect documents to base units in the parsed graph" ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/ExternalModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/ExternalModel.scala index a96957fa..c106278f 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/ExternalModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/ExternalModel.scala @@ -9,9 +9,11 @@ import amf.aml.client.scala.model.domain.External object ExternalModel extends DomainElementModel { - val DisplayName: Field = Field(Str, - Namespace.Core + "displayName", - ModelDoc(ModelVocabularies.Core, "displayName", "The display name of the item")) + val DisplayName: Field = Field( + Str, + Namespace.Core + "displayName", + ModelDoc(ModelVocabularies.Core, "displayName", "The display name of the item") + ) val Base: Field = Field(Str, Namespace.Meta + "base", ModelDoc(ModelVocabularies.Meta, "base", "Base URI for the external model")) @@ -19,6 +21,6 @@ object ExternalModel extends DomainElementModel { override def fields: List[Field] = DisplayName :: Base :: DomainElementModel.fields - override val `type` - : List[ValueType] = Namespace.Owl + "Ontology" :: Namespace.Meta + "ExternalVocabulary" :: DomainElementModel.`type` + override val `type`: List[ValueType] = + Namespace.Owl + "Ontology" :: Namespace.Meta + "ExternalVocabulary" :: DomainElementModel.`type` } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/HasObjectRangeModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/HasObjectRangeModel.scala index 4cc63a17..cccf2ce2 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/HasObjectRangeModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/HasObjectRangeModel.scala @@ -7,10 +7,8 @@ import amf.core.client.scala.vocabulary.Namespace trait HasObjectRangeModel extends DomainElementModel { val ObjectRange: Field = Field( - SortedArray(Iri), - Namespace.Shacl + "node", - ModelDoc(ExternalModelVocabularies.Shacl, - "range", - "Object constraint over the type of the mapped graph property") + SortedArray(Iri), + Namespace.Shacl + "node", + ModelDoc(ExternalModelVocabularies.Shacl, "range", "Object constraint over the type of the mapped graph property") ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/MergeableMappingModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/MergeableMappingModel.scala index bd70a167..ee113ab5 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/MergeableMappingModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/MergeableMappingModel.scala @@ -6,11 +6,13 @@ import amf.core.client.scala.vocabulary.Namespace trait MergeableMappingModel { val MergePolicy: Field = Field( - Str, - Namespace.Meta + "mergePolicy", - ModelDoc(ModelVocabularies.Meta, - "mergePolicy", - "Indication of how to merge this graph node when applying a patch document") + Str, + Namespace.Meta + "mergePolicy", + ModelDoc( + ModelVocabularies.Meta, + "mergePolicy", + "Indication of how to merge this graph node when applying a patch document" + ) ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/NodeMappingModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/NodeMappingModel.scala index c2a61b30..7b240b1f 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/NodeMappingModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/NodeMappingModel.scala @@ -1,50 +1,44 @@ package amf.aml.internal.metamodel.domain -import amf.core.internal.metamodel.Field -import amf.core.internal.metamodel.Type.{Array, Iri, Str} -import amf.core.internal.metamodel.domain.{ - DomainElementModel, - LinkableElementModel, - ModelDoc, - ModelVocabularies, - ExternalModelVocabularies -} +import amf.aml.client.scala.model.domain.NodeMapping import amf.core.client.scala.model.domain.AmfObject import amf.core.client.scala.vocabulary.{Namespace, ValueType} -import amf.aml.client.scala.model.domain.NodeMapping +import amf.core.internal.metamodel.Field +import amf.core.internal.metamodel.Type.{Array, Iri, Str} +import amf.core.internal.metamodel.domain._ -object NodeMappingModel - extends DomainElementModel - with LinkableElementModel - with MergeableMappingModel - with NodeMappableModel { +object NodeMappingModel extends AnyMappingModel with ClosedModel { val NodeTypeMapping: Field = Field( - Iri, - Namespace.Shacl + "targetClass", - ModelDoc(ExternalModelVocabularies.Shacl, - "targetClass", - "Target class whose instances will need to match the constraint described for the node") + Iri, + Namespace.Shacl + "targetClass", + ModelDoc( + ExternalModelVocabularies.Shacl, + "targetClass", + "Target class whose instances will need to match the constraint described for the node" + ) ) val PropertiesMapping: Field = Field( - Array(PropertyMappingModel), - Namespace.Shacl + "property", - ModelDoc(ExternalModelVocabularies.Shacl, "property", "Data shape constraint for a property of the target node") + Array(PropertyMappingModel), + Namespace.Shacl + "property", + ModelDoc(ExternalModelVocabularies.Shacl, "property", "Data shape constraint for a property of the target node") ) val IdTemplate: Field = Field( - Str, - Namespace.ApiContract + "uriTemplate", - ModelDoc(ModelVocabularies.ApiContract, - "uriTemplate", - "URI template that will be used to generate the URI of the parsed nodeds in the graph") + Str, + Namespace.ApiContract + "uriTemplate", + ModelDoc( + ModelVocabularies.ApiContract, + "uriTemplate", + "URI template that will be used to generate the URI of the parsed nodeds in the graph" + ) ) val ResolvedExtends: Field = Field(Array(Iri), Namespace.Meta + "resolvedExtends") override def fields: List[Field] = - NodeTypeMapping :: Name :: PropertiesMapping :: IdTemplate :: MergePolicy :: ResolvedExtends :: LinkableElementModel.fields ++ DomainElementModel.fields + NodeTypeMapping :: Name :: PropertiesMapping :: IdTemplate :: MergePolicy :: ResolvedExtends :: Closed :: LinkableElementModel.fields ++ DomainElementModel.fields ++ AnyMappingModel.fields override def modelInstance: AmfObject = NodeMapping() - override val `type` - : List[ValueType] = Namespace.Meta + "NodeMapping" :: Namespace.Shacl + "Shape" :: DomainElementModel.`type` + override val `type`: List[ValueType] = + Namespace.Meta + "NodeMapping" :: Namespace.Shacl + "Shape" :: DomainElementModel.`type` } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/NodeWithDiscriminatorModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/NodeWithDiscriminatorModel.scala index 373b5716..cb4ec84d 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/NodeWithDiscriminatorModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/NodeWithDiscriminatorModel.scala @@ -6,17 +6,21 @@ import amf.core.client.scala.vocabulary.Namespace trait NodeWithDiscriminatorModel extends DomainElementModel with HasObjectRangeModel { val TypeDiscriminator: Field = Field( - Str, - Namespace.Meta + "typeDiscriminatorMap", - ModelDoc(ModelVocabularies.Meta, - "typeDiscriminatorMap", - "Information about the discriminator values in the source AST for the property mapping") + Str, + Namespace.Meta + "typeDiscriminatorMap", + ModelDoc( + ModelVocabularies.Meta, + "typeDiscriminatorMap", + "Information about the discriminator values in the source AST for the property mapping" + ) ) val TypeDiscriminatorName: Field = Field( - Str, - Namespace.Meta + "typeDiscriminatorName", - ModelDoc(ModelVocabularies.Meta, - "typeDiscriminatorName", - "Information about the field in the source AST to be used as discrimintaro in the property mapping") + Str, + Namespace.Meta + "typeDiscriminatorName", + ModelDoc( + ModelVocabularies.Meta, + "typeDiscriminatorName", + "Information about the field in the source AST to be used as discrimintaro in the property mapping" + ) ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/ObjectPropertyTermModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/ObjectPropertyTermModel.scala index 46de9532..c3ddca40 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/ObjectPropertyTermModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/ObjectPropertyTermModel.scala @@ -6,7 +6,7 @@ import amf.core.client.scala.vocabulary.{Namespace, ValueType} import amf.aml.client.scala.model.domain.ObjectPropertyTerm object ObjectPropertyTermModel extends PropertyTermModel { - override val `type` - : List[ValueType] = Namespace.Owl + "ObjectProperty" :: Namespace.Meta + "Property" :: DomainElementModel.`type` + override val `type`: List[ValueType] = + Namespace.Owl + "ObjectProperty" :: Namespace.Meta + "Property" :: DomainElementModel.`type` override def modelInstance: AmfObject = ObjectPropertyTerm() } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/PropertyLikeMappingModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/PropertyLikeMappingModel.scala index 30e60684..498b01fa 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/PropertyLikeMappingModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/PropertyLikeMappingModel.scala @@ -1,82 +1,135 @@ package amf.aml.internal.metamodel.domain +import amf.core.client.scala.vocabulary.Namespace import amf.core.internal.metamodel.Field import amf.core.internal.metamodel.Type.{Any, Bool, Double, Int, Iri, SortedArray, Str} import amf.core.internal.metamodel.domain.{DomainElementModel, ExternalModelVocabularies, ModelDoc, ModelVocabularies} -import amf.core.client.scala.vocabulary.Namespace -/** - * Mappings form with which graph properties can be derived (annotation mappings, property mappings) +/** Mappings form with which graph properties can be derived (annotation mappings, property mappings) */ trait PropertyLikeMappingModel extends DomainElementModel with HasObjectRangeModel with NodeWithDiscriminatorModel { - val Name: Field = Field(Str, - Namespace.Core + "name", - ModelDoc(ModelVocabularies.Core, "name", "Name in the source AST for the mapping")) + val Name: Field = Field( + Str, + Namespace.Core + "name", + ModelDoc(ModelVocabularies.Core, "name", "Name in the source AST for the mapping") + ) - val LiteralRange: Field = Field(Iri, - Namespace.Shacl + "datatype", - ModelDoc(ExternalModelVocabularies.Shacl, - "datatype", - "Scalar constraint over the type of the mapped graph property")) + val LiteralRange: Field = Field( + Iri, + Namespace.Shacl + "datatype", + ModelDoc( + ExternalModelVocabularies.Shacl, + "datatype", + "Scalar constraint over the type of the mapped graph property" + ) + ) val NodePropertyMapping: Field = Field( - Iri, - Namespace.Shacl + "path", - ModelDoc(ExternalModelVocabularies.Shacl, "path", "URI for the mapped graph property derived from this mapping")) - - val Sorted: Field = Field(Bool, - Namespace.Meta + "sorted", - ModelDoc(ModelVocabularies.Meta, - "sorted", - "Marks the mapping as requiring order in the mapped collection of nodes")) + Iri, + Namespace.Shacl + "path", + ModelDoc(ExternalModelVocabularies.Shacl, "path", "URI for the mapped graph property derived from this mapping") + ) + + val Sorted: Field = Field( + Bool, + Namespace.Meta + "sorted", + ModelDoc( + ModelVocabularies.Meta, + "sorted", + "Marks the mapping as requiring order in the mapped collection of nodes" + ) + ) val MinCount: Field = Field( - Int, - Namespace.Shacl + "minCount", - ModelDoc(ExternalModelVocabularies.Shacl, "minCount", "Minimum count constraint over the mapped property")) + Int, + Namespace.Shacl + "minCount", + ModelDoc(ExternalModelVocabularies.Shacl, "minCount", "Minimum count constraint over the mapped property") + ) val Pattern: Field = Field( - Str, - Namespace.Shacl + "pattern", - ModelDoc(ExternalModelVocabularies.Shacl, "pattern", "Pattern constraint over the mapped property")) + Str, + Namespace.Shacl + "pattern", + ModelDoc(ExternalModelVocabularies.Shacl, "pattern", "Pattern constraint over the mapped property") + ) val Minimum: Field = Field( - Double, - Namespace.Shacl + "minInclusive", - ModelDoc(ExternalModelVocabularies.Shacl, - "minInclusive", - "Minimum inclusive constraint over the mapped property") + Double, + Namespace.Shacl + "minInclusive", + ModelDoc(ExternalModelVocabularies.Shacl, "minInclusive", "Minimum inclusive constraint over the mapped property") ) val Maximum: Field = Field( - Double, - Namespace.Shacl + "maxInclusive", - ModelDoc(ExternalModelVocabularies.Shacl, - "maxInclusive", - "Maximum inclusive constraint over the mapped property") + Double, + Namespace.Shacl + "maxInclusive", + ModelDoc(ExternalModelVocabularies.Shacl, "maxInclusive", "Maximum inclusive constraint over the mapped property") ) val AllowMultiple: Field = Field( - Bool, - Namespace.Meta + "allowMultiple", - ModelDoc(ModelVocabularies.Meta, "allowMultiple", "Allows multiple mapped nodes for the property mapping")) + Bool, + Namespace.Meta + "allowMultiple", + ModelDoc(ModelVocabularies.Meta, "allowMultiple", "Allows multiple mapped nodes for the property mapping") + ) val Enum: Field = Field( - SortedArray(Any), - Namespace.Shacl + "in", - ModelDoc(ExternalModelVocabularies.Shacl, "in", "Enum constraint for the values of the property mapping")) + SortedArray(Any), + Namespace.Shacl + "in", + ModelDoc(ExternalModelVocabularies.Shacl, "in", "Enum constraint for the values of the property mapping") + ) val Unique: Field = Field( - Bool, - Namespace.Meta + "unique", - ModelDoc(ModelVocabularies.Meta, - "unique", - "Marks the values for the property mapping as a primary key for this type of node") + Bool, + Namespace.Meta + "unique", + ModelDoc( + ModelVocabularies.Meta, + "unique", + "Marks the values for the property mapping as a primary key for this type of node" + ) ) val ExternallyLinkable: Field = Field( - Bool, - Namespace.Meta + "externallyLinkable", - ModelDoc(ModelVocabularies.Meta, "linkable", "Marks this object property as supporting external links") + Bool, + Namespace.Meta + "externallyLinkable", + ModelDoc(ModelVocabularies.Meta, "linkable", "Marks this object property as supporting external links") + ) + + val Mandatory: Field = Field( + Bool, + Namespace.Shacl + "mandatory", + ModelDoc( + ExternalModelVocabularies.Shacl, + "mandatory", + "Mandatory constraint over the property. Different from minCount because it only checks the presence of property" + ) + ) + + val MapKeyProperty: Field = Field( + Str, + Namespace.Meta + "mapProperty", + ModelDoc( + ModelVocabularies.Meta, + "mapLabelProperty", + "Marks the mapping as a 'map' mapping syntax. Directly related with mapTermKeyProperty" + ) ) + val MapValueProperty: Field = Field( + Str, + Namespace.Meta + "mapValueProperty", + ModelDoc( + ModelVocabularies.Meta, + "mapLabelValueProperty", + "Marks the mapping as a 'map value' mapping syntax. Directly related with mapTermValueProperty" + ) + ) + + val MapTermKeyProperty: Field = Field( + Iri, + Namespace.Meta + "mapTermProperty", + ModelDoc(ModelVocabularies.Meta, "mapTermPropertyUri", "Marks the mapping as a 'map' mapping syntax. ") + ) + + val MapTermValueProperty: Field = Field( + Iri, + Namespace.Meta + "mapTermValueProperty", + ModelDoc(ModelVocabularies.Meta, "mapTermValueProperty", "Marks the mapping as a 'map value' mapping syntax") + ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/PropertyMappingModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/PropertyMappingModel.scala index e7d1a843..c6ae76b2 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/PropertyMappingModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/PropertyMappingModel.scala @@ -1,11 +1,10 @@ package amf.aml.internal.metamodel.domain -import amf.core.internal.metamodel.Field -import amf.core.internal.metamodel.Type.{Any, Bool, Double, Int, Iri, SortedArray, Str} -import amf.core.internal.metamodel.domain.{DomainElementModel, ExternalModelVocabularies, ModelDoc, ModelVocabularies} +import amf.aml.client.scala.model.domain.PropertyMapping import amf.core.client.scala.model.domain.AmfObject import amf.core.client.scala.vocabulary.{Namespace, ValueType} -import amf.aml.client.scala.model.domain.PropertyMapping +import amf.core.internal.metamodel.Field +import amf.core.internal.metamodel.domain.{DomainElementModel, ModelDoc, ModelVocabularies, ShapeModel} object PropertyMappingModel extends DomainElementModel @@ -13,47 +12,20 @@ object PropertyMappingModel with MergeableMappingModel with NodeWithDiscriminatorModel { - val MapKeyProperty: Field = Field( - Str, - Namespace.Meta + "mapProperty", - ModelDoc(ModelVocabularies.Meta, - "mapLabelProperty", - "Marks the mapping as a 'map' mapping syntax. Directly related with mapTermKeyProperty") - ) - - val MapValueProperty: Field = Field( - Str, - Namespace.Meta + "mapValueProperty", - ModelDoc(ModelVocabularies.Meta, - "mapLabelValueProperty", - "Marks the mapping as a 'map value' mapping syntax. Directly related with mapTermValueProperty") - ) - - val MapTermKeyProperty: Field = Field( - Iri, - Namespace.Meta + "mapTermProperty", - ModelDoc(ModelVocabularies.Meta, "mapTermPropertyUri", "Marks the mapping as a 'map' mapping syntax. ")) - - val MapTermValueProperty: Field = Field( - Iri, - Namespace.Meta + "mapTermValueProperty", - ModelDoc(ModelVocabularies.Meta, "mapTermValueProperty", "Marks the mapping as a 'map value' mapping syntax") - ) - override def fields: List[Field] = NodePropertyMapping :: Name :: LiteralRange :: ObjectRange :: MapKeyProperty :: MapValueProperty :: MapTermKeyProperty :: MapTermValueProperty :: MinCount :: Pattern :: Minimum :: Maximum :: AllowMultiple :: Sorted :: Enum :: TypeDiscriminator :: - Unique :: ExternallyLinkable :: TypeDiscriminatorName :: MergePolicy :: DomainElementModel.fields + Unique :: ExternallyLinkable :: Mandatory :: TypeDiscriminatorName :: MergePolicy :: ShapeModel.Default :: DomainElementModel.fields override def modelInstance: AmfObject = PropertyMapping() - override val `type` - : List[ValueType] = Namespace.Meta + "NodePropertyMapping" :: /* Namespace.Shacl + "PropertyShape" :: */ DomainElementModel.`type` + override val `type`: List[ValueType] = + Namespace.Meta + "NodePropertyMapping" :: /* Namespace.Shacl + "PropertyShape" :: */ DomainElementModel.`type` override val doc: ModelDoc = ModelDoc( - ModelVocabularies.Meta, - "NodePropertyMapping", - "Semantic mapping from an input AST in a dialect document to the output graph of information for a class of output node" + ModelVocabularies.Meta, + "NodePropertyMapping", + "Semantic mapping from an input AST in a dialect document to the output graph of information for a class of output node" ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/PropertyTermModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/PropertyTermModel.scala index 9b83b355..b268abbc 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/PropertyTermModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/PropertyTermModel.scala @@ -10,24 +10,28 @@ abstract class PropertyTermModel extends DomainElementModel { Field(Str, Namespace.Core + "name", ModelDoc(ModelVocabularies.Core, "name", "Name of the property term")) val DisplayName: Field = Field( - Str, - Namespace.Core + "displayName", - ModelDoc(ModelVocabularies.Core, "displayName", "Human readable name for the property term")) + Str, + Namespace.Core + "displayName", + ModelDoc(ModelVocabularies.Core, "displayName", "Human readable name for the property term") + ) val Description: Field = Field( - Str, - Namespace.Core + "description", - ModelDoc(ModelVocabularies.Core, "description", "Human readable description of the property term")) + Str, + Namespace.Core + "description", + ModelDoc(ModelVocabularies.Core, "description", "Human readable description of the property term") + ) val Range: Field = Field( - Iri, - Namespace.Rdfs + "range", - ModelDoc(ExternalModelVocabularies.Rdfs, "range", "Range of the proeprty term, scalar or object")) + Iri, + Namespace.Rdfs + "range", + ModelDoc(ExternalModelVocabularies.Rdfs, "range", "Range of the proeprty term, scalar or object") + ) val SubPropertyOf: Field = Field( - Array(Iri), - Namespace.Rdfs + "subPropertyOf", - ModelDoc(ExternalModelVocabularies.Rdfs, "subPropertyOf", "Subsumption relationship for terms")) + Array(Iri), + Namespace.Rdfs + "subPropertyOf", + ModelDoc(ExternalModelVocabularies.Rdfs, "subPropertyOf", "Subsumption relationship for terms") + ) override def fields: List[Field] = DisplayName :: Description :: Range :: SubPropertyOf :: DomainElementModel.fields } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/PublicNodeMappingModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/PublicNodeMappingModel.scala index 5fb5f81e..997dc0c9 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/PublicNodeMappingModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/PublicNodeMappingModel.scala @@ -13,9 +13,10 @@ object PublicNodeMappingModel extends DomainElementModel { Field(Str, Namespace.Core + "name", ModelDoc(ModelVocabularies.Core, "name", "Name of the mapping")) val MappedNode: Field = Field( - Iri, - Namespace.Meta + "mappedNode", - ModelDoc(ModelVocabularies.Meta, "mappedNode", "Node in the dialect definition associated to this mapping")) + Iri, + Namespace.Meta + "mappedNode", + ModelDoc(ModelVocabularies.Meta, "mappedNode", "Node in the dialect definition associated to this mapping") + ) override def fields: List[Field] = Name :: MappedNode :: DomainElementModel.fields @@ -24,8 +25,8 @@ object PublicNodeMappingModel extends DomainElementModel { override val `type`: List[ValueType] = Namespace.Meta + "PublicNodeMapping" :: DomainElementModel.`type` override val doc: ModelDoc = ModelDoc( - ModelVocabularies.Meta, - "PublicNodeMapping", - "Mapping for a graph node mapping to a particular function in a dialect" + ModelVocabularies.Meta, + "PublicNodeMapping", + "Mapping for a graph node mapping to a particular function in a dialect" ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/SemanticExtensionModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/SemanticExtensionModel.scala index df3e2ff4..b995a59a 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/SemanticExtensionModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/SemanticExtensionModel.scala @@ -6,29 +6,27 @@ import amf.core.internal.metamodel.domain.{DomainElementModel, ModelDoc, ModelVo import amf.core.client.scala.vocabulary.{Namespace, ValueType} import amf.aml.client.scala.model.domain.SemanticExtension -/** - * Defines a the relation extension name -> extension mapping to be applied to target documents. An extension is defined - * with an annotation mapping. Whenever we encounter an annotation in the target document (e.g. RAML API) we check if - * the name of the annotation matches the ExtensionName fields value and if it does, we parse the value of such annotation - * using the range of the ExtensionMappingDefinition. - * e.g. - * /myEndpoint: - * (extension-name): extension-range (derived from extension mapping definition) +/** Defines a the relation extension name -> extension mapping to be applied to target documents. An extension is + * defined with an annotation mapping. Whenever we encounter an annotation in the target document (e.g. RAML API) we + * check if the name of the annotation matches the ExtensionName fields value and if it does, we parse the value of + * such annotation using the range of the ExtensionMappingDefinition. e.g. /myEndpoint: (extension-name): + * extension-range (derived from extension mapping definition) */ object SemanticExtensionModel extends DomainElementModel { val ExtensionName: Field = Field( - Str, - Namespace.Core + "name", - ModelDoc(ModelVocabularies.Core, "name", "Name that identifies an extension in the target document")) + Str, + Namespace.Core + "name", + ModelDoc(ModelVocabularies.Core, "name", "Name that identifies an extension in the target document") + ) val ExtensionMappingDefinition: Field = Field( - Iri, - Namespace.Meta + "extensionMappingDefinition", - ModelDoc( - ModelVocabularies.Meta, - "extensionMappingDefinition", - "Extension mapping (annotation mapping) definition used to parse a certain extension identified with the ExtensionName" - ) + Iri, + Namespace.Meta + "extensionMappingDefinition", + ModelDoc( + ModelVocabularies.Meta, + "extensionMappingDefinition", + "Extension mapping (annotation mapping) definition used to parse a certain extension identified with the ExtensionName" + ) ) override def fields: List[Field] = ExtensionName :: ExtensionMappingDefinition :: DomainElementModel.fields @@ -38,8 +36,8 @@ object SemanticExtensionModel extends DomainElementModel { override val `type`: List[ValueType] = Namespace.Meta + "ExtensionMapping" :: DomainElementModel.`type` override val doc: ModelDoc = ModelDoc( - ModelVocabularies.Meta, - "SemanticExtension", - "Mapping a particular extension name to an extension definition" + ModelVocabularies.Meta, + "SemanticExtension", + "Mapping a particular extension name to an extension definition" ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/UnionNodeMappingModel.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/UnionNodeMappingModel.scala index 445e4b81..d6824921 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/UnionNodeMappingModel.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/metamodel/domain/UnionNodeMappingModel.scala @@ -1,23 +1,18 @@ package amf.aml.internal.metamodel.domain -import amf.core.internal.metamodel.Field -import amf.core.internal.metamodel.Type.{Iri, SortedArray} -import amf.core.internal.metamodel.domain._ + +import amf.aml.client.scala.model.domain.UnionNodeMapping import amf.core.client.scala.model.domain.AmfObject import amf.core.client.scala.vocabulary.{Namespace, ValueType} -import amf.aml.client.scala.model.domain.UnionNodeMapping +import amf.core.internal.metamodel.Field +import amf.core.internal.metamodel.domain._ -object UnionNodeMappingModel - extends DomainElementModel - with LinkableElementModel - with MergeableMappingModel - with NodeWithDiscriminatorModel - with NodeMappableModel { +object UnionNodeMappingModel extends AnyMappingModel with NodeWithDiscriminatorModel { - override val fields - : List[Field] = Name :: TypeDiscriminator :: TypeDiscriminatorName :: ObjectRange :: LinkableElementModel.fields ++ DomainElementModel.fields + override val fields: List[Field] = + Name :: TypeDiscriminator :: TypeDiscriminatorName :: ObjectRange :: LinkableElementModel.fields ++ DomainElementModel.fields ++ AnyMappingModel.fields - override val `type` - : List[ValueType] = Namespace.Meta + "UnionNodeMapping" :: Namespace.Shacl + "Shape" :: DomainElementModel.`type` + override val `type`: List[ValueType] = + Namespace.Meta + "UnionNodeMapping" :: Namespace.Shacl + "Shape" :: DomainElementModel.`type` override def modelInstance: AmfObject = UnionNodeMapping() } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/namespace/AMLDialectNamespaceAliasesPlugin.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/namespace/AMLDialectNamespaceAliasesPlugin.scala deleted file mode 100644 index 0417fe1d..00000000 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/namespace/AMLDialectNamespaceAliasesPlugin.scala +++ /dev/null @@ -1,54 +0,0 @@ -package amf.aml.internal.namespace - -import amf.core.client.common.{NormalPriority, PluginPriority} -import amf.core.internal.annotations.{Aliases, ReferencedInfo} -import amf.core.internal.annotations.Aliases.Alias -import amf.core.client.scala.model.document.BaseUnit -import amf.core.client.scala.vocabulary.{Namespace, NamespaceAliases} -import amf.core.internal.plugins.namespace.NamespaceAliasesPlugin -import amf.aml.client.scala.model.document.{Dialect, DialectInstanceUnit} -import com.github.ghik.silencer.silent - -case class AMLDialectNamespaceAliasesPlugin private (dialect: Dialect, aliases: NamespaceAliases) - extends NamespaceAliasesPlugin { - - override def applies(element: BaseUnit): Boolean = element match { - case instance: DialectInstanceUnit => - @silent("deprecated") // Silent can only be used in assignment expressions - val a = instance.processingData.definedBy().option().orElse(instance.definedBy().option()).contains(dialect.id) - a - case currentDialect: Dialect => currentDialect.id == dialect.id - case _ => false - } - - override def aliases(_unit: BaseUnit): NamespaceAliases = aliases - - override val id: String = s"${dialect.nameAndVersion()}/dialect-namespace-generation-plugin" - - override def priority: PluginPriority = NormalPriority -} - -object AMLDialectNamespaceAliasesPlugin { - def forDialect(dialect: Dialect): Option[AMLDialectNamespaceAliasesPlugin] = { - - val externalAliases: Seq[(String, Namespace)] = dialect.externals.map { external => - external.alias.value() -> Namespace(external.base.value()) - } - - val annotAliases: Seq[(Alias, Namespace)] = dialect.annotations - .find(classOf[Aliases]) - .map { aliasesAnnotation => - aliasesAnnotation.aliases.toList.map { - case (alias, ReferencedInfo(_, url, _)) => alias -> Namespace(url) - } - } - .getOrElse(Nil) - val allAliases = externalAliases ++ annotAliases - if (allAliases.nonEmpty) - Some( - AMLDialectNamespaceAliasesPlugin( - dialect, - NamespaceAliases.withCustomAliases((externalAliases ++ annotAliases).toMap))) - else None - } -} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/namespace/DialectNamespaceAliases.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/namespace/DialectNamespaceAliases.scala new file mode 100644 index 00000000..776c791d --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/namespace/DialectNamespaceAliases.scala @@ -0,0 +1,25 @@ +package amf.aml.internal.namespace + +import amf.aml.client.scala.model.document.Dialect +import amf.core.client.scala.vocabulary.{Namespace, NamespaceAliases} +import amf.core.internal.annotations.{Aliases, ReferencedInfo} +import amf.core.internal.annotations.Aliases.Alias + +object DialectNamespaceAliases { + def apply(dialect: Dialect): NamespaceAliases = { + val externalAliases: Seq[(String, Namespace)] = dialect.externals.map { external => + external.alias.value() -> Namespace(external.base.value()) + } + + val annotAliases: Seq[(Alias, Namespace)] = dialect.annotations + .find(classOf[Aliases]) + .map { aliasesAnnotation => + aliasesAnnotation.aliases.toList.map { case (alias, ReferencedInfo(_, url, _)) => + alias -> Namespace(url) + } + } + .getOrElse(Nil) + + NamespaceAliases((externalAliases ++ annotAliases).toMap) + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/DynamicExtensionParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/DynamicExtensionParser.scala index 078e7cca..4880c03e 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/DynamicExtensionParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/DynamicExtensionParser.scala @@ -18,13 +18,14 @@ import org.yaml.model._ import scala.collection.mutable.ListBuffer -/** - * Parse an object as a fully dynamic value. +/** Parse an object as a fully dynamic value. */ -case class DynamicExtensionParser(node: YNode, - parent: Option[String] = None, - idCounter: IdCounter = new IdCounter, - aliasCounter: AliasCounter = AliasCounter())(implicit ctx: ParserContext) { +case class DynamicExtensionParser( + node: YNode, + parent: Option[String] = None, + idCounter: IdCounter = new IdCounter, + aliasCounter: AliasCounter = AliasCounter() +)(implicit ctx: ParserContext) { def parseTimestamp(node: YNode): (Seq[String], Seq[String]) = { val text = node.as[YScalar].text.toLowerCase() @@ -49,9 +50,9 @@ case class DynamicExtensionParser(node: YNode, def parse(): DataNode = { if (aliasCounter.exceedsThreshold(node)) { ctx.violation( - CoreValidations.SyamlError, - parent.getOrElse(""), - "Exceeded maximum yaml references threshold" + CoreValidations.SyamlError, + parent.getOrElse(""), + "Exceeded maximum yaml references threshold" ) DataObjectNode() } else { @@ -83,7 +84,13 @@ case class DynamicExtensionParser(node: YNode, case other => val parsed = parseScalar(YScalar(other.toString()), "string") - ctx.eh.violation(DialectError, parsed.id, None, s"Cannot parse data node from AST structure '$other'", node.location) + ctx.eh.violation( + DialectError, + parsed.id, + None, + s"Cannot parse data node from AST structure '$other'", + node.location + ) parsed } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/common/AnnotationsParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/common/AnnotationsParser.scala index 6c8e3b93..7cab67e6 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/common/AnnotationsParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/common/AnnotationsParser.scala @@ -3,8 +3,9 @@ package amf.aml.internal.parse.common import amf.aml.internal.parse.DynamicExtensionParser import amf.aml.internal.parse.instances.DialectInstanceContext import amf.aml.internal.parse.vocabularies.VocabularyDeclarations +import amf.aml.internal.semantic.SemanticExtensionsFacade import amf.aml.internal.validate.DialectValidations.MissingVocabulary -import amf.core.client.scala.model.domain.{AmfObject, DomainElement} +import amf.core.client.scala.model.domain.AmfObject import amf.core.client.scala.model.domain.extensions.{CustomDomainProperty, DomainExtension} import amf.core.client.scala.parse.document.ParserContext import amf.core.internal.metamodel.domain.DomainElementModel.CustomDomainProperties @@ -18,37 +19,42 @@ import scala.util.{Failure, Success} object AnnotationsParser { - def parseAnnotations(ast: YMap, node: AmfObject, declarations: VocabularyDeclarations)( - implicit ctx: ParserContext): Any = { + def parseAnnotations(ast: YMap, node: AmfObject, declarations: VocabularyDeclarations)(implicit + ctx: ParserContext + ): Any = { computeAnnotationInfo(ast) flatMap { ai => - computeSemanticExtensionParser(ctx) + computeSemanticExtensionParser(ctx, ai.key) .flatMap { parser => - val id = node.id + s"${ai.prefix.map(_ + "/").getOrElse("/")}${ai.suffix}" + val id = node.id + annotationInfoId(ai) val types = node.meta.`type`.map(_.iri()) - parser.parse(ai.key, types, ai.entry, ctx, id) + parser.parse(types, ai.entry, ctx, id) } .orElse(parseRegularAnnotation(node, declarations, ctx, ai)) .map(extension => node.add(CustomDomainProperties, extension)) } } - private def computeSemanticExtensionParser(ctx: ParserContext) = { + private def annotationInfoId(ai: AnnotationInfo): String = s"${ai.prefix.map(_ + "/").getOrElse("/")}${ai.suffix}" + + private def computeSemanticExtensionParser(ctx: ParserContext, key: String): Option[SemanticExtensionsFacade] = { ctx match { - case diCtx: DialectInstanceContext => Some(diCtx.extensionsFacade) + case diCtx: DialectInstanceContext => Some(diCtx.extensionsFacadeBuilder.extensionName(key)) case _ => None } } - private def parseRegularAnnotation(node: AmfObject, - declarations: VocabularyDeclarations, - ctx: ParserContext, - ai: AnnotationInfo): Option[DomainExtension] = { + private def parseRegularAnnotation( + node: AmfObject, + declarations: VocabularyDeclarations, + ctx: ParserContext, + ai: AnnotationInfo + ): Option[DomainExtension] = { val value = ai.entry.value val key = ai.originalKey declarations.resolveExternalNamespace(ai.prefix, ai.suffix) match { case Success(propertyId) => - val id = node.id + s"${ai.prefix.map(_ + "/").getOrElse("/")}$ai.suffix" + val id = node.id + annotationInfoId(ai) val parsedAnnotation = DynamicExtensionParser(value, Some(id))(ctx).parse() val property = CustomDomainProperty(Annotations(value)).withId(propertyId).withName(key, Annotations()) val extension = DomainExtension() @@ -61,11 +67,11 @@ object AnnotationsParser { case Failure(ex) => declarations.usedVocabs.get(ai.prefix.getOrElse("")) match { case Some(vocabulary) => - val id = node.id + (if (node.id.endsWith("/") || node.id.endsWith("#")) "" else "/") + s"${ai.prefix.map(_ + "/").getOrElse("/")}$ai.suffix" + val id = node.id + (if (node.id.endsWith("/") || node.id.endsWith("#")) "" else "/") + annotationInfoId(ai) val parsedAnnotation = DynamicExtensionParser(value, Some(id))(ctx).parse() val base = vocabulary.base.value() - val propertyId = if (base.endsWith("#") || base.endsWith("/")) base + ai.suffix else base + "/" + ai.suffix - val property = CustomDomainProperty(Annotations(value)).withId(propertyId).withName(ai.key) + val propertyId = if (base.endsWith("#") || base.endsWith("/")) base + ai.suffix else base + "/" + ai.suffix + val property = CustomDomainProperty(Annotations(value)).withId(propertyId).withName(ai.key) val extension = DomainExtension() .withId(id) .set(DomainExtensionModel.Extension, parsedAnnotation, Annotations.inferred()) @@ -80,7 +86,7 @@ object AnnotationsParser { } } - def computeAnnotationInfo(ast: YMap): Seq[AnnotationInfo] = ast.entries.flatMap { entry: YMapEntry => + private def computeAnnotationInfo(ast: YMap): Seq[AnnotationInfo] = ast.entries.flatMap { entry: YMapEntry => val key: String = entry.key.as[String] val maybeBS: Option[BaseAndSeparator] = getKeyName(key) maybeBS.map { bs => @@ -107,6 +113,11 @@ object AnnotationsParser { private case class BaseAndSeparator(base: String, separator: String) private case class PrefixAndSuffix(prefix: Option[String], suffix: String) - case class AnnotationInfo(originalKey: String, key: String, prefix: Option[String], suffix: String, entry: YMapEntry) - + private case class AnnotationInfo( + originalKey: String, + key: String, + prefix: Option[String], + suffix: String, + entry: YMapEntry + ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/common/SemanticExtensionParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/common/SemanticExtensionParser.scala deleted file mode 100644 index bf692085..00000000 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/common/SemanticExtensionParser.scala +++ /dev/null @@ -1,7 +0,0 @@ -package amf.aml.internal.parse.common - -import amf.aml.client.scala.AMLConfiguration -import amf.aml.client.scala.model.domain.DialectDomainElement -import amf.aml.internal.parse.instances.DialectInstanceParser - -class SemanticExtensionParser(config: AMLConfiguration) {} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/common/SyntaxErrorReporter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/common/SyntaxErrorReporter.scala index c92a1a82..9719a898 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/common/SyntaxErrorReporter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/common/SyntaxErrorReporter.scala @@ -1,14 +1,13 @@ package amf.aml.internal.parse.common +import amf.aml.client.scala.model.domain.PropertyLikeMapping +import amf.aml.internal.metamodel.domain.PropertyMappingModel +import amf.aml.internal.validate.DialectValidations._ import amf.core.client.scala.parse.document.ParserContext import amf.core.internal.annotations.{LexicalInformation, SourceLocation} import amf.core.internal.parser.domain.Annotations import amf.core.internal.utils.AmfStrings -import amf.aml.internal.metamodel.domain.PropertyMappingModel -import amf.aml.client.scala.model.domain.{PropertyLikeMapping, PropertyMapping} -import amf.aml.internal.validate.DialectValidations._ import org.yaml.model.{YNode, YPart} -import amf.core.client.common.position.Range trait SyntaxErrorReporter { this: ParserContext => @@ -34,68 +33,70 @@ trait SyntaxErrorReporter { this: ParserContext => def missingPropertyRangeViolation(term: String, node: String, annotations: Annotations): Unit = { eh.violation( - MissingPropertyRangeSpecification, - node, - Some(PropertyMappingModel.ObjectRange.value.iri()), - s"Cannot find property range term $term", - annotations.find(classOf[LexicalInformation]), - annotations.find(classOf[SourceLocation]).map(_.location) + MissingPropertyRangeSpecification, + node, + Some(PropertyMappingModel.ObjectRange.value.iri()), + s"Cannot find property range term $term", + annotations.find(classOf[LexicalInformation]), + annotations.find(classOf[SourceLocation]).map(_.location) ) } def missingPropertyKeyViolation(node: String, field: String, label: String, annotations: Annotations): Unit = { eh.violation( - MissingPropertyRangeSpecification, - node, - Some(field), - s"Cannot find property $label in mapping range", - annotations.find(classOf[LexicalInformation]), - annotations.find(classOf[SourceLocation]).map(_.location) + MissingPropertyRangeSpecification, + node, + Some(field), + s"Cannot find property $label in mapping range", + annotations.find(classOf[LexicalInformation]), + annotations.find(classOf[SourceLocation]).map(_.location) ) } def differentTermsInMapKey(node: String, field: String, label: String, annotations: Annotations): Unit = { eh.violation( - DifferentTermsInMapKey, - node, - Some(field), - s"Cannot find property $label in mapping range", - annotations.find(classOf[LexicalInformation]), - annotations.find(classOf[SourceLocation]).map(_.location) + DifferentTermsInMapKey, + node, + Some(field), + s"Cannot find property $label in mapping range", + annotations.find(classOf[LexicalInformation]), + annotations.find(classOf[SourceLocation]).map(_.location) ) } - def inconsistentPropertyRangeValueViolation(node: String, - property: PropertyLikeMapping[_], - expected: String, - found: String, - valueNode: YNode): Unit = { + def inconsistentPropertyRangeValueViolation( + node: String, + property: PropertyLikeMapping[_], + expected: String, + found: String, + valueNode: YNode + ): Unit = { eh.violation( - InconsistentPropertyRangeValueSpecification, - node, - Some(property.nodePropertyMapping().value()), - s"Cannot find expected range for property ${property.nodePropertyMapping().value()} (${property.name().value()}). Found '$found', expected '$expected'", - Some(new LexicalInformation(Range(valueNode.range))), - valueNode.sourceName.option + InconsistentPropertyRangeValueSpecification, + node, + Some(property.nodePropertyMapping().value()), + s"Cannot find expected range for property ${property.nodePropertyMapping().value()} (${property.name().value()}). Found '$found', expected '$expected'", + Some(new LexicalInformation(valueNode.range)), + valueNode.sourceName.option ) } def closedNodeViolation(id: String, property: String, nodeType: String, ast: YPart): Unit = { eh.violation( - ClosedShapeSpecification, - id, - s"Property: '$property' not supported in a $nodeType node", - ast.location + ClosedShapeSpecification, + id, + s"Property: '$property' not supported in a $nodeType node", + ast.location ) } def missingPropertyViolation(id: String, property: String, nodeType: String, ast: YPart): Unit = { eh.violation( - MissingPropertySpecification, - id, - s"Property: '$property' mandatory in a $nodeType node", - ast.location + MissingPropertySpecification, + id, + s"Property: '$property' mandatory in a $nodeType node", + ast.location ) } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/common/SyntaxExtensionsReferenceHandler.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/common/SyntaxExtensionsReferenceHandler.scala index e5ebc0a0..bc78145a 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/common/SyntaxExtensionsReferenceHandler.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/common/SyntaxExtensionsReferenceHandler.scala @@ -15,8 +15,8 @@ class SyntaxExtensionsReferenceHandler(errorHandler: AMFErrorHandler) extends Re implicit val eh: SYamlAMFParserErrorHandler = new SYamlAMFParserErrorHandler(errorHandler) override def collect(parsedDoc: ParsedDocument, ctx: ParserContext): CompilerReferenceCollector = { - val dialects = ctx.config.sortedParsePlugins.collect { - case plugin: AMLDialectInstanceParsingPlugin => plugin.dialect.nameAndVersion() + val dialects = ctx.config.sortedRootParsePlugins.collect { case plugin: AMLDialectInstanceParsingPlugin => + plugin.dialect.nameAndVersion() } collect(parsedDoc, dialects) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectContext.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectContext.scala index 7003a232..b2447060 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectContext.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectContext.scala @@ -4,16 +4,22 @@ import amf.core.client.scala.model.document.RecursiveUnit import amf.core.client.scala.parse.document.{ParserContext, SyamlBasedParserErrorHandler} import amf.core.internal.utils.QName import amf.aml.internal.parse.common.{DeclarationContext, SyntaxErrorReporter} +import amf.core.client.scala.model.domain.extensions.CustomDomainProperty +import amf.core.internal.datanode.DataNodeParserContext +import amf.core.internal.parser.domain.{FragmentRef, SearchScope} import amf.core.internal.plugins.syntax.SYamlAMFParserErrorHandler class DialectContext(private val wrapped: ParserContext, private val ds: Option[DialectDeclarations] = None) - extends SyamlBasedParserErrorHandler(wrapped.rootContextDocument, - wrapped.refs, - wrapped.futureDeclarations, - wrapped.config) + extends SyamlBasedParserErrorHandler( + wrapped.rootContextDocument, + wrapped.refs, + wrapped.futureDeclarations, + wrapped.config + ) with DialectSyntax with DeclarationContext - with SyntaxErrorReporter { + with SyntaxErrorReporter + with DataNodeParserContext { def findInRecursiveUnits(key: String): Option[String] = { val qname = QName(key) @@ -34,4 +40,8 @@ class DialectContext(private val wrapped: ParserContext, private val ds: Option[ override val declarations: DialectDeclarations = ds.getOrElse(new DialectDeclarations(errorHandler = eh, futureDeclarations = futureDeclarations)) + override def findAnnotation(key: String, scope: SearchScope.Scope): Option[CustomDomainProperty] = None + override def getMaxYamlReferences: _root_.scala.Option[Int] = wrapped.config.parsingOptions.maxYamlReferences + override def getMaxYamlJsonDepth: _root_.scala.Option[Int] = wrapped.config.parsingOptions.maxJsonYamlDepth + override def fragments: Map[String, FragmentRef] = Map.empty } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectDeclarations.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectDeclarations.scala index ab14daca..1bcf4214 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectDeclarations.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectDeclarations.scala @@ -2,20 +2,20 @@ package amf.aml.internal.parse.dialects import amf.core.internal.annotations.{ErrorDeclaration => DeclaredErrorDeclaration} import amf.core.client.scala.errorhandling.AMFErrorHandler -import amf.core.internal.parser.domain.SearchScope +import amf.core.internal.parser.domain.{Annotations, Declarations, Fields, FutureDeclarations, SearchScope} import amf.core.client.scala.model.domain.DomainElement import amf.core.client.scala.parse.document.EmptyFutureDeclarations -import amf.core.internal.parser.domain.{Annotations, Fields, FutureDeclarations, SearchScope} import amf.aml.internal.metamodel.domain.{AnnotationMappingModel, NodeMappingModel} import amf.aml.client.scala.model.domain._ import amf.aml.internal.parse.vocabularies.VocabularyDeclarations import org.yaml.model.YPart -class DialectDeclarations(var nodeMappings: Map[String, NodeMappable[_]] = Map(), - var annotationMappings: Map[String, AnnotationMapping] = Map(), - errorHandler: AMFErrorHandler, - futureDeclarations: FutureDeclarations) - extends VocabularyDeclarations(Map(), Map(), Map(), Map(), Map(), errorHandler, futureDeclarations) { +class DialectDeclarations( + var nodeMappings: Map[String, NodeMappable[_]] = Map(), + var annotationMappings: Map[String, AnnotationMapping] = Map(), + errorHandler: AMFErrorHandler, + futureDeclarations: FutureDeclarations +) extends VocabularyDeclarations(Map(), Map(), Map(), Map(), Map(), errorHandler, futureDeclarations) { type NodeMappable = NodeMappable.AnyNodeMappable @@ -49,10 +49,11 @@ class DialectDeclarations(var nodeMappings: Map[String, NodeMappable[_]] = Map() this } - def findNodeMapping(key: String, scope: SearchScope.Scope): Option[NodeMappable] = - findForType(key, _.asInstanceOf[DialectDeclarations].nodeMappings, scope) collect { - case nm: NodeMappable => nm + def findNodeMapping(key: String, scope: SearchScope.Scope): Option[NodeMappable] = { + findForType(key, _.asInstanceOf[DialectDeclarations].nodeMappings, scope) collect { case nm: NodeMappable => + nm } + } def findAnnotationMapping(key: String, scope: SearchScope.Scope): Option[AnnotationMapping] = findForType(key, _.asInstanceOf[DialectDeclarations].annotationMappings, scope) collect { diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectDeclaresParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectDeclaresParser.scala index 7f83d50b..35b3637e 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectDeclaresParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectDeclaresParser.scala @@ -21,9 +21,11 @@ case class DialectDeclaresParser(into: DocumentMapping)(override implicit val ct .set(PublicNodeMappingModel.Name, declarationName, Annotations(declarationEntry.key)) .withId(into.id + "/declaration/" + declarationName.toString.urlComponentEncoded) val nodeMapping = ctx.declarations.findNodeMappingOrError(entry.value)(declarationId, SearchScope.All) - declarationMapping.set(PublicNodeMappingModel.MappedNode, - AmfScalar(nodeMapping.id, Annotations(declarationEntry.value)), - Annotations(declarationEntry.value)) + declarationMapping.set( + PublicNodeMappingModel.MappedNode, + AmfScalar(nodeMapping.id, Annotations(declarationEntry.value)), + Annotations(declarationEntry.value) + ) } into.set(DocumentMappingModel.DeclaredNodes, AmfArray(declarations, Annotations(entry.value)), Annotations(entry)) diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectFragmentParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectFragmentParser.scala index ac1317bc..d0c9012a 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectFragmentParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectFragmentParser.scala @@ -26,17 +26,21 @@ case class DialectFragmentParser(into: DocumentsModel)(override implicit val ctx .withDocumentName(fragmentName) .withId(into.id + s"/fragments/${fragmentName.urlComponentEncoded}") val nodeMapping = ctx.declarations.findNodeMappingOrError(entry.value)(nodeId, SearchScope.All) - documentsMapping.set(DocumentMappingModel.EncodedNode, - AmfScalar(nodeMapping.id, Annotations(entry.value)), - Annotations(entry)) + documentsMapping.set( + DocumentMappingModel.EncodedNode, + AmfScalar(nodeMapping.id, Annotations(entry.value)), + Annotations(entry) + ) } case _ => ctx.eh.violation(DeclarationNotFound, "", s"NodeMappable ${entry.value} not found", entry.location) val documentMapping = DocumentMapping(entry.value) val nodeMapping = ctx.declarations.ErrorNodeMappable(entry.key, entry.value) - documentMapping.set(DocumentMappingModel.EncodedNode, - AmfScalar(nodeMapping, Annotations(entry.value)), - Annotations(entry)) + documentMapping.set( + DocumentMappingModel.EncodedNode, + AmfScalar(nodeMapping, Annotations(entry.value)), + Annotations(entry) + ) Seq(documentMapping) } into.set(DocumentsModelModel.Fragments, AmfArray(docs, Annotations(entry.value)), Annotations(entry)) diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectSyntax.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectSyntax.scala index 6ca517de..08e5de36 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectSyntax.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectSyntax.scala @@ -3,81 +3,104 @@ package amf.aml.internal.parse.dialects import org.yaml.model.{IllegalTypeHandler, YMap, YNode, YScalar, YType} trait DialectSyntax { this: DialectContext => - val dialect: Map[String, Boolean] = Map( - "$dialect" -> false, - "dialect" -> true, - "version" -> true, - "usage" -> false, - "external" -> false, - "uses" -> false, - "nodeMappings" -> false, - "documents" -> false, - "annotationMappings" -> false, - "extensions" -> false + type Required = Boolean + + val dialect: Map[String, Required] = Map( + "$id" -> false, + "$type" -> false, + "dialect" -> true, + "version" -> true, + "usage" -> false, + "external" -> false, + "uses" -> false, + "nodeMappings" -> false, + "documents" -> false, + "annotationMappings" -> false, + "extensions" -> false + ) + + val library: Map[String, Required] = Map( + "$id" -> false, + "$type" -> false, + "usage" -> false, + "external" -> false, + "uses" -> false, + "nodeMappings" -> false ) - val library: Map[String, Boolean] = Map( - "usage" -> false, - "external" -> false, - "uses" -> false, - "nodeMappings" -> false + val anyMapping: Map[String, Required] = Map( + "allOf" -> false, + "oneOf" -> false, + "components" -> false ) - val nodeMapping: Map[String, Boolean] = Map( - "classTerm" -> false, - "mapping" -> false, - "idProperty" -> false, - "idTemplate" -> false, - "patch" -> false, - "extends" -> false + val nodeMapping: Map[String, Required] = anyMapping ++ Map( + "classTerm" -> false, + "mapping" -> false, + "idProperty" -> false, + "idTemplate" -> false, + "patch" -> false, + "extends" -> false, + "union" -> false, + "conditional" -> false, + "additionalProperties" -> false ) - val propertyLikeMapping = Map( - "range" -> true, - "propertyTerm" -> false, - "isLink" -> false, - "mandatory" -> false, - "pattern" -> false, - "sorted" -> false, - "minimum" -> false, - "maximum" -> false, - "allowMultiple" -> false, - "enum" -> false, - "typeDiscriminatorName" -> false, - "typeDiscriminator" -> false, - "unique" -> false + val conditionalMappingInner: Map[String, Required] = Map( + "if" -> true, + "then" -> true, + "else" -> true ) - val annotationMapping: Map[String, Boolean] = propertyLikeMapping ++ Map( - "domain" -> false + val propertyLikeMapping: Map[String, Required] = Map( + "range" -> true, + "propertyTerm" -> false, + "isLink" -> false, + "mandatory" -> false, + "pattern" -> false, + "sorted" -> false, + "minimum" -> false, + "maximum" -> false, + "allowMultiple" -> false, + "enum" -> false, + "typeDiscriminatorName" -> false, + "typeDiscriminator" -> false, + "unique" -> false, + "minItems" -> false ) - val fragment: Map[String, Boolean] = Map( - "usage" -> false, - "external" -> false, - "uses" -> false + val annotationMapping: Map[String, Required] = propertyLikeMapping ++ Map( + "domain" -> false + ) + + val fragment: Map[String, Required] = Map( + "$id" -> false, + "usage" -> false, + "external" -> false, + "uses" -> false ) ++ nodeMapping - val propertyMapping: Map[String, Boolean] = propertyLikeMapping ++ Map( - "mapKey" -> false, - "mapValue" -> false, - "mapTermKey" -> false, - "mapTermValue" -> false, - "patch" -> false + val propertyMapping: Map[String, Required] = propertyLikeMapping ++ Map( + "mapKey" -> false, + "mapValue" -> false, + "mapTermKey" -> false, + "mapTermValue" -> false, + "patch" -> false, + "default" -> false ) - val documentsMapping: Map[String, Boolean] = Map( - "root" -> false, - "fragments" -> false, - "library" -> false, - "options" -> false + val documentsMapping: Map[String, Required] = Map( + "root" -> false, + "fragments" -> false, + "library" -> false, + "options" -> false ) - val documentsMappingOptions: Map[String, Boolean] = Map( - "selfEncoded" -> false, - "declarationsPath" -> false, - "keyProperty" -> false, - "referenceStyle" -> false + val documentsMappingOptions: Map[String, Required] = Map( + "selfEncoded" -> false, + "declarationsPath" -> false, + "keyProperty" -> false, + "referenceStyle" -> false ) def closedNode(nodeType: String, id: String, map: YMap)(implicit errorHandler: IllegalTypeHandler): Unit = { @@ -86,6 +109,7 @@ trait DialectSyntax { this: DialectContext => case "library" => library case "fragment" => fragment case "nodeMapping" => nodeMapping + case "conditionalMappingInner" => conditionalMappingInner case "annotationMapping" => annotationMapping case "propertyMapping" => propertyMapping case "documentsMapping" => documentsMapping @@ -100,14 +124,13 @@ trait DialectSyntax { this: DialectContext => } } - allowedProps.foreach { - case (propName, mandatory) => - val props = map.map.keySet.map(_.as[YScalar].text) - if (mandatory) { - if (!props.contains(propName)) { - missingPropertyViolation(id, propName, nodeType, map) - } + allowedProps.foreach { case (propName, mandatory) => + val props = map.map.keySet.map(_.as[YScalar].text) + if (mandatory) { + if (!props.contains(propName)) { + missingPropertyViolation(id, propName, nodeType, map) } + } } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectsParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectsParser.scala index a47e67d7..ef6bc99e 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectsParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectsParser.scala @@ -5,19 +5,13 @@ import amf.aml.client.scala.model.domain._ import amf.aml.internal.metamodel.document.DialectModel import amf.aml.internal.metamodel.document.DialectModel.Externals import amf.aml.internal.metamodel.domain.UnionNodeMappingModel.ObjectRange -import amf.aml.internal.metamodel.domain.{MergePolicies, NodeMappingModel, PropertyMappingModel, UnionNodeMappingModel} -import amf.aml.internal.parse.common.AnnotationsParser.parseAnnotations -import amf.aml.internal.parse.common.{AnnotationsParser, DeclarationKey, DeclarationKeyCollector} +import amf.aml.internal.metamodel.domain.{NodeMappingModel, PropertyMappingModel} +import amf.aml.internal.parse.common.{DeclarationKey, DeclarationKeyCollector} import amf.aml.internal.parse.dialects.DialectAstOps._ -import amf.aml.internal.parse.dialects.property.like.{AnnotationMappingParser, PropertyLikeMappingParser} -import amf.aml.internal.parse.instances.BaseDirective -import amf.aml.internal.validate.DialectValidations -import amf.aml.internal.validate.DialectValidations.{ - DialectError, - EventualAmbiguity, - UnavoidableAmbiguity, - VariablesDefinedInBase -} +import amf.aml.internal.parse.dialects.nodemapping.like.NodeMappingLikeParser +import amf.aml.internal.parse.dialects.property.like.AnnotationMappingParser +import amf.aml.internal.validate.DialectValidations.{DialectError, EventualAmbiguity, UnavoidableAmbiguity} +import amf.core.client.scala.model.StrField import amf.core.client.scala.model.document.BaseUnit import amf.core.client.scala.model.domain.{AmfArray, AmfScalar, DomainElement} import amf.core.client.scala.parse.AMFParser @@ -32,7 +26,7 @@ import amf.core.internal.remote.Spec.AML import amf.core.internal.utils._ import org.yaml.model._ -import scala.collection.{immutable, mutable} +import scala.collection.mutable class DialectsParser(root: Root)(implicit override val ctx: DialectContext) extends BaseSpecParser @@ -40,7 +34,6 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) type NodeMappable = NodeMappable.AnyNodeMappable val map: YMap = root.parsed.asInstanceOf[SyamlParsedDocument].document.as[YMap] -// val dialect: Dialect = Dialect(Annotations(map)).withLocation(root.location).withId(id()).withProcessingData(BaseUnitProcessingData()) val dialect: Dialect = { val computedId = id() val dialect = Dialect(Annotations(map)).withLocation(root.location).withId(computedId) @@ -50,40 +43,62 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) // Need to do this before parsing so every ID set during parsing is relative to this ID private def id(): String = { - root.location match { - case AMFParser.DEFAULT_DOCUMENT_URL => - val nameAndVersionId = for { - dialectEntry <- map.key("dialect") - versionEntry <- map.key("version") - } yield { - val dialect = dialectEntry.value.toString.toLowerCase.noSpaces - val version = versionEntry.value.toString.toLowerCase.noSpaces - s"${AMFParser.DEFAULT_DOCUMENT_URL}/$dialect/$version" + map.key("$id") match { + case Some(entry) => + entry.value.tagType match { + case YType.Str => entry.value.toString + case t => + val defaultId = defaultDialectId() + ctx.eh + .violation( + DialectError, + defaultId, + s"Invalid type $t for $$id directive. Expected ${YType.Str}", + entry.value.location + ) + defaultId } + case None => + root.location match { + case AMFParser.DEFAULT_DOCUMENT_URL => defaultDialectId() + case location => location + } + } + } - nameAndVersionId - .getOrElse(AMFParser.DEFAULT_DOCUMENT_URL) // Name and version will always be defined otherwise dialect is invalid - case other => other + private def defaultDialectId(): String = { + val nameAndVersionId = for { + dialectEntry <- map.key("dialect") + versionEntry <- map.key("version") + } yield { + val dialect = dialectEntry.value.toString.toLowerCase.noSpaces + val version = versionEntry.value.toString.toLowerCase.noSpaces + s"${AMFParser.DEFAULT_DOCUMENT_URL}/$dialect/$version" } + + nameAndVersionId + .getOrElse(AMFParser.DEFAULT_DOCUMENT_URL) // Name and version will always be defined otherwise dialect is invalid } def parseSemanticExtensions(map: YMap): Unit = { map.key("extensions").foreach { extensionsEntry => extensionsEntry.value.tagType match { case YType.Map => - Some { - val entries = extensionsEntry.value.as[YMap].entries - val semanticExtensions = - entries.flatMap(e => SemanticExtensionParser(e, s"${dialect.id}/semantic-extensions").parse()) - if (semanticExtensions.nonEmpty) { - dialect.setArrayWithoutId(DialectModel.Extensions, semanticExtensions, Annotations(extensionsEntry)) - } - } + val entries = extensionsEntry.value.as[YMap].entries + val semanticExtensions = + entries.map(e => SemanticExtensionParser(e, s"${dialect.id}/semantic-extensions").parse()) + dialect.setArrayWithoutId( + DialectModel.Extensions, + semanticExtensions, + Annotations(extensionsEntry) ++= Annotations.virtual() + ) case t => - ctx.eh.violation(DialectError, - dialect.id, - s"Invalid type $t for 'extensions' node. Expected map", - extensionsEntry.value) + ctx.eh.violation( + DialectError, + dialect.id, + s"Invalid type $t for 'extensions' node. Expected map", + extensionsEntry.value + ) } } } @@ -101,23 +116,18 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) if (ctx.declarations.externals.nonEmpty) { val entry = map.key("external").get - dialect.set(Externals, - AmfArray(ctx.declarations.externals.values.toSeq, Annotations(entry.value)), - Annotations(entry)) + dialect.set( + Externals, + AmfArray(ctx.declarations.externals.values.toSeq, Annotations(entry.value)), + Annotations(entry) + ) } - parseDeclarations(root, map) + parseDeclarations(dialect.id, map) val declarables = ctx.declarations.declarables() declarables.foreach { - case unionNodeMapping: UnionNodeMapping => - checkNodeMappableReferences(unionNodeMapping) - - case nodeMapping: Member => - nodeMapping.propertiesMapping().foreach { propertyMapping => - checkNodeMappableReferences(propertyMapping) - } - + case anyMapping: AnyMapping => checkAnyNodeMappableReferences(anyMapping) case annotationMapping: AnnotationMapping => checkNodeMappableReferences(annotationMapping) } addDeclarationsToModel(dialect) @@ -146,10 +156,7 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) e.value.tagType match { case YType.Map => e.value.as[YMap].entries.foreach { entry => - AnnotationMappingParser(entry, parent).parse() match { - case Some(annotationMapping) => ctx.declarations += annotationMapping - case None => // Ignore - } + ctx.declarations += AnnotationMappingParser(entry, parent).parse() } case YType.Null => case t => @@ -158,23 +165,30 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) } } - protected def parseDeclarations(root: Root, map: YMap): Unit = { - val parent = root.location + "#/declarations" + protected def parseDeclarations(baseIri: String, map: YMap): Unit = { + val parent = baseIri + "#/declarations" parseNodeMappingDeclarations(map, parent) parseAnnotationMappingDeclarations(map, parent) } - /** - * Recursively collects members from unions and nested unions - * @param union union to extract members from - * @param path path to show error on nested ambiguities - * @return Map member -> path from root level union + /** Recursively collects members from unions and nested unions + * @param union + * union to extract members from + * @param path + * path to show error on nested ambiguities + * @return + * Map member -> path from root level union */ - private def flattenedMembersFrom(union: NodeWithDiscriminator[_], - path: Seq[UnionNodeMapping] = Nil): Map[NodeMapping, Seq[UnionNodeMapping]] = { + private def flattenedMembersFrom( + union: NodeWithDiscriminator[_], + path: Seq[UnionNodeMapping] = Nil + ): Map[NodeMapping, Seq[UnionNodeMapping]] = { membersFrom(union).flatMap { case anotherUnion: UnionNodeMapping if !path.contains(union) => - flattenedMembersFrom(anotherUnion, path :+ anotherUnion) // if member is another union get its members recursively + flattenedMembersFrom( + anotherUnion, + path :+ anotherUnion + ) // if member is another union get its members recursively case nodeMapping: NodeMapping => Some(nodeMapping -> path) case _ => None }.toMap @@ -192,10 +206,10 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) type Member = NodeMapping type ConcatenatedNames = String - /** - * Ambiguity kinds: + /** Ambiguity kinds: * - Un-avoidable: cannot distinguish between two union members - * - Eventual: some times cannot distinguish between two union members, depending on the value of the dialect instance + * - Eventual: some times cannot distinguish between two union members, depending on the value of the dialect + * instance * * Conditions for un-avoidable ambiguity: * - Set of property names is exactly the same between two union members @@ -203,8 +217,10 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) * Conditions for eventual ambiguity: * - Set of MANDATORY property names is exactly the same between two union members * - * @param union Union to calculate ambiguity over its members - * @tparam T type of union: union node mapping or union property mapping + * @param union + * Union to calculate ambiguity over its members + * @tparam T + * type of union: union node mapping or union property mapping */ def checkAmbiguity[T <: DomainElement](union: NodeWithDiscriminator[_]): Unit = { val membersPathIndex = flattenedMembersFrom(union) @@ -226,20 +242,24 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) unavoidableCache.foreach { case (_, members) if members.size > 1 => val names = members.map(buildPath).sorted.mkString(", ") - ctx.eh.violation(UnavoidableAmbiguity, - union.id, - s"Union is ambiguous. Members $names have the same set of property names", - union.annotations) + ctx.eh.violation( + UnavoidableAmbiguity, + union.id, + s"Union is ambiguous. Members $names have the same set of property names", + union.annotations + ) case _ => // Ignore } eventualCache.foreach { case (_, members) if members.size > 1 => val names = members.map(buildPath).sorted.mkString(", ") - ctx.eh.warning(EventualAmbiguity, - union.id, - s"Union might be ambiguous. Members $names have the same set of mandatory property names", - union.annotations) + ctx.eh.warning( + EventualAmbiguity, + union.id, + s"Union might be ambiguous. Members $names have the same set of mandatory property names", + union.annotations + ) case _ => // Ignore } } @@ -247,7 +267,8 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) private def updateAmbiguityCaches[T <: DomainElement]( member: Member, unavoidableCache: mutable.HashMap[ConcatenatedNames, Seq[Member]], - eventualCache: mutable.HashMap[ConcatenatedNames, Seq[Member]]) = { + eventualCache: mutable.HashMap[ConcatenatedNames, Seq[Member]] + ) = { val allProperties = member .propertiesMapping() @@ -269,18 +290,63 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) } } - /** - * This method: - * 1. replaces union & discriminator members references to other node mappings from their name to their id - * 2. validates union & discriminator members exist - * 3. checks for ambiguity + private def findIdOrError(value: StrField, mappable: AnyMapping): Option[String] = { + val name = value.toString + // Is necessary this check? It always should be a reference + if (name == (Namespace.Meta + "anyNode").iri()) Some(name) + else { + ctx.declarations.findNodeMapping(name, All) match { + case Some(mapping) => Some(mapping.id) + case None => + ctx.findInRecursiveUnits(name) match { + case Some(recursiveId) => Some(recursiveId) + case None => + ctx.missingPropertyRangeViolation( + name, + mappable.id, + value.annotations() + ) + None + } + } + } + } + + protected def checkAnyNodeMappableReferences(mappable: AnyMapping): Unit = { + + val allMembers = mappable.and.flatMap(member => findIdOrError(member, mappable)) + if (allMembers.nonEmpty) mappable.withAnd(allMembers) + val oneMembers = mappable.or.flatMap(member => findIdOrError(member, mappable)) + if (oneMembers.nonEmpty) mappable.withOr(oneMembers) + val components = mappable.components.flatMap(member => findIdOrError(member, mappable)) + if (components.nonEmpty) mappable.withComponents(components) + if (mappable.ifMapping.nonEmpty) + findIdOrError(mappable.ifMapping, mappable).foreach(mappable.withIfMapping) + if (mappable.thenMapping.nonEmpty) + findIdOrError(mappable.thenMapping, mappable).foreach(mappable.withThenMapping) + if (mappable.elseMapping.nonEmpty) + findIdOrError(mappable.elseMapping, mappable).foreach(mappable.withElseMapping) + + mappable match { + case unionNodeMapping: UnionNodeMapping => checkNodeMappableReferences(unionNodeMapping) + case nodeMapping: Member => + nodeMapping.propertiesMapping().foreach { propertyMapping => + checkNodeMappableReferences(propertyMapping) + } + } + + } + + /** This method: + * 1. replaces union & discriminator members references to other node mappings from their name to their id 2. + * validates union & discriminator members exist 3. checks for ambiguity */ protected def checkNodeMappableReferences[T <: DomainElement](mappable: NodeWithDiscriminator[_]): Unit = { val memberStream = mappable.objectRange().toStream val memberIdsStream = memberStream .map(field => (memberIdFromName(field.value(), mappable), field.annotations())) - .filter { - case (optionalValue, _) => optionalValue.isDefined + .filter { case (optionalValue, _) => + optionalValue.isDefined } .map(t => AmfScalar(t._1.get, t._2)) @@ -291,38 +357,41 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) } if (memberIdsStream.nonEmpty) { val objectRangeValue = mappable.fields.getValue(ObjectRange) - mappable.set(ObjectRange, - AmfArray(memberIdsStream, objectRangeValue.value.annotations), - objectRangeValue.annotations) + mappable.set( + ObjectRange, + AmfArray(memberIdsStream, objectRangeValue.value.annotations), + objectRangeValue.annotations + ) } // Setting ids we left unresolved in typeDiscriminators Option(mappable.typeDiscriminator()) match { case Some(typeDiscriminators) => val fieldValue = mappable.fields.entry(PropertyMappingModel.TypeDiscriminator).map(_.value) - val discriminatorValueMapping = typeDiscriminators.flatMap { - case (name, discriminatorValue) => - ctx.declarations - .findNodeMapping(name, All) - .map(_.id -> discriminatorValue) - .orElse { - ctx.missingPropertyRangeViolation( - name, - mappable.id, - fieldValue - .map(_.annotations) - .getOrElse(mappable.annotations) - ) - None - } + val discriminatorValueMapping = typeDiscriminators.flatMap { case (name, discriminatorValue) => + ctx.declarations + .findNodeMapping(name, All) + .map(_.id -> discriminatorValue) + .orElse { + ctx.missingPropertyRangeViolation( + name, + mappable.id, + fieldValue + .map(_.annotations) + .getOrElse(mappable.annotations) + ) + None + } } - mappable.withTypeDiscriminator(discriminatorValueMapping, - fieldValue - .map(_.annotations) - .getOrElse(Annotations()), - fieldValue - .map(_.value.annotations) - .getOrElse(Annotations())) + mappable.withTypeDiscriminator( + discriminatorValueMapping, + fieldValue + .map(_.annotations) + .getOrElse(Annotations()), + fieldValue + .map(_.value.annotations) + .getOrElse(Annotations()) + ) case _ => // ignore } } @@ -331,10 +400,10 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) if (name == (Namespace.Meta + "anyNode").iri()) Some(name) else { ctx.declarations.findNodeMapping(name, All) match { - case Some(mapping: NodeMapping) if union.isInstanceOf[PropertyMapping] => + case Some(mapping: NodeMapping) if union.isInstanceOf[PropertyLikeMapping[_]] => // I want to search or generate the uri (and check that the term is the same if is already set it) right know, so I can throw a violation if some is wrong before start parsing the instance. // Also, If none instance will be parsed, but the dialect model is going to be serialized, I would be better has the terms already setting in the json ld. That way, the violation is collected now, and we don't need to do some particular, border case, logic in the json ld graph parser. - updateMapLabelReferences(union.asInstanceOf[PropertyMapping], mapping) // Should remove this side effect + updateMapLabelReferences(union.asInstanceOf[PropertyLikeMapping[_]], mapping) // Should remove this side effect Some(mapping.id) case Some(mapping) => Some(mapping.id) @@ -347,14 +416,15 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) .find(p => p.value() == name) .map(p => p.annotations()) .orElse( - union.fields - .entry(PropertyMappingModel.ObjectRange) - .map(_.value.annotations)) + union.fields + .entry(PropertyMappingModel.ObjectRange) + .map(_.value.annotations) + ) .getOrElse(union.annotations) ctx.missingPropertyRangeViolation( - name, - union.id, - lexicalRange + name, + union.id, + lexicalRange ) None } @@ -362,14 +432,14 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) } } - def updateMapLabelReferences(propertyMapping: PropertyMapping, range: NodeMapping): Unit = { + def updateMapLabelReferences(propertyMapping: PropertyLikeMapping[_], range: NodeMapping): Unit = { // todo: if mapKey is not defined but mapTermKey is, should we validate that all ranges contains one property with that term and if not, throw a violation? updateKeyMapReferences(propertyMapping, range) updateValueMapReferences(propertyMapping, range) } - private def updateValueMapReferences(propertyMapping: PropertyMapping, range: NodeMapping): Unit = { + private def updateValueMapReferences(propertyMapping: PropertyLikeMapping[_], range: NodeMapping): Unit = { propertyMapping.mapValueProperty().option().foreach { label => range.propertiesMapping().find(_.name().value() == label) match { case Some(property) => @@ -379,26 +449,26 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) property.fields.removeField(PropertyMappingModel.MapTermValueProperty) propertyMapping.fields.removeField(PropertyMappingModel.MapValueProperty) ctx.differentTermsInMapKey( - propertyMapping.id, - PropertyMappingModel.MapValueProperty.value.iri(), - label, - propertyMapping.mapValueProperty().annotations() + propertyMapping.id, + PropertyMappingModel.MapValueProperty.value.iri(), + label, + propertyMapping.mapValueProperty().annotations() ) case _ => propertyMapping.withMapTermValueProperty(term) } case _ => propertyMapping.fields.removeField(PropertyMappingModel.MapValueProperty) ctx.missingPropertyKeyViolation( - propertyMapping.id, - PropertyMappingModel.MapValueProperty.value.iri(), - label, - propertyMapping.mapValueProperty().annotations() + propertyMapping.id, + PropertyMappingModel.MapValueProperty.value.iri(), + label, + propertyMapping.mapValueProperty().annotations() ) } } } - private def updateKeyMapReferences(propertyMapping: PropertyMapping, range: NodeMapping): Unit = { + private def updateKeyMapReferences(propertyMapping: PropertyLikeMapping[_], range: NodeMapping): Unit = { propertyMapping.mapKeyProperty().option().foreach { label => range.propertiesMapping().find(_.name().value() == label) match { case Some(property) => @@ -406,10 +476,10 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) property.mapTermKeyProperty().option() match { case Some(actualTerm) if term != actualTerm => ctx.differentTermsInMapKey( - propertyMapping.id, - PropertyMappingModel.MapKeyProperty.value.iri(), - label, - propertyMapping.mapKeyProperty().annotations() + propertyMapping.id, + PropertyMappingModel.MapKeyProperty.value.iri(), + label, + propertyMapping.mapKeyProperty().annotations() ) propertyMapping.fields.removeField(PropertyMappingModel.MapTermKeyProperty) propertyMapping.fields.removeField(PropertyMappingModel.MapKeyProperty) @@ -417,10 +487,10 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) } case _ => ctx.missingPropertyKeyViolation( - propertyMapping.id, - PropertyMappingModel.MapKeyProperty.value.iri(), - label, - propertyMapping.mapKeyProperty().annotations() + propertyMapping.id, + PropertyMappingModel.MapKeyProperty.value.iri(), + label, + propertyMapping.mapKeyProperty().annotations() ) propertyMapping.fields.removeField(PropertyMappingModel.MapKeyProperty) } @@ -436,223 +506,62 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) val nodeName = entry.key.toString if (AmlScalars.all.contains(nodeName)) { ctx.eh - .violation(DialectError, - parent, - s"Error parsing node mapping: '$nodeName' is a reserved name", - entry.location) + .violation( + DialectError, + parent, + s"Error parsing node mapping: '$nodeName' is a reserved name", + entry.location + ) } else { val adopt: DomainElement => Any = { case nodeMapping: NodeMappable => val name = ScalarNode(entry.key).string() nodeMapping.set(NodeMappingModel.Name, name, Annotations(entry.key)).adopted(parent) - nodeMapping.annotations.reject( - a => - a.isInstanceOf[SourceAST] || - a.isInstanceOf[LexicalInformation] || - a.isInstanceOf[SourceLocation] || - a.isInstanceOf[SourceNode]) + nodeMapping.annotations.reject(a => + a.isInstanceOf[SourceAST] || + a.isInstanceOf[LexicalInformation] || + a.isInstanceOf[SourceLocation] || + a.isInstanceOf[SourceNode] + ) nodeMapping.annotations ++= Annotations(entry) case _ => - ctx.eh.violation(DialectError, - parent, - s"Error only valid node mapping or union mapping can be declared", - entry.location) + ctx.eh.violation( + DialectError, + parent, + s"Error only valid node mapping or union mapping can be declared", + entry.location + ) None } parseNodeMapping(entry, adopt) match { - case Some(nodeMapping: NodeMapping) => ctx.declarations += nodeMapping - case Some(nodeMapping: UnionNodeMapping) => ctx.declarations += nodeMapping - case _ => ctx.eh.violation(DialectError, parent, s"Error parsing shape '$entry'", entry.location) + case Some(nodeMapping: NodeMapping) => ctx.declarations += nodeMapping + case Some(unionMapping: UnionNodeMapping) => ctx.declarations += unionMapping + case _ => ctx.eh.violation(DialectError, parent, s"Error parsing shape '$entry'", entry.location) } } } case YType.Null => - case t => ctx.eh.violation(DialectError, parent, s"Invalid type $t for 'nodeMappings' node.", e.value.location) + case t => ctx.eh.violation(DialectError, parent, s"Invalid type $t for 'nodeMappings' node.", e.value.location) } } } - protected def parseUnionNodeMapping(map: YMap, - adopt: DomainElement => Any, - fragment: Boolean = false): Option[UnionNodeMapping] = { - val unionNodeMapping = UnionNodeMapping(map) - - adopt(unionNodeMapping) - - map.key( - "union", - entry => { - entry.value.tagType match { - case YType.Seq => - try { - val nodes = entry.value.as[YSequence].nodes.map(n => AmfScalar(n.as[String], Annotations(n))) - unionNodeMapping.set(ObjectRange, AmfArray(nodes, Annotations(entry.value)), Annotations(entry)) - } catch { - case _: Exception => - ctx.eh.violation(DialectError, - unionNodeMapping.id, - s"Union node mappings must be declared as lists of node mapping references", - entry.value.location) - } - case _ => - ctx.eh.violation(DialectError, - unionNodeMapping.id, - s"Union node mappings must be declared as lists of node mapping references", - entry.value.location) - } - } - ) - - map.key( - "typeDiscriminator", - entry => { - val types = entry.value.as[YMap] - val typeMapping = types.entries.foldLeft(Map[String, String]()) { - case (acc, e) => - val nodeMappingId = e.value.as[YScalar].text - acc + (e.key.as[YScalar].text -> nodeMappingId) - } - unionNodeMapping.withTypeDiscriminator(typeMapping, Annotations(entry), Annotations(types)) - } - ) - - map.parse("typeDiscriminatorName", unionNodeMapping setParsing UnionNodeMappingModel.TypeDiscriminatorName) - - Some(unionNodeMapping) - } - - def parseSingleNodeMapping(map: YMap, adopt: DomainElement => Any, fragment: Boolean = false): Option[NodeMapping] = { - val nodeMapping = NodeMapping(map) - - adopt(nodeMapping) - - if (!fragment) - ctx.closedNode("nodeMapping", nodeMapping.id, map) - - map.key( - "classTerm", - entry => { - val value = ValueNode(entry.value) - val classTermId = value.string().toString - ctx.declarations.findClassTerm(classTermId, SearchScope.All) match { - case Some(classTerm) => - nodeMapping.withNodeTypeMapping(classTerm.id) - case _ => - ctx.eh.violation(DialectError, - nodeMapping.id, - s"Cannot find class term with alias $classTermId", - entry.value.location) - } - } - ) - - map.key( - "patch", - entry => { - val patchMethod = ScalarNode(entry.value).string() - nodeMapping.set(NodeMappingModel.MergePolicy, patchMethod, Annotations(entry)) - val patchMethodValue = patchMethod.toString - if (!MergePolicies.isAllowed(patchMethodValue)) { - ctx.eh.violation(DialectError, - nodeMapping.id, - s"Unsupported node mapping patch operation '$patchMethod'", - entry.value.location) - } - } - ) - - map.key( - "mapping", - entry => { - val properties = entry.value.as[YMap].entries.map { entry => - parsePropertyMapping( - entry, - propertyMapping => - propertyMapping - .adopted(nodeMapping.id + "/property/" + entry.key.as[YScalar].text.urlComponentEncoded), - nodeMapping.id) - } - val (withTerm, withoutTerm) = properties.partition(_.nodePropertyMapping().option().nonEmpty) - val filterProperties: immutable.Iterable[PropertyMapping] = withTerm - .filter(_.nodePropertyMapping().option().nonEmpty) - .groupBy(p => p.nodePropertyMapping().value()) - .flatMap({ - case (termKey, values) if values.length > 1 => - ctx.eh.violation(DialectError, - values.head.id, - s"Property term value must be unique in a node mapping. Term $termKey repeated", - values.head.annotations) - values.headOption - case other => other._2.headOption - }) - nodeMapping.setArrayWithoutId(NodeMappingModel.PropertiesMapping, - withoutTerm ++ filterProperties.toSeq, - Annotations(entry)) - } - ) - - map.key( - "extends", - entry => { - val reference = entry.value.toOption[YScalar] - val parsed = reference match { - case Some(_) => resolveNodeMappingLink(entry, adopt) - case _ => None - } - parsed match { - case Some(resolvedNodeMapping: NodeMapping) => - nodeMapping.withExtends(Seq(resolvedNodeMapping)) - case _ => - ctx.eh.violation( - DialectError, - nodeMapping.id, - s"Cannot find extended node mapping with reference '${reference.map(_.toString()).getOrElse("")}'", - entry.value.location) - } - } - ) - - map.parse("idTemplate", nodeMapping setParsing NodeMappingModel.IdTemplate) - map.key( - "idTemplate", - entry => { - val idTemplate = entry.value.as[String] - val base = BaseDirective.baseFrom(idTemplate) - if (base.contains('{')) { - ctx.eh.warning(VariablesDefinedInBase, - nodeMapping.id, - s"Base $base contains idTemplate variables overridable by $$base directive", - entry.value.location) - } - } - ) - nodeMapping.idTemplate.option().foreach(validateTemplate(_, map, nodeMapping.propertiesMapping())) - - parseAnnotations(map, nodeMapping, ctx.declarations) - - ctx.declarations.+=(nodeMapping) - - Some(nodeMapping) - } - - def parseNodeMapping(entry: YMapEntry, - adopt: DomainElement => Any, - fragment: Boolean = false): Option[NodeMappable] = { + def parseNodeMapping( + entry: YMapEntry, + adopt: DomainElement => Any, + fragment: Boolean = false + ): Option[NodeMappable] = { entry.value.tagType match { // 1) inlined node mapping case YType.Map => - val map = entry.value.as[YMap] - if (map.key("union").isDefined) { - parseUnionNodeMapping(map, adopt, fragment) - } else { - parseSingleNodeMapping(map, adopt, fragment) - } + val inlinedNodeMappable = NodeMappingLikeParser.parse(entry, adopt, fragment) + Some(inlinedNodeMappable) // 2) reference linking a declared node mapping case YType.Str if entry.value.toOption[YScalar].isDefined => - resolveNodeMappingLink(entry, adopt) + NodeMappingLikeParser.resolveNodeMappingLink(map, entry.value, adopt) // 3) node mapping included from a fragment case YType.Include if entry.value.toOption[YScalar].isDefined => @@ -669,7 +578,9 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) .link(text, Annotations(entry.value)) .asInstanceOf[NodeMapping] .withName(text) // we setup the local reference in the name - adopt(linkedNode) // and the ID of the link at that position in the tree, not the ID of the linked element, tha goes in link-target + adopt( + linkedNode + ) // and the ID of the link at that position in the tree, not the ID of the linked element, tha goes in link-target Some(linkedNode) case (text: String, _) => val nodeMappingTmp = adopt(NodeMapping()).asInstanceOf[NodeMapping] @@ -678,142 +589,7 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) None } - case _ => - Some(NodeMapping(Annotations(entry.value))) - } - } - - def parsePropertyMapping(entry: YMapEntry, adopt: PropertyMapping => Any, nodeId: String): PropertyMapping = { - val name = ScalarNode(entry.key).string() - entry.value.tagType match { - case YType.Map => - val map = entry.value.as[YMap] - val propertyMapping = PropertyMapping(entry.value).set(PropertyMappingModel.Name, name, Annotations(entry.key)) - - adopt(propertyMapping) - ctx.closedNode("propertyMapping", propertyMapping.id, map) - - PropertyLikeMappingParser(map, propertyMapping).parse() - - parseMapKey(map, propertyMapping) - parseMapValue(map, propertyMapping) - parsePatch(map, propertyMapping) - parseAnnotations(map, propertyMapping, ctx.declarations) - - propertyMapping - case _ => - val p = PropertyMapping(Annotations(entry)).set(PropertyMappingModel.Name, name, Annotations(entry.key)) - ctx.eh.violation(DialectValidations.PropertyMappingMustBeAMap, - nodeId, - s"Property mapping $name must be a map", - entry.location) - p - } - } - - private def parsePatch(map: YMap, propertyMapping: PropertyMapping): Unit = { - map.key( - "patch", - entry => { - val patchMethod = ScalarNode(entry.value).string() - propertyMapping.set(PropertyMappingModel.MergePolicy, patchMethod, Annotations(entry)) - val patchMethodValue = patchMethod.toString - if (!MergePolicies.isAllowed(patchMethodValue)) { - ctx.eh.violation(DialectError, - propertyMapping.id, - s"Unsupported property mapping patch operation '$patchMethod'", - entry.value.location) - } - } - ) - } - - private def parseMapKey(map: YMap, propertyMapping: PropertyMapping): Unit = { - val mapKey = map.key("mapKey") - val mapTermKey = map.key("mapTermKey") - - for { - _ <- mapKey - _ <- mapTermKey - } yield { - ctx.eh.violation(DialectError, propertyMapping.id, s"mapKey and mapTermKey are mutually exclusive", map.location) - } - - mapTermKey.fold({ - mapKey.foreach(entry => { - val propertyLabel = ValueNode(entry.value).string().toString - propertyMapping.withMapKeyProperty(propertyLabel, Annotations(entry.value)) - }) - })(entry => { - val propertyTermId = ValueNode(entry.value).string().toString - getTermIfValid(propertyTermId, propertyMapping.id, entry.value).foreach { p => - propertyMapping.withMapTermKeyProperty(p, Annotations(entry.value)) - } - }) - } - - private def parseMapValue(map: YMap, propertyMapping: PropertyMapping): Unit = { - val mapValue = map.key("mapValue") - val mapTermValue = map.key("mapTermValue") - - for { - _ <- mapValue - _ <- mapTermValue - } yield { - ctx.eh - .violation(DialectError, propertyMapping.id, s"mapValue and mapTermValue are mutually exclusive", map.location) - } - - mapTermValue.fold({ - mapValue.foreach(entry => { - val propertyLabel = ValueNode(entry.value).string().toString - propertyMapping.withMapValueProperty(propertyLabel, Annotations(entry.value)) - }) - })(entry => { - val propertyTermId = ValueNode(entry.value).string().toString - getTermIfValid(propertyTermId, propertyMapping.id, entry.value).foreach { p => - propertyMapping.withMapTermValueProperty(p, Annotations(entry.value)) - } - }) - - } - - private def getTermIfValid(iri: String, propertyMappingId: String, ast: YPart): Option[String] = { - Namespace(iri).base match { - case Namespace.Data.base => Some(iri) - case _ => - ctx.declarations.findPropertyTerm(iri, All) match { - case Some(term) => Some(term.id) - case _ => - ctx.eh - .violation(DialectError, propertyMappingId, s"Cannot find property term with alias $iri", ast.location) - None - } - } - } - - def validateTemplate(template: String, map: YMap, propMappings: Seq[PropertyMapping]): Unit = { - getVariablesFromTemplate(template).foreach { variable => - propMappings.find(_.name().value() == variable) match { - case Some(prop) if !prop.isMandatory => - ctx.eh.violation(DialectError, - prop.id, - s"PropertyMapping for idTemplate variable '$variable' must be mandatory", - map.location) - case None => - ctx.eh.violation(DialectError, - "", - s"Missing propertyMapping for idTemplate variable '$variable'", - map.location) - case _ => // ignore - } - } - - def getVariablesFromTemplate(template: String): Iterator[String] = { - val regex = "(\\{[^}]+\\})".r - regex.findAllIn(template).map { varMatch => - varMatch.replace("{", "").replace("}", "") - } + case _ => Some(NodeMapping(Annotations(entry.value))) } } @@ -836,7 +612,7 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) if (ctx.declarations.externals.nonEmpty) dialect.withExternals(ctx.declarations.externals.values.toSeq) - parseDeclarations(root, map) + parseDeclarations(dialect.id, map) val declarables = ctx.declarations.declarables() declarables.foreach { @@ -895,21 +671,23 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) if (ctx.declarations.externals.nonEmpty) dialect.withExternals(ctx.declarations.externals.values.toSeq) - parseDeclarations(root, map) + parseDeclarations(dialect.id, map) if (references.baseUnitReferences().nonEmpty) dialect.withReferences(references.baseUnitReferences()) val fragment = toFragment(dialect) parseNodeMapping( - YMapEntry(YNode("fragment"), map), { - case mapping: NodeMapping => mapping.withId(fragment.id + "/fragment").withName("fragment") - case mapping: UnionNodeMapping => mapping.withId(fragment.id + "/fragment").withName("fragment") - }, - fragment = true + YMapEntry(YNode("fragment"), map), + { + case mapping: NodeMapping => mapping.withId(fragment.id + "/fragment").withName("fragment") + case mapping: UnionNodeMapping => mapping.withId(fragment.id + "/fragment").withName("fragment") + }, + fragment = true ) match { - case Some(encoded: DomainElement) => fragment.fields.setWithoutId(FragmentModel.Encodes, encoded) - case _ => // ignore + case Some(encoded: DomainElement) => + fragment.fields.setWithoutId(FragmentModel.Encodes, encoded, Annotations.inferred()) + case _ => // ignore } fragment.processingData.withSourceSpec(AML) @@ -931,26 +709,4 @@ class DialectsParser(root: Root)(implicit override val ctx: DialectContext) fragment } - protected def resolveNodeMappingLink(entry: YMapEntry, adopt: DomainElement => Any): Some[NodeMapping] = { - val refTuple = ctx.link(entry.value) match { - case Left(key) => - (key, ctx.declarations.findNodeMapping(key, SearchScope.Fragments)) - case _ => - val text = entry.value.as[YScalar].text - (text, ctx.declarations.findNodeMapping(text, SearchScope.Named)) - } - refTuple match { - case (text: String, Some(s)) => - val linkedNode = s - .link(text, Annotations(entry.value)) - .asInstanceOf[NodeMapping] - adopt(linkedNode) // and the ID of the link at that position in the tree, not the ID of the linked element, tha goes in link-target - Some(linkedNode) - case (text: String, _) => - val linkedNode = NodeMapping(map) - adopt(linkedNode) - linkedNode.unresolved(text, Nil, Some(map.location)) - Some(linkedNode) - } - } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectsReferencesParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectsReferencesParser.scala index 2ffc1158..53341432 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectsReferencesParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/DialectsReferencesParser.scala @@ -4,12 +4,7 @@ import amf.core.internal.annotations.{Aliases, ReferencedInfo} import amf.core.internal.annotations.Aliases._ import amf.core.client.scala.model.document.{BaseUnit, DeclaresModel, RecursiveUnit} import amf.core.client.scala.model.domain.AmfObject -import amf.core.client.scala.parse.document.{ - CallbackReferenceCollector, - ParsedReference, - Reference, - ReferenceCollector -} +import amf.core.client.scala.parse.document.{CallbackReferenceCollector, ParsedReference, Reference, ReferenceCollector} import amf.core.internal.parser.domain.Annotations import amf.aml.client.scala.model.document.{Dialect, DialectFragment, Vocabulary} import amf.aml.client.scala.model.domain.External @@ -18,8 +13,9 @@ import org.yaml.model.{YMap, YMapEntry, YScalar, YType} import amf.aml.internal.parse.dialects.DialectAstOps._ import amf.core.internal.parser.YScalarYRead -case class DialectsReferencesParser(dialect: Dialect, map: YMap, references: Seq[ParsedReference])( - implicit ctx: DialectContext) { +case class DialectsReferencesParser(dialect: Dialect, map: YMap, references: Seq[ParsedReference])(implicit + ctx: DialectContext +) { def parse(): ReferenceCollector[AmfObject] = { val declarations = CallbackReferenceCollector(DialectRegister()) @@ -37,12 +33,12 @@ case class DialectsReferencesParser(dialect: Dialect, map: YMap, references: Seq private def parseUses(declarations: ReferenceCollector[AmfObject]): Unit = { map.key( - "uses", - entry => - entry.value - .as[YMap] - .entries - .foreach(entry => parseUsesEntry(entry, declarations)) + "uses", + entry => + entry.value + .as[YMap] + .entries + .foreach(entry => parseUsesEntry(entry, declarations)) ) } @@ -62,7 +58,12 @@ case class DialectsReferencesParser(dialect: Dialect, map: YMap, references: Seq declarations += (alias, r) case None => val node = dialect.location().getOrElse(dialect.id) - ctx.eh.violation(DialectError, node, s"Expected vocabulary module but found: $other", e.location) // todo Uses should only reference modules... + ctx.eh.violation( + DialectError, + node, + s"Expected vocabulary module but found: $other", + e.location + ) // todo Uses should only reference modules... } } } @@ -86,17 +87,17 @@ case class DialectsReferencesParser(dialect: Dialect, map: YMap, references: Seq private def parseExternals(result: ReferenceCollector[AmfObject]): Unit = { map.key( - "external", - entry => - entry.value - .as[YMap] - .entries - .foreach(e => { - val alias: String = e.key.as[YScalar].text - val base: String = e.value - val external = External(e) - result += (alias, external.withAlias(alias, Annotations(e.key)).withBase(base, Annotations(e.value))) - }) + "external", + entry => + entry.value + .as[YMap] + .entries + .foreach(e => { + val alias: String = e.key.as[YScalar].text + val base: String = e.value + val external = External(e) + result += (alias, external.withAlias(alias, Annotations(e.key)).withBase(base, Annotations(e.value))) + }) ) } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/ReferenceDeclarations.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/ReferenceDeclarations.scala index e69de29b..8b137891 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/ReferenceDeclarations.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/ReferenceDeclarations.scala @@ -0,0 +1 @@ + diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/SemanticExtensionParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/SemanticExtensionParser.scala index d430bc2f..e4635175 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/SemanticExtensionParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/SemanticExtensionParser.scala @@ -8,29 +8,36 @@ import amf.aml.internal.validate.DialectValidations.DialectError import org.yaml.model.{YMapEntry, YScalar, YType} case class SemanticExtensionParser(entry: YMapEntry, parent: String)(implicit val ctx: DialectContext) { - def parse(): Option[SemanticExtension] = { + def parse(): SemanticExtension = { val name = entry.key.as[YScalar].text + val semantic = SemanticExtension(Annotations(entry)) + .withId(s"$parent/$name") + .set(SemanticExtensionModel.ExtensionName, AmfScalar(name, Annotations(entry.key)), Annotations(entry.key)) + populateSemanticExtension(name, semantic) + semantic + } + + private def populateSemanticExtension(name: String, semantic: SemanticExtension) = { entry.value.tagType match { case YType.Str => val definitionRawRef = entry.value.as[YScalar].text val extensionMappingDefinition = ctx.declarations.findAnnotationMappingOrError(entry.value)(definitionRawRef, SearchScope.All) + semantic + .set( + SemanticExtensionModel.ExtensionMappingDefinition, + AmfScalar(extensionMappingDefinition.id, Annotations(entry.value)), + Annotations(entry) + ) - Some { - SemanticExtension() - .withId(s"$parent/$name") - .withExtensionName(name) - .set(SemanticExtensionModel.ExtensionMappingDefinition, - AmfScalar(extensionMappingDefinition.id, Annotations(entry.value)), - Annotations(entry)) - } case t => - ctx.eh.violation(DialectError, - parent, - s"Invalid type $t (expected ${YType.Str}) for semantic extension node $name", - entry.value.location) - None + ctx.eh.violation( + DialectError, + parent, + s"Invalid type $t (expected ${YType.Str}) for semantic extension node $name", + entry.value.location + ) } } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/nodemapping/like/AnyMappingParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/nodemapping/like/AnyMappingParser.scala new file mode 100644 index 00000000..5c1bab91 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/nodemapping/like/AnyMappingParser.scala @@ -0,0 +1,44 @@ +package amf.aml.internal.parse.dialects.nodemapping.like + +import amf.aml.client.scala.model.domain.AnyMapping +import amf.aml.internal.metamodel.domain.AnyMappingModel +import amf.aml.internal.parse.dialects.DialectContext +import amf.aml.internal.validate.DialectValidations.DialectError +import amf.core.client.scala.model.domain.{AmfArray, AmfScalar} +import amf.core.internal.metamodel.Field +import amf.core.internal.parser.YMapOps +import amf.core.internal.parser.domain.Annotations +import org.yaml.model._ + +trait AnyMappingParser { + + def parse(map: YMap, mapping: AnyMapping)(implicit ctx: DialectContext): AnyMapping = { + + processAnyMappingField(map, mapping, "allOf", AnyMappingModel.And) + processAnyMappingField(map, mapping, "oneOf", AnyMappingModel.Or) + processAnyMappingField(map, mapping, "components", AnyMappingModel.Components) + ConditionalParser.parse(map, mapping) + mapping + + } + + private def processAnyMappingField(map: YMap, mapping: AnyMapping, key: String, field: Field)(implicit + ctx: DialectContext + ): Unit = map.key( + key, + entry => { + entry.value.tagType match { + case YType.Seq => + val nodes = MappingParsingHelper.entrySeqNodesToString(entry) + mapping.set(field, AmfArray(nodes, Annotations(entry.value)), Annotations(entry)) + case _ => + ctx.eh.violation( + DialectError, + mapping.id, + s"$key mappings must be declared as lists of node mapping references", + entry.value.location + ) + } + } + ) +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/nodemapping/like/ConditionalParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/nodemapping/like/ConditionalParser.scala new file mode 100644 index 00000000..504842af --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/nodemapping/like/ConditionalParser.scala @@ -0,0 +1,41 @@ +package amf.aml.internal.parse.dialects.nodemapping.like + +import amf.aml.client.scala.model.domain.AnyMapping +import amf.aml.internal.metamodel.domain.AnyMappingModel.{Else, If, Then} +import amf.aml.internal.parse.dialects.DialectContext +import amf.aml.internal.validate.DialectValidations.DialectError +import amf.core.internal.metamodel.Field +import amf.core.internal.parser.YMapOps +import amf.core.internal.parser.domain.{Annotations, ValueNode} +import org.yaml.model.{YMap, YType} + +object ConditionalParser { + + def parse(map: YMap, mapping: AnyMapping)(implicit ctx: DialectContext): Unit = { + + map.key( + "conditional", + entry => + entry.value.tagType match { + case YType.Map => + val innerMap = entry.value.as[YMap] + parseConditionalField(innerMap, If, "if", mapping) + parseConditionalField(innerMap, Then, "then", mapping) + parseConditionalField(innerMap, Else, "else", mapping) + ctx.closedNode("conditionalMappingInner", mapping.id, innerMap) + case _ => + ctx.eh.violation(DialectError, mapping.id, s"Conditional mapping must be a map", entry.value.location) + } + ) + } + + private def parseConditionalField(map: YMap, field: Field, key: String, mapping: AnyMapping): Unit = { + map.key( + key, + entry => { + val node = ValueNode(entry.value).string() + mapping.set(field, node, Annotations(entry)) + } + ) + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/nodemapping/like/MappingParsingHelper.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/nodemapping/like/MappingParsingHelper.scala new file mode 100644 index 00000000..728e278d --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/nodemapping/like/MappingParsingHelper.scala @@ -0,0 +1,13 @@ +package amf.aml.internal.parse.dialects.nodemapping.like + +import amf.aml.internal.parse.dialects.DialectContext +import amf.core.client.scala.model.domain.AmfScalar +import amf.core.internal.parser.domain.Annotations +import org.yaml.model.{YMapEntry, YSequence} + +object MappingParsingHelper { + + def entrySeqNodesToString(entry: YMapEntry)(implicit ctx: DialectContext): IndexedSeq[AmfScalar] = + entry.value.as[YSequence].nodes.map(n => AmfScalar(n.as[String], Annotations(n))) + +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/nodemapping/like/NodeMappingLikeParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/nodemapping/like/NodeMappingLikeParser.scala new file mode 100644 index 00000000..7a121366 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/nodemapping/like/NodeMappingLikeParser.scala @@ -0,0 +1,54 @@ +package amf.aml.internal.parse.dialects.nodemapping.like + +import amf.aml.client.scala.model.domain.NodeMappable.AnyNodeMappable +import amf.aml.client.scala.model.domain.NodeMapping +import amf.aml.internal.parse.dialects.DialectContext +import amf.core.client.scala.model.domain.DomainElement +import amf.core.internal.parser.YMapOps +import amf.core.internal.parser.domain.{Annotations, SearchScope} +import org.yaml.model.{YMap, YMapEntry, YNode, YScalar} + +object NodeMappingLikeParser { + + def parse(entry: YMapEntry, adopt: DomainElement => Any, isFragment: Boolean = false)(implicit + ctx: DialectContext + ): AnyNodeMappable = { + + entry.value.as[YMap] match { + case uMap if applies(uMap, UnionNodeMappingParser.identifierKey) => + UnionNodeMappingParser().parse(uMap, adopt, isFragment) + case nMap => NodeMappingParser().parse(nMap, adopt, isFragment) + } + + } + + def resolveNodeMappingLink(map: YMap, entry: YNode, adopt: DomainElement => Any)(implicit + ctx: DialectContext + ): Some[NodeMapping] = { + val refTuple = ctx.link(entry) match { + case Left(key) => + (key, ctx.declarations.findNodeMapping(key, SearchScope.Fragments)) + case _ => + val text = entry.as[YScalar].text + (text, ctx.declarations.findNodeMapping(text, SearchScope.Named)) + } + refTuple match { + case (text: String, Some(s)) => + val linkedNode = s + .link(text, Annotations(entry.value)) + .asInstanceOf[NodeMapping] + adopt( + linkedNode + ) // and the ID of the link at that position in the tree, not the ID of the linked element, tha goes in link-target + Some(linkedNode) + case (text: String, _) => + val linkedNode = NodeMapping(map) + adopt(linkedNode) + linkedNode.unresolved(text, Nil, Some(map.location)) + Some(linkedNode) + } + } + + private def applies(map: YMap, key: String): Boolean = map.key(key).isDefined + +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/nodemapping/like/NodeMappingLikeParserInterface.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/nodemapping/like/NodeMappingLikeParserInterface.scala new file mode 100644 index 00000000..26aa2711 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/nodemapping/like/NodeMappingLikeParserInterface.scala @@ -0,0 +1,12 @@ +package amf.aml.internal.parse.dialects.nodemapping.like + +import amf.aml.client.scala.model.domain.NodeMappable.AnyNodeMappable +import amf.aml.internal.parse.dialects.DialectContext +import amf.core.client.scala.model.domain.DomainElement +import org.yaml.model.YMap + +abstract class NodeMappingLikeParserInterface(implicit ctx: DialectContext) { + + def parse(map: YMap, adopt: DomainElement => Any, isFragment: Boolean = false): AnyNodeMappable + +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/nodemapping/like/NodeMappingParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/nodemapping/like/NodeMappingParser.scala new file mode 100644 index 00000000..5599dd6a --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/nodemapping/like/NodeMappingParser.scala @@ -0,0 +1,346 @@ +package amf.aml.internal.parse.dialects.nodemapping.like + +import amf.aml.client.scala.model.domain.{NodeMapping, PropertyMapping} +import amf.aml.internal.metamodel.domain.{MergePolicies, NodeMappingModel, PropertyMappingModel} +import amf.aml.internal.parse.common.AnnotationsParser.parseAnnotations +import amf.aml.internal.parse.dialects.DialectAstOps.{DialectScalarValueEntryParserOpts, DialectYMapOps} +import amf.aml.internal.parse.dialects.DialectContext +import amf.aml.internal.parse.dialects.property.like.PropertyLikeMappingParser +import amf.aml.internal.parse.instances.BaseDirective +import amf.aml.internal.validate.DialectValidations +import amf.aml.internal.validate.DialectValidations.{DialectError, VariablesDefinedInBase} +import amf.core.client.scala.model.domain.{AmfScalar, DomainElement} +import amf.core.client.scala.vocabulary.Namespace +import amf.core.internal.datanode.DataNodeParser +import amf.core.internal.metamodel.domain.ShapeModel +import amf.core.internal.parser.YNodeLikeOps +import amf.core.internal.parser.domain.SearchScope.All +import amf.core.internal.parser.domain.{Annotations, ScalarNode, SearchScope, ValueNode} +import amf.core.internal.utils.AmfStrings +import amf.core.internal.validation.CoreValidations.SyamlError +import org.mulesoft.common.collections._ +import org.yaml.model._ + +import scala.collection.immutable + +trait DefaultFacetParsing { + protected def parseDefault(map: YMap, element: DomainElement)(implicit ctx: DialectContext): Unit = { + map.key( + "default", + entry => { + val dataNode = DataNodeParser(entry.value).parse() + element.set(ShapeModel.Default, dataNode, Annotations(entry)) + } + ) + } +} + +class NodeMappingParser(implicit ctx: DialectContext) + extends NodeMappingLikeParserInterface + with DefaultFacetParsing + with AnyMappingParser { + + override def parse(map: YMap, adopt: DomainElement => Any, isFragment: Boolean): NodeMapping = { + + val nodeMapping = NodeMapping(map) + adopt(nodeMapping) + + super.parse(map, nodeMapping) + + if (!isFragment) ctx.closedNode("nodeMapping", nodeMapping.id, map) + + map.key( + "classTerm", + entry => { + val value = ValueNode(entry.value) + val classTermId = value.string().toString + ctx.declarations.findClassTerm(classTermId, SearchScope.All) match { + case Some(classTerm) => + nodeMapping.withNodeTypeMapping(classTerm.id) + case _ => + ctx.eh.violation( + DialectError, + nodeMapping.id, + s"Cannot find class term with alias $classTermId", + entry.value.location + ) + } + } + ) + + map.key( + "additionalProperties", + entry => { + val value = entry.value.as[Boolean] + val negated = !value + nodeMapping.set(NodeMappingModel.Closed, AmfScalar(negated, Annotations.inferred()), Annotations(entry)) + } + ) + + map.key( + "patch", + entry => { + val patchMethod = ScalarNode(entry.value).string() + nodeMapping.set(NodeMappingModel.MergePolicy, patchMethod, Annotations(entry)) + val patchMethodValue = patchMethod.toString + if (!MergePolicies.isAllowed(patchMethodValue)) { + ctx.eh.violation( + DialectError, + nodeMapping.id, + s"Unsupported node mapping patch operation '$patchMethod'", + entry.value.location + ) + } + } + ) + + map.key( + "mapping", + entry => { + val properties = entry.value.as[YMap].entries.map { entry => + parsePropertyMapping( + entry, + propertyMapping => + propertyMapping + .adopted(nodeMapping.id + "/property/" + entry.key.as[YScalar].text.urlComponentEncoded), + nodeMapping.id + ) + } + val (withTerm, withoutTerm) = properties.partition(_.nodePropertyMapping().option().nonEmpty) + val filterProperties: immutable.Iterable[PropertyMapping] = withTerm + .filter(_.nodePropertyMapping().option().nonEmpty) + .legacyGroupBy(p => p.nodePropertyMapping().value()) + .flatMap({ + case (termKey, values) if values.length > 1 => + ctx.eh.violation( + DialectError, + values.head.id, + s"Property term value must be unique in a node mapping. Term $termKey repeated", + values.head.annotations + ) + values.headOption + case other => other._2.headOption + }) + nodeMapping.setArrayWithoutId( + NodeMappingModel.PropertiesMapping, + withoutTerm ++ filterProperties.toSeq, + Annotations(entry) + ) + } + ) + + map.key( + "extends", + entry => { + val references: Seq[YNode] = entry.value.tagType match { + case YType.Seq => entry.value.as[YSequence].nodes + case YType.Str => Seq(entry.value) + case tagType => + ctx.eh.violation( + SyamlError, + "", + s"${YType.Seq} or ${YType.Str} expected in 'extends', found [$tagType]", + entry.value.location + ) + Seq.empty + } + val parsed = references.map { node: YNode => + val reference = node.toOption[YScalar] + reference match { + case Some(_) => + ( + reference, + NodeMappingLikeParser.resolveNodeMappingLink(map, node, adopt) + ) // we don't need to adopt, it is a link + case _ => (reference, None) + } + } + val resolved: Seq[NodeMapping] = parsed.flatMap { + case (_, Some(resolvedNodeMapping: NodeMapping)) => + Seq(resolvedNodeMapping) + case (reference, None) => + ctx.eh.violation( + DialectError, + nodeMapping.id, + s"Cannot find extended node mapping with reference '${reference.map(_.toString()).getOrElse("")}'", + entry.value.location + ) + Nil + } + // we need a different Id for each link, adopt makes them equal, but we cannot just reuse the link id because of the + // mechanism to resolve references, based on the URL of the base document. + // this is a hack to get unique IDs + nodeMapping.withExtends(resolved).extend.zipWithIndex.foreach { case (e, i) => + e.withId(s"${e.id}-link-extends-${i}") + } + } + ) + + map.parse("idTemplate", nodeMapping setParsing NodeMappingModel.IdTemplate) + map.key( + "idTemplate", + entry => { + val idTemplate = entry.value.as[String] + val base = BaseDirective.baseFrom(idTemplate) + if (base.contains('{')) { + ctx.eh.warning( + VariablesDefinedInBase, + nodeMapping.id, + s"Base $base contains idTemplate variables overridable by $$base directive", + entry.value.location + ) + } + } + ) + + nodeMapping.idTemplate.option().foreach(validateTemplate(_, map, nodeMapping.propertiesMapping())) + + parseAnnotations(map, nodeMapping, ctx.declarations) + + ctx.declarations.+=(nodeMapping) + + nodeMapping + + } + + private def parsePropertyMapping(entry: YMapEntry, adopt: PropertyMapping => Any, nodeId: String): PropertyMapping = { + val name = ScalarNode(entry.key).string() + entry.value.tagType match { + case YType.Map => + val map = entry.value.as[YMap] + val propertyMapping = PropertyMapping(entry.value).set(PropertyMappingModel.Name, name, Annotations(entry.key)) + + adopt(propertyMapping) + ctx.closedNode("propertyMapping", propertyMapping.id, map) + + PropertyLikeMappingParser(map, propertyMapping).parse() + + parsePatch(map, propertyMapping) + parseAnnotations(map, propertyMapping, ctx.declarations) + parseDefault(map, propertyMapping) + propertyMapping + case _ => + val p = PropertyMapping(Annotations(entry)).set(PropertyMappingModel.Name, name, Annotations(entry.key)) + ctx.eh.violation( + DialectValidations.PropertyMappingMustBeAMap, + nodeId, + s"Property mapping $name must be a map", + entry.location + ) + p + } + } + + private def parsePatch(map: YMap, propertyMapping: PropertyMapping): Unit = { + map.key( + "patch", + entry => { + val patchMethod = ScalarNode(entry.value).string() + propertyMapping.set(PropertyMappingModel.MergePolicy, patchMethod, Annotations(entry)) + val patchMethodValue = patchMethod.toString + if (!MergePolicies.isAllowed(patchMethodValue)) { + ctx.eh.violation( + DialectError, + propertyMapping.id, + s"Unsupported property mapping patch operation '$patchMethod'", + entry.value.location + ) + } + } + ) + } + + private def parseMapKey(map: YMap, propertyMapping: PropertyMapping): Unit = { + val mapKey = map.key("mapKey") + val mapTermKey = map.key("mapTermKey") + + for { + _ <- mapKey + _ <- mapTermKey + } yield { + ctx.eh.violation(DialectError, propertyMapping.id, s"mapKey and mapTermKey are mutually exclusive", map.location) + } + + mapTermKey.fold({ + mapKey.foreach(entry => { + val propertyLabel = ValueNode(entry.value).string().toString + propertyMapping.withMapKeyProperty(propertyLabel, Annotations(entry.value)) + }) + })(entry => { + val propertyTermId = ValueNode(entry.value).string().toString + getTermIfValid(propertyTermId, propertyMapping.id, entry.value).foreach { p => + propertyMapping.withMapTermKeyProperty(p, Annotations(entry.value)) + } + }) + } + + private def parseMapValue(map: YMap, propertyMapping: PropertyMapping): Unit = { + val mapValue = map.key("mapValue") + val mapTermValue = map.key("mapTermValue") + + for { + _ <- mapValue + _ <- mapTermValue + } yield { + ctx.eh + .violation(DialectError, propertyMapping.id, s"mapValue and mapTermValue are mutually exclusive", map.location) + } + + mapTermValue.fold({ + mapValue.foreach(entry => { + val propertyLabel = ValueNode(entry.value).string().toString + propertyMapping.withMapValueProperty(propertyLabel, Annotations(entry.value)) + }) + })(entry => { + val propertyTermId = ValueNode(entry.value).string().toString + getTermIfValid(propertyTermId, propertyMapping.id, entry.value).foreach { p => + propertyMapping.withMapTermValueProperty(p, Annotations(entry.value)) + } + }) + + } + + private def getTermIfValid(iri: String, propertyMappingId: String, ast: YPart): Option[String] = { + Namespace(iri).base match { + case Namespace.Data.base => Some(iri) + case _ => + ctx.declarations.findPropertyTerm(iri, All) match { + case Some(term) => Some(term.id) + case _ => + ctx.eh + .violation(DialectError, propertyMappingId, s"Cannot find property term with alias $iri", ast.location) + None + } + } + } + + def validateTemplate(template: String, map: YMap, propMappings: Seq[PropertyMapping]): Unit = { + getVariablesFromTemplate(template).foreach { variable => + propMappings.find(_.name().value() == variable) match { + case Some(prop) if !prop.isMandatory => + ctx.eh.violation( + DialectError, + prop.id, + s"PropertyMapping for idTemplate variable '$variable' must be mandatory", + map.location + ) + case None => + ctx.eh + .violation(DialectError, "", s"Missing propertyMapping for idTemplate variable '$variable'", map.location) + case _ => // ignore + } + } + + def getVariablesFromTemplate(template: String): Iterator[String] = { + val regex = "(\\{[^}]+\\})".r + regex.findAllIn(template).map { varMatch => + varMatch.replace("{", "").replace("}", "") + } + } + } + +} + +object NodeMappingParser { + def apply()(implicit ctx: DialectContext): NodeMappingParser = new NodeMappingParser +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/nodemapping/like/UnionNodeMappingParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/nodemapping/like/UnionNodeMappingParser.scala new file mode 100644 index 00000000..7e06e353 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/nodemapping/like/UnionNodeMappingParser.scala @@ -0,0 +1,76 @@ +package amf.aml.internal.parse.dialects.nodemapping.like + +import amf.aml.client.scala.model.domain.UnionNodeMapping +import amf.aml.internal.metamodel.domain.UnionNodeMappingModel +import amf.aml.internal.metamodel.domain.UnionNodeMappingModel.ObjectRange +import amf.aml.internal.parse.dialects.DialectAstOps.{DialectScalarValueEntryParserOpts, DialectYMapOps} +import amf.aml.internal.parse.dialects.DialectContext +import amf.aml.internal.validate.DialectValidations.DialectError +import amf.core.client.scala.model.domain.{AmfArray, AmfScalar, DomainElement} +import amf.core.internal.parser.domain.Annotations +import org.yaml.model.{YMap, YScalar, YSequence, YType} + +class UnionNodeMappingParser(implicit ctx: DialectContext) + extends NodeMappingLikeParserInterface + with AnyMappingParser { + + override def parse(map: YMap, adopt: DomainElement => Any, isFragment: Boolean): UnionNodeMapping = { + + val unionNodeMapping = UnionNodeMapping(map) + adopt(unionNodeMapping) + + super.parse(map, unionNodeMapping) + + map.key( + "union", + entry => { + entry.value.tagType match { + case YType.Seq => + try { + val nodes = MappingParsingHelper.entrySeqNodesToString(entry) + unionNodeMapping.set(ObjectRange, AmfArray(nodes, Annotations(entry.value)), Annotations(entry)) + } catch { + case _: Exception => + ctx.eh.violation( + DialectError, + unionNodeMapping.id, + s"Union node mappings must be declared as lists of node mapping references", + entry.value.location + ) + } + case _ => + ctx.eh.violation( + DialectError, + unionNodeMapping.id, + s"Union node mappings must be declared as lists of node mapping references", + entry.value.location + ) + } + } + ) + + map.key( + "typeDiscriminator", + entry => { + val types = entry.value.as[YMap] + val typeMapping = types.entries.foldLeft(Map[String, String]()) { case (acc, e) => + val nodeMappingId = e.value.as[YScalar].text + acc + (e.key.as[YScalar].text -> nodeMappingId) + } + unionNodeMapping.withTypeDiscriminator(typeMapping, Annotations(entry), Annotations(types)) + } + ) + + map.parse("typeDiscriminatorName", unionNodeMapping setParsing UnionNodeMappingModel.TypeDiscriminatorName) + + unionNodeMapping + } + +} + +object UnionNodeMappingParser { + + val identifierKey: String = "union" + + def apply()(implicit ctx: DialectContext) = new UnionNodeMappingParser +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/AnnotationMappingParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/AnnotationMappingParser.scala index 75485279..022be271 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/AnnotationMappingParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/AnnotationMappingParser.scala @@ -8,41 +8,66 @@ import amf.aml.internal.parse.common.AnnotationsParser import amf.aml.internal.parse.common.AnnotationsParser.parseAnnotations import amf.aml.internal.parse.dialects.DialectContext import amf.aml.internal.validate.DialectValidations.DialectError -import org.yaml.model.{YMap, YMapEntry, YType} +import amf.core.client.scala.model.domain.{AmfArray, AmfScalar} +import amf.core.internal.annotations.SingleValueArray +import amf.core.internal.validation.CoreValidations.SyamlError +import amf.core.internal.validation.core.ValidationSpecification +import org.yaml.model.{YMap, YMapEntry, YPart, YSequence, YType} + +import javax.naming.directory.SearchControls case class AnnotationMappingParser(entry: YMapEntry, parent: String)(implicit val ctx: DialectContext) { - def parse(): Option[AnnotationMapping] = { + def parse(): AnnotationMapping = { val name = entry.key.toString + val annotationMapping = AnnotationMapping(Annotations(entry)) + .set(AnnotationMappingModel.Name, name, Annotations(entry.key)) + .withId(s"$parent/$name") entry.value.tagType match { case YType.Map => val map = entry.value.as[YMap] - val annotationMapping = AnnotationMapping(map) - .set(AnnotationMappingModel.Name, name, Annotations(entry.key)) - .withId(s"$parent/$name") ctx.closedNode("annotationMapping", annotationMapping.id, map) PropertyLikeMappingParser(map, annotationMapping).parse() parseDomain(map, annotationMapping) parseAnnotations(map, annotationMapping, ctx.declarations) - Some(annotationMapping) + annotationMapping case t => ctx.eh - .violation(DialectError, - parent, - s"Invalid type $t (expected ${YType.Map}) for annotation mapping node $name", - entry.value.location) - None + .violation( + DialectError, + parent, + s"Invalid type $t (expected ${YType.Map}) for annotation mapping node $name", + entry.value.location + ) + annotationMapping } } private def parseDomain(ast: YMap, parsedAnnotationMapping: AnnotationMapping): Unit = { - for { - domainEntry <- ast.key("domain") - classTerm <- ctx.declarations.findClassTerm(domainEntry.value.toString, SearchScope.All) - } yield { - parsedAnnotationMapping.set(AnnotationMappingModel.Domain, classTerm.id, Annotations(domainEntry)) + ast.key("domain").map { entry => + entry.value.tagType match { + case YType.Str => + val classTerm = entry.value.asScalar.flatMap(scalar => scalarForClassTerm(scalar.text, scalar)) + parsedAnnotationMapping.set( + AnnotationMappingModel.Domain, + AmfArray(classTerm.toSeq, Annotations.virtual() += SingleValueArray()), + Annotations(entry) + ) + case YType.Seq => + val nodes = entry.value.as[YSequence] + val classTermScalars = nodes.nodes.flatMap(node => scalarForClassTerm(node.value.toString, node)) + parsedAnnotationMapping + .set(AnnotationMappingModel.Domain, AmfArray(classTermScalars, Annotations(nodes)), Annotations(entry)) + case other => + ctx.eh.violation(SyamlError, parsedAnnotationMapping, s"Expected array or string, got: $other", entry.value) + parsedAnnotationMapping + } } } + private def scalarForClassTerm(value: String, ast: YPart): Option[AmfScalar] = { + ctx.declarations.findClassTerm(value, SearchScope.All).map(x => AmfScalar(x.id, Annotations(ast))) + } + } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/EnumParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/EnumParser.scala index 8bc5f7c4..c26f4f13 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/EnumParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/EnumParser.scala @@ -7,27 +7,29 @@ import amf.aml.internal.metamodel.domain.PropertyLikeMappingModel import amf.aml.client.scala.model.domain.PropertyLikeMapping import amf.aml.internal.parse.dialects.DialectContext import amf.aml.internal.validate.DialectValidations.DialectError -import org.yaml.model.{YMap, YScalar, YSequence} +import org.yaml.model.{YMap, YScalar, YSequence, YType} -case class EnumParser(map: YMap, propertyLikeMapping: PropertyLikeMapping[_ <: PropertyLikeMappingModel])( - implicit ctx: DialectContext) { +case class EnumParser(map: YMap, propertyLikeMapping: PropertyLikeMapping[_ <: PropertyLikeMappingModel])(implicit + ctx: DialectContext +) { def parse(): Unit = { map.key( - "enum", - entry => { - val seq = entry.value.as[YSequence] - val values = seq.nodes.flatMap { node => - node.value match { - case scalar: YScalar => Some(ScalarNode(node).string()) - case _ => - ctx.eh.violation(DialectError, "Cannot create enumeration constraint from not scalar value", node) - None - } + "enum", + entry => { + val seq = entry.value.as[YSequence] + val values = seq.nodes.flatMap { node => + node.tagType match { + case YType.Int => Some(ScalarNode(node).integer()) + case YType.Float => Some(ScalarNode(node).double()) + case YType.Str => Some(ScalarNode(node).string()) + case YType.Bool => Some(ScalarNode(node).boolean()) + case _ => + ctx.eh.violation(DialectError, "Cannot create enumeration constraint from not scalar value", node) + None } - propertyLikeMapping.set(propertyLikeMapping.meta.Enum, - AmfArray(values, Annotations(seq)), - Annotations(entry)) } + propertyLikeMapping.set(propertyLikeMapping.meta.Enum, AmfArray(values, Annotations(seq)), Annotations(entry)) + } ) } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/ExternalLinksParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/ExternalLinksParser.scala index b1042741..ba0430c2 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/ExternalLinksParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/ExternalLinksParser.scala @@ -8,22 +8,24 @@ import amf.aml.internal.validate.DialectValidations.DialectError import org.yaml.model.YMap case class ExternalLinksParser(map: YMap, propertyLikeMapping: PropertyLikeMapping[_ <: PropertyLikeMappingModel])( - implicit ctx: DialectContext) { + implicit ctx: DialectContext +) { def parse(): Unit = { map.key( - "isLink", - entry => { - val isLink = entry.value.as[Boolean] - propertyLikeMapping.withExternallyLinkable(isLink) - propertyLikeMapping.literalRange().option() match { - case Some(v) => - ctx.eh.violation( - DialectError, - s"Aml links support in property mappings only can be declared in object properties but scalar range detected: $v", - entry.value) - case _ => // ignore - } + "isLink", + entry => { + val isLink = entry.value.as[Boolean] + propertyLikeMapping.withExternallyLinkable(isLink) + propertyLikeMapping.literalRange().option() match { + case Some(v) => + ctx.eh.violation( + DialectError, + s"Aml links support in property mappings only can be declared in object properties but scalar range detected: $v", + entry.value + ) + case _ => // ignore } + } ) } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/MandatoryParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/MandatoryParser.scala index af75d483..47403843 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/MandatoryParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/MandatoryParser.scala @@ -6,21 +6,80 @@ import amf.core.internal.parser.domain.{Annotations, ScalarNode} import amf.aml.internal.metamodel.domain.PropertyLikeMappingModel import amf.aml.client.scala.model.domain.PropertyLikeMapping import amf.aml.internal.parse.dialects.DialectContext -import org.yaml.model.YMap +import amf.core.internal.annotations.VirtualElement +import org.yaml.model.{YMap, YMapEntry} -case class MandatoryParser(map: YMap, propertyLikeMapping: PropertyLikeMapping[_ <: PropertyLikeMappingModel])( - implicit val ctx: DialectContext) { +import scala.language.implicitConversions + +case class MandatoryParser(map: YMap, propertyLikeMapping: PropertyLikeMapping[_ <: PropertyLikeMappingModel])(implicit + val ctx: DialectContext +) { def parse(): Unit = { - map.key( - "mandatory", - entry => { - val required = ScalarNode(entry.value).boolean().toBool - val value = if (required) 1 else 0 - propertyLikeMapping.set(propertyLikeMapping.meta.MinCount, - AmfScalar(value, Annotations(entry.value)), - Annotations(entry)) - } - ) + + // If I have minItems and mandatory ==> minCount = minItems & mandatory = mandatory + // If I have only mandatory ==> minCount = mandatory.toInt + // If I have only minItems ==> minCount = minItems & mandatory = false + + // This combined logic is to allow to validate empty arrays ([]) + + val minItems = parseMinItems + val mandatory = parseMandatory + val existsMinItems = minItems.nonEmpty + val existsMandatory = mandatory.nonEmpty + + // If minItems key exists, it will always be saved in MinCount field + if (existsMinItems && propertyLikeMapping.isMultiple) { + val minItemsValue = minItems.get.value + val minItemsEntry = minItems.get.entry + propertyLikeMapping.set( + propertyLikeMapping.meta.MinCount, + AmfScalar(minItemsValue, Annotations(minItemsEntry.value)), + Annotations(minItemsEntry) + ) + } + + // Mandatory key will be processed based on the presence or not of minItems key + if (existsMandatory) { + val mandatoryValue = mandatory.get.value + val mandatoryEntry = mandatory.get.entry + // If mandatory and minItems keys exist, mandatory will be saved as a boolean in Mandatory field + if (existsMinItems) { + propertyLikeMapping.set( + propertyLikeMapping.meta.Mandatory, + AmfScalar(mandatoryValue.toBoolean, Annotations(mandatoryEntry.value)), + Annotations(mandatoryEntry) + ) + } else { + // If mandatory key exists but minItems key not, mandatory will be saved in MinCount field (the original behavior) + propertyLikeMapping.set( + propertyLikeMapping.meta.MinCount, + AmfScalar(mandatoryValue, Annotations(mandatoryEntry.value)), + Annotations(mandatoryEntry) + ) + } + } else if (existsMinItems) + propertyLikeMapping.set(propertyLikeMapping.meta.Mandatory, AmfScalar(false), Annotations(VirtualElement())) + // If minItems key exists but mandatory key not, the field Mandatory will be set as false + } + private def parseMandatory: Option[ParsedEntry] = map.key("mandatory").map { entry => + val required = ScalarNode(entry.value).boolean().toBool + val value = if (required) 1 else 0 + ParsedEntry(value, entry) + } + + private def parseMinItems: Option[ParsedEntry] = map.key("minItems").map { entry => + val value = ScalarNode(entry.value).integer().toNumber.intValue() + ParsedEntry(value, entry) + } + + private case class ParsedEntry(value: Int, entry: YMapEntry) + + class asBoolean(i: Int) { + def toBoolean: Boolean = i == 1 + } + + implicit def convertIntToBoolean(i: Int): asBoolean = new asBoolean(i) + } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/PropertyLikeMappingParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/PropertyLikeMappingParser.scala index e49b7a71..7e0c5fae 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/PropertyLikeMappingParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/PropertyLikeMappingParser.scala @@ -6,11 +6,15 @@ import amf.aml.client.scala.model.domain.{PropertyLikeMapping, PropertyMapping} import amf.aml.internal.parse.dialects.DialectAstOps.{DialectYMapOps, _} import amf.aml.internal.parse.dialects.DialectContext import amf.aml.internal.validate.DialectValidations +import amf.aml.internal.validate.DialectValidations.DialectError +import amf.core.internal.parser.domain.SearchScope.All +import amf.core.internal.parser.domain.{Annotations, ValueNode} import org.yaml.model.{YMap, YPart} case class PropertyLikeMappingParser[T <: PropertyLikeMapping[_ <: PropertyLikeMappingModel]]( map: YMap, - propertyLikeMapping: T)(implicit val ctx: DialectContext) { + propertyLikeMapping: T +)(implicit val ctx: DialectContext) { def parse(): Unit = { val meta = propertyLikeMapping.meta @@ -22,6 +26,9 @@ case class PropertyLikeMappingParser[T <: PropertyLikeMapping[_ <: PropertyLikeM map.parse("sorted", propertyLikeMapping setParsing meta.Sorted) map.parse("typeDiscriminatorName", propertyLikeMapping setParsing meta.TypeDiscriminatorName) + parseMapKey() + parseMapValue() + MandatoryParser(map, propertyLikeMapping).parse() PropertyTermParser(map, propertyLikeMapping).parse() RangeParser(map, propertyLikeMapping).parse() @@ -37,13 +44,77 @@ case class PropertyLikeMappingParser[T <: PropertyLikeMapping[_ <: PropertyLikeM propertyLikeMapping.literalRange().option() foreach { literal => if (literal == (Namespace.Shapes + "guid").iri() && !propertyLikeMapping.unique().option().getOrElse(false)) { ctx.eh.warning( - DialectValidations.GuidRangeWithoutUnique, - propertyLikeMapping.id, - s"Declaration of property '${propertyLikeMapping.name().value()}' with range GUID and without unique constraint", - ast.location + DialectValidations.GuidRangeWithoutUnique, + propertyLikeMapping.id, + s"Declaration of property '${propertyLikeMapping.name().value()}' with range GUID and without unique constraint", + ast.location ) } } } + private def parseMapKey(): Unit = { + val mapKey = map.key("mapKey") + val mapTermKey = map.key("mapTermKey") + + for { + _ <- mapKey + _ <- mapTermKey + } yield { + ctx.eh.violation(DialectError, propertyLikeMapping.id, s"mapKey and mapTermKey are mutually exclusive", map.location) + } + + mapTermKey.fold({ + mapKey.foreach(entry => { + val propertyLabel = ValueNode(entry.value).string().toString + propertyLikeMapping.withMapKeyProperty(propertyLabel, Annotations(entry.value)) + }) + })(entry => { + val propertyTermId = ValueNode(entry.value).string().toString + getTermIfValid(propertyTermId, propertyLikeMapping.id, entry.value).foreach { p => + propertyLikeMapping.withMapTermKeyProperty(p, Annotations(entry.value)) + } + }) + } + + private def parseMapValue(): Unit = { + val mapValue = map.key("mapValue") + val mapTermValue = map.key("mapTermValue") + + for { + _ <- mapValue + _ <- mapTermValue + } yield { + ctx.eh + .violation(DialectError, propertyLikeMapping.id, s"mapValue and mapTermValue are mutually exclusive", map.location) + } + + mapTermValue.fold({ + mapValue.foreach(entry => { + val propertyLabel = ValueNode(entry.value).string().toString + propertyLikeMapping.withMapValueProperty(propertyLabel, Annotations(entry.value)) + }) + })(entry => { + val propertyTermId = ValueNode(entry.value).string().toString + getTermIfValid(propertyTermId, propertyLikeMapping.id, entry.value).foreach { p => + propertyLikeMapping.withMapTermValueProperty(p, Annotations(entry.value)) + } + }) + + } + + private def getTermIfValid(iri: String, propertyMappingId: String, ast: YPart): Option[String] = { + Namespace(iri).base match { + case Namespace.Data.base => Some(iri) + case _ => + ctx.declarations.findPropertyTerm(iri, All) match { + case Some(term) => Some(term.id) + case _ => + ctx.eh + .violation(DialectError, propertyMappingId, s"Cannot find property term with alias $iri", ast.location) + None + } + } + } + } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/PropertyTermParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/PropertyTermParser.scala index 3412e891..8ff104cd 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/PropertyTermParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/PropertyTermParser.scala @@ -13,10 +13,10 @@ import amf.aml.internal.validate.DialectValidations.DialectError import org.yaml.model.YMap case class PropertyTermParser(map: YMap, propertyLikeMapping: PropertyLikeMapping[_ <: PropertyLikeMappingModel])( - implicit val ctx: DialectContext) { + implicit val ctx: DialectContext +) { - /** - * Requires that the property like mapping has a name for fallback to work + /** Requires that the property like mapping has a name for fallback to work */ def parse(): Unit = { map.key("propertyTerm") match { @@ -25,14 +25,18 @@ case class PropertyTermParser(map: YMap, propertyLikeMapping: PropertyLikeMappin val propertyTermId = value.string().toString ctx.declarations.findPropertyTerm(propertyTermId, SearchScope.All) match { case Some(propertyTerm) => - propertyLikeMapping.set(NodePropertyMapping, - AmfScalar(propertyTerm.id, Annotations(e.value)), - Annotations(e)) + propertyLikeMapping.set( + NodePropertyMapping, + AmfScalar(propertyTerm.id, Annotations(e.value)), + Annotations(e) + ) case _ => - ctx.eh.violation(DialectError, - propertyLikeMapping.id, - s"Cannot find property term with alias $propertyTermId", - e.value.location) + ctx.eh.violation( + DialectError, + propertyLikeMapping.id, + s"Cannot find property term with alias $propertyTermId", + e.value.location + ) } case _ => val name = propertyLikeMapping.name().value() diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/RangeParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/RangeParser.scala index e0d6e74d..35c81343 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/RangeParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/RangeParser.scala @@ -11,40 +11,42 @@ import amf.aml.client.scala.model.domain.PropertyLikeMapping import amf.aml.internal.parse.dialects.DialectContext import org.yaml.model.{YMap, YMapEntry, YSequence, YType} -case class RangeParser(map: YMap, propertyLikeMapping: PropertyLikeMapping[_ <: PropertyLikeMappingModel])( - implicit val ctx: DialectContext) { +case class RangeParser(map: YMap, propertyLikeMapping: PropertyLikeMapping[_ <: PropertyLikeMappingModel])(implicit + val ctx: DialectContext +) { def parse(): Unit = { map.key( - "range", - entry => { - entry.value.tagType match { - case YType.Seq => - val scalars = entry.value.as[YSequence].nodes.map(ScalarNode(_).text()) - propertyLikeMapping.set(ObjectRange, AmfArray(scalars, Annotations(entry.value)), Annotations(entry)) - case _ => - val value = ValueNode(entry.value) - val range = value.string().toString - range match { - case "guid" => - setLiteralRange((Namespace.Shapes + "guid").iri(), entry) - case "string" | "integer" | "boolean" | "float" | "decimal" | "double" | "duration" | "dateTime" | - "time" | "date" | "anyType" => - setLiteralRange((Namespace.Xsd + range).iri(), entry) - case "anyUri" => setLiteralRange(DataType.AnyUri, entry) - case "link" => setLiteralRange((Namespace.Shapes + "link").iri(), entry) - case "number" => setLiteralRange(DataType.Number, entry) - case "uri" => setLiteralRange(DataType.AnyUri, entry) - case "any" => setLiteralRange(DataType.Any, entry) - case "anyNode" => propertyLikeMapping.withObjectRange(Seq((Namespace.Meta + "anyNode").iri())) - case nodeMappingId => - // temporary until we can resolve all nodeMappings after finishing parsing declarations - propertyLikeMapping.set( - ObjectRange, - AmfArray(Seq(AmfScalar(nodeMappingId, Annotations(entry.value))), Annotations.virtual()), - Annotations(entry)) - } - } + "range", + entry => { + entry.value.tagType match { + case YType.Seq => + val scalars = entry.value.as[YSequence].nodes.map(ScalarNode(_).text()) + propertyLikeMapping.set(ObjectRange, AmfArray(scalars, Annotations(entry.value)), Annotations(entry)) + case _ => + val value = ValueNode(entry.value) + val range = value.string().toString + range match { + case "guid" => + setLiteralRange((Namespace.Shapes + "guid").iri(), entry) + case "string" | "integer" | "long" | "boolean" | "float" | "decimal" | "double" | "duration" | + "dateTime" | "time" | "date" | "anyType" => + setLiteralRange((Namespace.Xsd + range).iri(), entry) + case "anyUri" => setLiteralRange(DataType.AnyUri, entry) + case "link" => setLiteralRange((Namespace.Shapes + "link").iri(), entry) + case "number" => setLiteralRange(DataType.Number, entry) + case "uri" => setLiteralRange(DataType.AnyUri, entry) + case "any" => setLiteralRange(DataType.Any, entry) + case "anyNode" => propertyLikeMapping.withObjectRange(Seq((Namespace.Meta + "anyNode").iri())) + case nodeMappingId => + // temporary until we can resolve all nodeMappings after finishing parsing declarations + propertyLikeMapping.set( + ObjectRange, + AmfArray(Seq(AmfScalar(nodeMappingId, Annotations(entry.value))), Annotations.virtual()), + Annotations(entry) + ) + } } + } ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/TypeDiscriminatorParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/TypeDiscriminatorParser.scala index 1d2af428..e3545c6c 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/TypeDiscriminatorParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/dialects/property/like/TypeDiscriminatorParser.scala @@ -8,19 +8,19 @@ import amf.aml.internal.parse.dialects.DialectContext import org.yaml.model.{YMap, YScalar} case class TypeDiscriminatorParser(map: YMap, propertyLikeMapping: PropertyLikeMapping[_ <: PropertyLikeMappingModel])( - implicit val ctx: DialectContext) { + implicit val ctx: DialectContext +) { def parse(): Unit = { map.key( - "typeDiscriminator", - entry => { - val types = entry.value.as[YMap] - val typeMapping = types.entries.foldLeft(Map[String, String]()) { - case (acc, e) => - val nodeMappingId = e.value.as[YScalar].text - acc + (e.key.as[YScalar].text -> nodeMappingId) - } - propertyLikeMapping.withTypeDiscriminator(typeMapping, Annotations(entry), Annotations(types)) + "typeDiscriminator", + entry => { + val types = entry.value.as[YMap] + val typeMapping = types.entries.foldLeft(Map[String, String]()) { case (acc, e) => + val nodeMappingId = e.value.as[YScalar].text + acc + (e.key.as[YScalar].text -> nodeMappingId) } + propertyLikeMapping.withTypeDiscriminator(typeMapping, Annotations(entry), Annotations(types)) + } ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/headers/DialectHeader.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/headers/DialectHeader.scala deleted file mode 100644 index 781fbdb8..00000000 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/headers/DialectHeader.scala +++ /dev/null @@ -1,27 +0,0 @@ -package amf.aml.internal.parse.headers - -import amf.core.internal.parser.Root -import org.mulesoft.common.core._ - -object DialectHeader extends RamlHeaderExtractor with JsonHeaderExtractor with KeyPropertyHeaderExtractor { - - /** Fetch header or dialect directive. */ - def apply(document: Root): Option[String] = { - comment(document).orElse(dialect(document).map(metaText => s"%$metaText")).map(_.stripSpaces) - } - - /** - * Extract the root part from a dialect header directive - * e.g. - * Header directive Root part - * #%Library / Dialect 1.0 -> Library - * #%My Fragment / My Test Dialect 1.0 -> My Fragment - */ - def root(document: Root): Option[String] = { - for { - header <- DialectHeader(document) - } yield { - header.substring(1, header.indexOf("/")) - } - } -} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/headers/ExtensionHeader.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/headers/ExtensionHeader.scala deleted file mode 100644 index 103a6205..00000000 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/headers/ExtensionHeader.scala +++ /dev/null @@ -1,12 +0,0 @@ -package amf.aml.internal.parse.headers - -object ExtensionHeader { - - val VocabularyHeader = "%Vocabulary1.0" - - val DialectHeader = "%Dialect1.0" - - val DialectLibraryHeader = "%Library/Dialect1.0" - - val DialectFragmentHeader = "%NodeMapping/Dialect1.0" -} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/headers/extractors.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/headers/extractors.scala deleted file mode 100644 index 023c2f04..00000000 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/headers/extractors.scala +++ /dev/null @@ -1,30 +0,0 @@ -package amf.aml.internal.parse.headers - -import amf.core.client.scala.parse.document.SyamlParsedDocument -import amf.core.internal.parser.{Root, YNodeLikeOps} -import org.yaml.model.{YComment, YDocument, YMap} - -trait RamlHeaderExtractor { - def comment(root: Root): Option[String] = root.parsed.comment - def comment(document: YDocument): Option[YComment] = document.children.collectFirst({ case c: YComment => c }) -} - -trait JsonHeaderExtractor { - def dialect(root: Root): Option[String] = { - root.parsed match { - case parsedInput: SyamlParsedDocument => dialectForDoc(parsedInput.document) - case _ => None - } - } - - private def dialectForDoc(document: YDocument): Option[String] = { - document.node - .toOption[YMap] - .map(_.entries) - .getOrElse(Nil) - .collectFirst({ case e if e.key.asScalar.exists(_.text == "$dialect") => e }) - .flatMap(e => e.value.asScalar.map(_.text)) - } -} - -trait KeyPropertyHeaderExtractor {} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/hints/AMLParsingHints.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/hints/AMLParsingHints.scala new file mode 100644 index 00000000..535b846c --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/hints/AMLParsingHints.scala @@ -0,0 +1,35 @@ +package amf.aml.internal.parse.hints + +import amf.core.client.scala.parse.document.SyamlParsedDocument +import amf.core.internal.parser.{Root, YNodeLikeOps} +import org.yaml.model.YMap +import amf.core.internal.parser.YMapOps + +object YamlDirectiveComment { + def from(root: Root): Option[String] = root.parsed.comment +} + +object $DialectPropertyValue extends PropertyValue { + override val key: String = "$dialect" +} + +object $TypePropertyValue extends PropertyValue { + override val key: String = "$type" +} + +trait PropertyValue { + val key: String + def from(root: Root): Option[String] = { + root.parsed match { + case parsedInput: SyamlParsedDocument => + for { + yMap <- parsedInput.document.node.toOption[YMap] + $typeEntry <- yMap.key(key) + $typeEntryValue <- $typeEntry.value.asScalar + } yield { + $typeEntryValue.text + } + case _ => None + } + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/hints/AmlHeaders.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/hints/AmlHeaders.scala new file mode 100644 index 00000000..868cc6b1 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/hints/AmlHeaders.scala @@ -0,0 +1,8 @@ +package amf.aml.internal.parse.hints + +object AmlHeaders { + + val DIALECT = "%Dialect 1.0" + val DIALECT_LIBRARY = "%Library / Dialect 1.0" + val VOCABULARY = "%Vocabulary 1.0" +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/hints/DialectGuess.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/hints/DialectGuess.scala new file mode 100644 index 00000000..544a979c --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/hints/DialectGuess.scala @@ -0,0 +1,25 @@ +package amf.aml.internal.parse.hints + +import amf.aml.client.scala.model.document.kind +import amf.core.internal.parser.Root + +import scala.util.matching.Regex + +object DialectGuess extends Guess[kind.DialectDocumentKind] { + private lazy val dialect: Regex = "%? *Dialect *1\\.0 *".r + private lazy val fragment: Regex = "%? *Node *Mapping */ *Dialect *1\\.0 *".r + private lazy val library: Regex = "%? *Library */ *Dialect *1\\.0 *".r + + override def from(root: Root): Option[kind.DialectDocumentKind] = hint(root).flatMap(matchHint) + + override def hint(root: Root): Option[String] = YamlDirectiveComment.from(root).orElse($TypePropertyValue.from(root)) + + private def matchHint(hint: String): Option[kind.DialectDocumentKind] = { + hint match { + case fragment(_*) => Some(kind.DialectFragment) + case library(_*) => Some(kind.DialectLibrary) + case dialect(_*) => Some(kind.Dialect) + case _ => None + } + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/hints/DialectInstanceGuess.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/hints/DialectInstanceGuess.scala new file mode 100644 index 00000000..6bf0df38 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/hints/DialectInstanceGuess.scala @@ -0,0 +1,84 @@ +package amf.aml.internal.parse.hints + +import amf.aml.client.scala.model.document.kind.DialectInstanceDocumentKind +import amf.aml.client.scala.model.document.{Dialect, kind} +import amf.core.internal.parser.Root + +import scala.util.matching.Regex + +case class DialectInstanceGuess(dialect: Dialect) extends Guess[kind.DialectInstanceDocumentKind] { + + private val nameR: String = dialect.name().value() + private val versionR: String = dialect.version().value().replace(".", "\\.") + + private lazy val instance: Regex = (s"%? *$nameR *$versionR *").r + private lazy val library: Regex = (s"%? *Library */ *$nameR *$versionR *").r + private lazy val patch: Regex = (s"%? *Patch */ *$nameR *$versionR *").r + private lazy val fragments: Seq[Regex] = { + dialect + .documents() + .fragments() + .map { f => + val fragmentNameR = f.documentName().value() + (s"%? *$fragmentNameR */ *$nameR *$versionR *").r + } + } + + override def from(root: Root): Option[kind.DialectInstanceDocumentKind] = { + if (dialect.usesKeyPropertyMatching) { + matchByKeyProperty(root) + } else { + matchByHint(root) + } + } + + override def hint(root: Root): Option[String] = + YamlDirectiveComment.from(root).orElse($DialectPropertyValue.from(root)) + + private def matchByHint(root: Root): Option[kind.DialectInstanceDocumentKind] = { + for { + hint <- hint(root) + kind <- { + hint.split(" *\\| *") match { + case Array(hint, dialectUri) => matchByHintAndUri(hint, dialectUri) + case _ => matchHint(hint) + } + } + } yield { + kind + } + } + + def matchHint(hint: String): Option[DialectInstanceDocumentKind] = { + hint match { + case library(_*) => Some(kind.DialectInstanceLibrary) + case patch(_*) => Some(kind.DialectInstancePatch) + case instance(_*) => Some(kind.DialectInstance) + case _ if fragments.exists(fragment => fragment.findFirstIn(hint).isDefined) => Some(kind.DialectInstanceFragment) + case _ => None + } + } + + private def matchByKeyProperty(root: Root): Option[kind.DialectInstanceDocumentKind] = { + val name = dialect.name().value() + val version = dialect.version().value() + + val keyPropertyValue = new PropertyValue { + override val key: String = name + } + + // We can only define dialect instances (not fragments, etc.) with key properties + keyPropertyValue.from(root) match { + case Some(`version`) => Some(kind.DialectInstance) + case _ => None + } + } + + private def matchByHintAndUri(hint: String, dialectUri: String) = { + if (dialectUri.stripPrefix("<").stripSuffix(">") == dialect.id) { + matchHint(hint) + } else { + None + } + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/hints/Guess.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/hints/Guess.scala new file mode 100644 index 00000000..003ea34b --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/hints/Guess.scala @@ -0,0 +1,22 @@ +package amf.aml.internal.parse.hints + +import amf.aml.client.scala.model.document.kind.AMLDocumentKind +import amf.core.internal.parser.Root + +trait Guess[T <: AMLDocumentKind] { + + /** Extracts the parsing hint from AST content + * @param root + * parsed AST + * @return + */ + def hint(root: Root): Option[String] + + /** Guesses the content of an AST. Returns Some[AMLDocumentKind] when it can match some known document kind, None + * otherwise. + * @param root + * parsed AST + * @return + */ + def from(root: Root): Option[T] +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/hints/VocabularyGuess.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/hints/VocabularyGuess.scala new file mode 100644 index 00000000..9dbd2687 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/hints/VocabularyGuess.scala @@ -0,0 +1,22 @@ +package amf.aml.internal.parse.hints + +import amf.aml.client.scala.model.document.kind +import amf.core.internal.parser.Root + +import scala.util.matching.Regex + +object VocabularyGuess extends Guess[kind.Vocabulary.type] { + private lazy val vocabulary: Regex = "%? *Vocabulary *1\\.0 *".r + + override def from(root: Root): Option[kind.Vocabulary.type] = hint(root).flatMap(matchHint) + + override def hint(root: Root): Option[String] = + YamlDirectiveComment.from(root).orElse($TypePropertyValue.from(root)) + + private def matchHint(hint: String): Option[kind.Vocabulary.type] = { + hint match { + case vocabulary(_*) => Some(kind.Vocabulary) + case _ => None + } + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/BaseDirective.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/BaseDirective.scala index 588f5d12..f1d3da58 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/BaseDirective.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/BaseDirective.scala @@ -6,9 +6,8 @@ import amf.aml.internal.parse.instances.BaseDirective.baseFrom import scala.util.matching.Regex -/** - * Base of an URI (spec definition): the beginning part of a URI until the first (inclusive) '#' character or else - * the first '/' character (excluding the ones from the protocol) if no '#' character is defined +/** Base of an URI (spec definition): the beginning part of a URI until the first (inclusive) '#' character or else the + * first '/' character (excluding the ones from the protocol) if no '#' character is defined */ trait BaseDirectiveOverride { @@ -30,10 +29,11 @@ object BaseDirective { val HashRegex: Regex = "(http://|file://)?([^#]*)#(.*)".r("protocol", "base", "tail") val SlashRegex: Regex = "(http://|file://)?([^/]*)/(.*)".r("protocol", "base", "tail") - /** - * Extracts the base from the supplied URI - * @param uri input uri - * @return base if defined, whole uri otherwise + /** Extracts the base from the supplied URI + * @param uri + * input uri + * @return + * base if defined, whole uri otherwise */ def baseFrom(uri: String): String = { uri match { diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/ClosedInstanceNode.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/ClosedInstanceNode.scala index 6d932d32..86b4eda7 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/ClosedInstanceNode.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/ClosedInstanceNode.scala @@ -5,42 +5,50 @@ import org.yaml.model.{YNode, YPart, YScalar} object ClosedInstanceNode { - def checkNode(id: String, - nodetype: String, - entries: Map[YNode, YNode], - mapping: NodeMapping, - ast: YPart, - rootNode: Boolean, - additionalKey: Option[String])(implicit ctx: DialectInstanceContext): Unit = { + def checkNode( + id: String, + nodetype: String, + entries: Map[YNode, YNode], + mapping: NodeMapping, + ast: YPart, + rootNode: Boolean, + additionalKey: Option[String] + )(implicit ctx: DialectInstanceContext): Unit = { if (rootNode) checkRootNode(id, nodetype, entries, mapping, ast, additionalKey) else checkClosedNode(id, nodetype, entries, mapping, ast, additionalKey) } - def checkRootNode(id: String, - nodetype: String, - entries: Map[YNode, YNode], - mapping: NodeMapping, - ast: YPart, - additionalKey: Option[String])(implicit ctx: DialectInstanceContext): Unit = { + def checkRootNode( + id: String, + nodetype: String, + entries: Map[YNode, YNode], + mapping: NodeMapping, + ast: YPart, + additionalKey: Option[String] + )(implicit ctx: DialectInstanceContext): Unit = { val excluded = ctx.rootProps checkNode(id, nodetype, entries, mapping, ast, excluded ++ additionalKey.toSet) } - def checkClosedNode(id: String, - nodetype: String, - entries: Map[YNode, YNode], - mapping: NodeMapping, - ast: YPart, - additionalKey: Option[String])(implicit ctx: DialectInstanceContext): Unit = { + def checkClosedNode( + id: String, + nodetype: String, + entries: Map[YNode, YNode], + mapping: NodeMapping, + ast: YPart, + additionalKey: Option[String] + )(implicit ctx: DialectInstanceContext): Unit = { checkNode(id, nodetype, entries, mapping, ast, additionalKey.toSet) } - private def checkNode(id: String, - nodetype: String, - entries: Map[YNode, YNode], - mapping: NodeMapping, - ast: YPart, - excludedKeys: Set[String])(implicit ctx: DialectInstanceContext): Unit = { + private def checkNode( + id: String, + nodetype: String, + entries: Map[YNode, YNode], + mapping: NodeMapping, + ast: YPart, + excludedKeys: Set[String] + )(implicit ctx: DialectInstanceContext): Unit = { val allowedEntryKeys = mapping.propertiesMapping().map(_.name().value()).toSet.union(excludedKeys) val entriesToTest = entries.keys .map(_.value.asInstanceOf[YScalar].text) diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceContext.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceContext.scala index dfea7f67..460d91d7 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceContext.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceContext.scala @@ -5,21 +5,28 @@ import amf.aml.client.scala.model.domain.NodeMappable.AnyNodeMappable import amf.aml.client.scala.model.domain.{DialectDomainElement, DocumentMapping, NodeMappable, PublicNodeMapping} import amf.aml.internal.parse.common.{DeclarationContext, SyntaxErrorReporter} import amf.aml.internal.render.emitters.instances.NodeMappableFinder -import amf.aml.internal.semantic.SemanticExtensionsFacade +import amf.aml.internal.semantic.{SemanticExtensionsFacade, SemanticExtensionsFacadeBuilder} +import amf.core.client.scala.errorhandling.AMFErrorHandler import amf.core.client.scala.parse.document.{ParserContext, SyamlBasedParserErrorHandler} -import amf.core.internal.parser.YMapOps +import amf.core.internal.annotations.SourceAST +import amf.core.internal.parser.{ParseConfigOverride, YMapOps} +import amf.core.internal.validation.core.ValidationProfile import org.yaml.model._ import scala.language.existentials -class DialectInstanceContext(var dialect: Dialect, - val nodeMappableFinder: NodeMappableFinder, - private val wrapped: ParserContext, - private val ds: Option[DialectInstanceDeclarations] = None) - extends SyamlBasedParserErrorHandler(wrapped.rootContextDocument, - wrapped.refs, - wrapped.futureDeclarations, - wrapped.config) +class DialectInstanceContext( + var dialect: Dialect, + val nodeMappableFinder: NodeMappableFinder, + private val wrapped: ParserContext, + private val ds: Option[DialectInstanceDeclarations] = None, + val constraints: Option[ValidationProfile] = None +) extends SyamlBasedParserErrorHandler( + wrapped.rootContextDocument, + wrapped.refs, + wrapped.futureDeclarations, + wrapped.config + ) with DeclarationContext with SyntaxErrorReporter { @@ -29,21 +36,22 @@ class DialectInstanceContext(var dialect: Dialect, val libraryDeclarationsNodeMappings: Map[String, NodeMappable] = parseDeclaredNodeMappings("library") val rootDeclarationsNodeMappings: Map[String, NodeMappable] = parseDeclaredNodeMappings("root") - val extensionsFacade: SemanticExtensionsFacade = SemanticExtensionsFacade(wrapped.config) + val extensionsFacadeBuilder: SemanticExtensionsFacadeBuilder = (name: String) => + SemanticExtensionsFacade(name, wrapped.config) def computeRootProps: Set[String] = { val declarationProps: Set[String] = Option(dialect.documents()).flatMap(_.declarationsPath().option()) match { case Some(declarationsPath) => Set(declarationsPath.split("/").head) case _ => ( + Option(dialect.documents()) + .flatMap(d => Option(d.root())) + .map(_.declaredNodes().map(_.name().value())) + .getOrElse(Seq()) ++ Option(dialect.documents()) - .flatMap(d => Option(d.root())) + .flatMap(d => Option(d.library())) .map(_.declaredNodes().map(_.name().value())) - .getOrElse(Seq()) ++ - Option(dialect.documents()) - .flatMap(d => Option(d.library())) - .map(_.declaredNodes().map(_.name().value())) - .getOrElse(Seq()) + .getOrElse(Seq()) ).toSet } declarationProps ++ Seq("uses", "external").toSet @@ -98,9 +106,8 @@ class DialectInstanceContext(var dialect: Dialect, } .getOrElse(Nil) - declarations.foldLeft(Map[String, NodeMappable]()) { - case (acc, (name, mapping)) => - acc + (name -> mapping) + declarations.foldLeft(Map[String, NodeMappable]()) { case (acc, (name, mapping)) => + acc + (name -> mapping) } } @@ -123,4 +130,14 @@ class DialectInstanceContext(var dialect: Dialect, case _ => Right(node) } } + + def copy(errorHandler: AMFErrorHandler): DialectInstanceContext = { + new DialectInstanceContext( + dialect, + nodeMappableFinder, + wrapped.copy(config = ParseConfigOverride(errorHandler, wrapped.config)), + ds, + constraints + ) + } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceDeclarations.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceDeclarations.scala index a9c8b028..e66949ce 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceDeclarations.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceDeclarations.scala @@ -6,10 +6,11 @@ import amf.core.internal.parser.domain.{FutureDeclarations, SearchScope} import amf.aml.client.scala.model.domain.{DialectDomainElement, NodeMappable} import amf.aml.internal.parse.vocabularies.VocabularyDeclarations -class DialectInstanceDeclarations(var dialectDomainElements: Map[String, DialectDomainElement] = Map(), - errorHandler: AMFErrorHandler, - futureDeclarations: FutureDeclarations) - extends VocabularyDeclarations(Map(), Map(), Map(), Map(), Map(), errorHandler, futureDeclarations) +class DialectInstanceDeclarations( + var dialectDomainElements: Map[String, DialectDomainElement] = Map(), + errorHandler: AMFErrorHandler, + futureDeclarations: FutureDeclarations +) extends VocabularyDeclarations(Map(), Map(), Map(), Map(), Map(), errorHandler, futureDeclarations) with NodeMappableHelper { /** Get or create specified library. */ @@ -24,8 +25,10 @@ class DialectInstanceDeclarations(var dialectDomainElements: Map[String, Dialect } } - def registerDialectDomainElement(name: String, - dialectDomainElement: DialectDomainElement): DialectInstanceDeclarations = { + def registerDialectDomainElement( + name: String, + dialectDomainElement: DialectDomainElement + ): DialectInstanceDeclarations = { dialectDomainElements += (name -> dialectDomainElement) if (!dialectDomainElement.isUnresolved) { futureDeclarations.resolveRef(name, dialectDomainElement) @@ -33,9 +36,11 @@ class DialectInstanceDeclarations(var dialectDomainElements: Map[String, Dialect this } - def findDialectDomainElement(key: String, - nodeMapping: NodeMappable, - scope: SearchScope.Scope): Option[DialectDomainElement] = { + def findDialectDomainElement( + key: String, + nodeMapping: NodeMappable, + scope: SearchScope.Scope + ): Option[DialectDomainElement] = { val nodeMappingIds = allNodeMappingIds(nodeMapping) findForType(key, _.asInstanceOf[DialectInstanceDeclarations].dialectDomainElements, scope) collect { case dialectDomainElement: DialectDomainElement if nodeMappingIds.contains(dialectDomainElement.definedBy.id) => diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceFragmentParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceFragmentParser.scala index 1d821a85..041577dd 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceFragmentParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceFragmentParser.scala @@ -7,7 +7,7 @@ import amf.aml.internal.metamodel.document.DialectInstanceModel import amf.aml.client.scala.model.document.{DialectInstanceFragment, DialectInstanceProcessingData} import amf.aml.client.scala.model.domain.{DialectDomainElement, DocumentsModel} import amf.aml.internal.parse.instances.DialectInstanceParser.encodedElementDefaultId -import amf.aml.internal.parse.instances.parser.InstanceNodeParser +import amf.aml.internal.parse.instances.parser.InstanceElementParser import amf.aml.internal.validate.DialectValidations.DialectError import com.github.ghik.silencer.silent @@ -37,8 +37,10 @@ class DialectInstanceFragmentParser(root: Root)(implicit override val ctx: Diale dialectInstanceFragment.set(DialectInstanceModel.Encodes, dialectDomainElement, Annotations.inferred()) } - private def parseEncodedFragment(dialectInstanceFragment: DialectInstanceFragment, - fragmentName: String): DialectDomainElement = { + private def parseEncodedFragment( + dialectInstanceFragment: DialectInstanceFragment, + fragmentName: String + ): DialectDomainElement = { val documentMapping = Option(ctx.dialect.documents()).flatMap { documents => documents.fragments().find(fragmentName == _.documentName().value()) } @@ -47,7 +49,7 @@ class DialectInstanceFragmentParser(root: Root)(implicit override val ctx: Diale ctx.findNodeMapping(documentMapping.encoded().value()) match { case Some(nodeMapping) => val path = dialectInstanceFragment.id + "#" - InstanceNodeParser(root).parse(path, path + "/", map, nodeMapping, Map(), givenAnnotations = None) + InstanceElementParser(root).parse(path, path + "/", map, nodeMapping, Map(), givenAnnotations = None) case _ => emptyElementWithViolation(s"Could not find node mapping for: ${documentMapping.encoded().value()}") } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceLibraryParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceLibraryParser.scala index ee41e84d..a71eeabf 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceLibraryParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceLibraryParser.scala @@ -14,10 +14,11 @@ class DialectInstanceLibraryParser(root: Root)(implicit override val ctx: Dialec .withLocation(root.location) .withId(root.location) .withProcessingData( - DialectInstanceProcessingData() - .withTransformed(false) - .withDefinedBy(ctx.dialect.id) - .adopted(root.location + "#")) + DialectInstanceProcessingData() + .withTransformed(false) + .withDefinedBy(ctx.dialect.id) + .adopted(root.location + "#") + ) .withDefinedBy(ctx.dialect.id) parseDeclarations("library") diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceParser.scala index 8b7029a0..bbddaf1d 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceParser.scala @@ -44,10 +44,12 @@ object DialectInstanceParser extends NodeMappableHelper { else m.value.toOption[YMap] case Some(o) => ctx.eh - .violation(DialectError, - "", - s"Invalid node type for declarations path ${o.value.tagType.toString()}", - o.location) + .violation( + DialectError, + "", + s"Invalid node type for declarations path ${o.value.tagType.toString()}", + o.location + ) None case _ => None } @@ -55,7 +57,8 @@ object DialectInstanceParser extends NodeMappableHelper { } def emptyElement(defaultId: String, ast: YNode, mappable: NodeMappable, givenAnnotations: Option[Annotations])( - implicit ctx: DialectInstanceContext): DialectDomainElement = { + implicit ctx: DialectInstanceContext + ): DialectDomainElement = { val mappings = mappable match { case m: NodeMapping => Seq(m.nodetypeMapping.value(), mappable.id) case _ => Seq(mappable.id) @@ -125,8 +128,7 @@ class DialectInstanceParser(val root: Root)(implicit val ctx: DialectInstanceCon if (references.baseUnitReferences().nonEmpty) dialectInstance.withReferences(references.baseUnitReferences()) if (ctx.nestedDialects.nonEmpty) { - dialectInstance.processingData.withGraphDependencies(ctx.nestedDialects.map(nd => - nd.location().getOrElse(nd.id))) + dialectInstance.processingData.withGraphDependencies(ctx.nestedDialects.map(nd => nd.location().getOrElse(nd.id))) @silent("deprecated") // Silent can only be used in assignment expressions val a = dialectInstance.withGraphDependencies(ctx.nestedDialects.map(nd => nd.location().getOrElse(nd.id))) } @@ -149,29 +151,32 @@ class DialectInstanceParser(val root: Root)(implicit val ctx: DialectInstanceCon pathOption.map(p => if (p.startsWith("/")) p else "/" + p).map(p => if (p.endsWith("/")) p else p + "/") val paths: List[String] = pathOption.map(_.split("/").toList).getOrElse(Nil) findDeclarationsMap(paths, map).foreach { declarationsMap => - declarationsNodeMappings.foreach { - case (name, nodeMapping) => - declarationsMap.entries.find(_.key.as[YScalar].text == name).foreach { entry => - addDeclarationKey(DeclarationKey(entry)) - val declarationsId = root.location + "#" + normalizedPath.getOrElse("/") + name.urlComponentEncoded - entry.value.as[YMap].entries.foreach { declarationEntry => - val declarationName = declarationEntry.key.as[YScalar].text - val id = pathSegment(declarationsId, List(declarationName)) - val node = InstanceNodeParser(root).parse(declarationsId, - id, - declarationEntry.value, - nodeMapping, - givenAnnotations = Some(Annotations(declarationEntry))) - - // lookup by ref name - node.set(DialectDomainElementModel.DeclarationName, - AmfScalar(declarationName, Annotations(declarationEntry.key)), - Annotations(declarationEntry.key)) - ctx.declarations.registerDialectDomainElement(declarationEntry.key, node) - // lookup by JSON pointer, absolute URI - ctx.registerJsonPointerDeclaration(id, node) - } + declarationsNodeMappings.foreach { case (name, nodeMapping) => + declarationsMap.entries.find(_.key.as[YScalar].text == name).foreach { entry => + addDeclarationKey(DeclarationKey(entry)) + val declarationsId = root.location + "#" + normalizedPath.getOrElse("/") + name.urlComponentEncoded + entry.value.as[YMap].entries.foreach { declarationEntry => + val declarationName = declarationEntry.key.as[YScalar].text + val id = pathSegment(declarationsId, List(declarationName)) + val node = InstanceElementParser(root).parse( + declarationsId, + id, + declarationEntry.value, + nodeMapping, + givenAnnotations = Some(Annotations(declarationEntry)) + ) + + // lookup by ref name + node.set( + DialectDomainElementModel.DeclarationName, + AmfScalar(declarationName, Annotations(declarationEntry.key)), + Annotations(declarationEntry.key) + ) + ctx.declarations.registerDialectDomainElement(declarationEntry.key, node) + // lookup by JSON pointer, absolute URI + ctx.registerJsonPointerDeclaration(id, node) } + } } } } @@ -185,16 +190,17 @@ class DialectInstanceParser(val root: Root)(implicit val ctx: DialectInstanceCon case Some(nodeMapping) => val path = dialectInstance.id + "#" val additionalKey = - if (documents.keyProperty().value()) { - Some(ctx.dialect.name().value()) - } else None - InstanceNodeParser(root).parse(path, - encodedElementDefaultId(dialectInstance), - map, - nodeMapping, - rootNode = true, - givenAnnotations = None, - additionalKey = additionalKey) + if (documents.keyProperty().value()) Some(ctx.dialect.name().value()) + else None + InstanceElementParser(root).parse( + path, + encodedElementDefaultId(dialectInstance), + map, + nodeMapping, + rootNode = true, + givenAnnotations = None, + additionalKey = additionalKey + ) case _ => emptyElementWithViolation(s"Could not find node mapping for: ${mapping.encoded().value()}") } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstancePatchParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstancePatchParser.scala index ad064a62..ef45e568 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstancePatchParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstancePatchParser.scala @@ -4,6 +4,7 @@ import amf.core.internal.parser.{Root, YMapOps} import amf.aml.client.scala.model.document.DialectInstancePatch import amf.aml.internal.validate.DialectValidations.DialectError import amf.core.internal.unsafe.PlatformSecrets +import amf.core.internal.utils.UriUtils import org.yaml.model.YType class DialectInstancePatchParser(root: Root)(implicit override val ctx: DialectInstanceContext) @@ -20,7 +21,7 @@ class DialectInstancePatchParser(root: Root)(implicit override val ctx: DialectI private def checkTarget(patch: DialectInstancePatch): DialectInstancePatch = { map.key("$target") match { case Some(entry) if entry.value.tagType == YType.Str => - patch.withExtendsModel(platform.resolvePath(entry.value.as[String])) + patch.withExtendsModel(UriUtils.resolvePath(entry.value.as[String])) case Some(entry) => ctx.eh.violation(DialectError, patch.id, "Patch $target must be a valid URL", entry.value.location) diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceReferencesParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceReferencesParser.scala index 87bce52b..8765e95a 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceReferencesParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/DialectInstanceReferencesParser.scala @@ -15,7 +15,8 @@ import amf.core.internal.parser.YMapOps import scala.collection.mutable case class DialectInstanceReferencesParser(dialectInstance: BaseUnit, map: YMap, references: Seq[ParsedReference])( - implicit ctx: DialectInstanceContext) { + implicit ctx: DialectInstanceContext +) { def parse(location: String): ReferenceCollector[AmfObject] = { val result = CallbackReferenceCollector(DialectInstanceRegister()) @@ -41,28 +42,34 @@ case class DialectInstanceReferencesParser(dialectInstance: BaseUnit, map: YMap, private def parseLibraries(dialectInstance: BaseUnit, result: ReferenceCollector[AmfObject], id: String): Unit = { val parsedLibraries: mutable.Set[String] = mutable.Set() map.key( - "uses", - entry => { - val annotation: Annotation = - AliasesLocation( - Annotations(entry.key).find(classOf[LexicalInformation]).map(_.range.start.line).getOrElse(0)) - dialectInstance.annotations += annotation - entry.value - .as[YMap] - .entries - .foreach(e => { - val alias: String = e.key.as[YScalar].text - val url: String = library(e) - target(url).foreach { - case module: DeclaresModel => - parsedLibraries += url - collectAlias(dialectInstance, alias -> ReferencedInfo(module.id, module.id, url)) - result += (alias, module) - case other => - ctx.eh.violation(DialectError, id, s"Expected vocabulary module but found: '$other'", e.location) // todo Uses should only reference modules... - } - }) - } + "uses", + entry => { + val annotation: Annotation = + AliasesLocation( + Annotations(entry.key).find(classOf[LexicalInformation]).map(_.range.start.line).getOrElse(0) + ) + dialectInstance.annotations += annotation + entry.value + .as[YMap] + .entries + .foreach(e => { + val alias: String = e.key.as[YScalar].text + val url: String = library(e) + target(url).foreach { + case module: DeclaresModel => + parsedLibraries += url + collectAlias(dialectInstance, alias -> ReferencedInfo(module.id, module.id, url)) + result += (alias, module) + case other => + ctx.eh.violation( + DialectError, + id, + s"Expected vocabulary module but found: '$other'", + e.location + ) // todo Uses should only reference modules... + } + }) + } ) // Parsing $refs to libraries references.foreach { @@ -93,13 +100,13 @@ case class DialectInstanceReferencesParser(dialectInstance: BaseUnit, map: YMap, } private def parseExternals(result: ReferenceCollector[AmfObject], id: String): Unit = { map.key( - "external", - entry => parseExternalEntry(result, entry) + "external", + entry => parseExternalEntry(result, entry) ) map.key( - "$external", - entry => parseExternalEntry(result, entry) + "$external", + entry => parseExternalEntry(result, entry) ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/InstanceNodeIdHandling.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/InstanceNodeIdHandling.scala index e8be309a..861b482e 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/InstanceNodeIdHandling.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/InstanceNodeIdHandling.scala @@ -27,7 +27,8 @@ object InstanceNodeIdHandling { } def idTemplate(node: DialectDomainElement, nodeMap: YMap, path: Seq[String], mapping: NodeMapping, root: Root)( - implicit ctx: DialectInstanceContext): String = { + implicit ctx: DialectInstanceContext + ): String = { val template = replaceTemplateVariables(node.id, nodeMap, mapping.idTemplate.value()) prependRootIfIsRelative(template, path, root) } @@ -50,8 +51,9 @@ object InstanceNodeIdHandling { } } - private def replaceTemplateVariables(nodeId: String, nodeMap: YMap, originalTemplate: String)( - implicit ctx: DialectInstanceContext): String = { + private def replaceTemplateVariables(nodeId: String, nodeMap: YMap, originalTemplate: String)(implicit + ctx: DialectInstanceContext + ): String = { var template = originalTemplate // template resolution val regex = "(\\{[^}]+\\})".r @@ -71,26 +73,29 @@ object InstanceNodeIdHandling { template } - def generateNodeId(node: DialectDomainElement, - nodeMap: YMap, - path: Seq[String], - defaultId: String, - mapping: NodeMapping, - additionalProperties: Map[String, Any] = Map(), - rootNode: Boolean, - root: Root)(implicit ctx: DialectInstanceContext): String = { + def generateNodeId( + node: DialectDomainElement, + nodeMap: YMap, + path: Seq[String], + encodedDefaultId: String, + mapping: NodeMapping, + additionalProperties: Map[String, Any] = Map(), + rootNode: Boolean, + root: Root + )(implicit ctx: DialectInstanceContext): String = { + val defaultDecodedId = encodedDefaultId.urlDecoded val generatedId = if (rootNode && isSelfEncoded) - defaultId // if this is self-encoded just reuse the dialectId computed and don't try to generate a different identifier + defaultDecodedId // if this is self-encoded just reuse the dialectId computed and don't try to generate a different identifier else { if (nodeMap.key("$id").isDefined) { explicitNodeId(Some(node), nodeMap, ctx) } else if (mapping.idTemplate.nonEmpty) { idTemplate(node, nodeMap, path, mapping, root) } else if (mapping.primaryKey().nonEmpty) { - primaryKeyNodeId(node, nodeMap, path, defaultId, mapping, additionalProperties) + primaryKeyNodeId(node, nodeMap, path, defaultDecodedId, mapping, additionalProperties) } else { - defaultId + defaultDecodedId } } overrideBase(generatedId, nodeMap).urlEncoded @@ -102,7 +107,8 @@ object InstanceNodeIdHandling { path: Seq[String], defaultId: String, mapping: NodeMapping, - additionalProperties: Map[String, Any] = Map())(implicit ctx: DialectInstanceContext): String = { + additionalProperties: Map[String, Any] = Map() + )(implicit ctx: DialectInstanceContext): String = { var allFound = true var keyId: Seq[String] = Seq() mapping.primaryKey().foreach { key => @@ -115,15 +121,18 @@ object InstanceNodeIdHandling { case Some(v) => keyId = keyId ++ Seq(v.toString) case _ => ctx.eh - .violation(DialectError, - node.id, - s"Cannot find unique mandatory property '$propertyName'", - nodeMap.location) + .violation( + DialectError, + node.id, + s"Cannot find unique mandatory property '$propertyName'", + nodeMap.location + ) allFound = false } } } - if (allFound) { path.mkString("/") + "/" + keyId.mkString("_") } else { defaultId } + if (allFound) { path.mkString("/") + "/" + keyId.mkString("_") } + else { defaultId } } private def isSelfEncoded(implicit ctx: DialectInstanceContext) = { @@ -144,27 +153,12 @@ object InstanceNodeIdHandling { trait InstanceNodeIdHandling extends BaseDirectiveOverride { this: DialectInstanceParser => - protected def generateNodeId(node: DialectDomainElement, - nodeMap: YMap, - path: Seq[String], - defaultId: String, - mapping: NodeMapping, - additionalProperties: Map[String, Any] = Map(), - rootNode: Boolean): String = { - InstanceNodeIdHandling.generateNodeId(node, - nodeMap, - path, - defaultId, - mapping, - additionalProperties, - rootNode, - root) - } - - protected def idTemplate(node: DialectDomainElement, - nodeMap: YMap, - path: Seq[String], - mapping: NodeMapping): String = { + protected def idTemplate( + node: DialectDomainElement, + nodeMap: YMap, + path: Seq[String], + mapping: NodeMapping + ): String = { InstanceNodeIdHandling.idTemplate(node, nodeMap, path, mapping, root) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/JsonPointerResolver.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/JsonPointerResolver.scala index d64f5bf1..8dd6036e 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/JsonPointerResolver.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/JsonPointerResolver.scala @@ -6,14 +6,16 @@ import org.yaml.model.YMap import amf.core.internal.parser.domain.BaseSpecParser import amf.core.internal.parser.{Root, YMapOps} import amf.core.internal.unsafe.PlatformSecrets +import amf.core.internal.utils.UriUtils /* * TODO: should be a class which is passed as parameter to the dialect instance parser. Most of all because of the resolvedPath(String) and basePath(String) methods. */ object JsonPointerResolver extends NodeMappableHelper with PlatformSecrets { - def resolveJSONPointer(map: YMap, mapping: NodeMappable, id: String, root: Root)( - implicit ctx: DialectInstanceContext): DialectDomainElement = { + def resolveJSONPointer(map: YMap, mapping: NodeMappable, id: String, root: Root)(implicit + ctx: DialectInstanceContext + ): DialectDomainElement = { val mappingIds = allNodeMappingIds(mapping) val entry = map.key("$ref").get val pointer = entry.value.as[String] @@ -51,9 +53,9 @@ object JsonPointerResolver extends NodeMappableHelper with PlatformSecrets { else basePath(base) + str if (fullPath.contains("#")) { val parts = fullPath.split("#") - platform.resolvePath(parts.head) + "#" + parts.last + UriUtils.resolvePath(parts.head) + "#" + parts.last } else { - platform.resolvePath(fullPath) + UriUtils.resolvePath(fullPath) } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/NodeMappableHelper.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/NodeMappableHelper.scala index 0b1a0031..846b239b 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/NodeMappableHelper.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/NodeMappableHelper.scala @@ -1,11 +1,28 @@ package amf.aml.internal.parse.instances -import amf.aml.client.scala.model.domain.{NodeMappable, NodeMapping, UnionNodeMapping} +import amf.aml.client.scala.model.domain.{AnyMapping, NodeMappable, NodeMapping, UnionNodeMapping} trait NodeMappableHelper { + type NodeMappable = NodeMappable.AnyNodeMappable + def allNodeMappingIds(mapping: NodeMappable): Set[String] = mapping match { - case nodeMapping: NodeMapping => Set(nodeMapping.id) - case unionNodeMapping: UnionNodeMapping => unionNodeMapping.objectRange().map(_.value()).toSet + case nodeMapping: NodeMapping => nodeMappingMappables(nodeMapping) + case unionNodeMapping: UnionNodeMapping => unionMappingMappables(unionNodeMapping) } + + private def anyMappingMappables(anyMapping: AnyMapping): Set[String] = + (anyMapping.and.map(_.value()) ++ anyMapping.or.map(_.value()) ++ anyMapping.components + .map(_.value())).toSet ++ Set( + anyMapping.ifMapping.value(), + anyMapping.thenMapping.value(), + anyMapping.elseMapping.value() + ) + + private def nodeMappingMappables(nodeMapping: NodeMapping): Set[String] = + anyMappingMappables(nodeMapping) ++ Set(nodeMapping.id) + + private def unionMappingMappables(unionNodeMapping: UnionNodeMapping): Set[String] = + anyMappingMappables(unionNodeMapping) ++ unionNodeMapping.objectRange().map(_.value()).toSet + } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/ReferenceDeclarations.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/ReferenceDeclarations.scala index e69de29b..8b137891 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/ReferenceDeclarations.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/ReferenceDeclarations.scala @@ -0,0 +1 @@ + diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/finder/IncludeFirstUnionElementFinder.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/finder/IncludeFirstUnionElementFinder.scala index 8f3a3bbf..08979158 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/finder/IncludeFirstUnionElementFinder.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/finder/IncludeFirstUnionElementFinder.scala @@ -7,27 +7,34 @@ import org.yaml.model.{YMap, YNode, YScalar} object IncludeFirstUnionElementFinder { - def find(ast: YNode, allPossibleMappings: Seq[NodeMapping], id: String, root: YMap)( - implicit ctx: DialectInstanceContext): DialectDomainElement = { + def find(ast: YNode, allPossibleMappings: Seq[NodeMapping], id: String, root: YMap)(implicit + ctx: DialectInstanceContext + ): DialectDomainElement = { val refTuple = ctx.link(ast) match { case Left(key) => - (key, - allPossibleMappings - .map(mapping => ctx.declarations.findDialectDomainElement(key, mapping, SearchScope.Fragments)) - .collectFirst { case Some(x) => x }) + ( + key, + allPossibleMappings + .map(mapping => ctx.declarations.findDialectDomainElement(key, mapping, SearchScope.Fragments)) + .collectFirst { case Some(x) => x } + ) case _ => val text = ast.as[YScalar].text - (text, - allPossibleMappings - .map(mapping => ctx.declarations.findDialectDomainElement(text, mapping, SearchScope.Named)) - .collectFirst { case Some(x) => x }) + ( + text, + allPossibleMappings + .map(mapping => ctx.declarations.findDialectDomainElement(text, mapping, SearchScope.Named)) + .collectFirst { case Some(x) => x } + ) } refTuple match { case (text: String, Some(s)) => val linkedNode = s .link(text, Annotations(ast.value)) .asInstanceOf[DialectDomainElement] - .withId(id) // and the ID of the link at that position in the tree, not the ID of the linked element, tha goes in link-target + .withId( + id + ) // and the ID of the link at that position in the tree, not the ID of the linked element, tha goes in link-target linkedNode case (text: String, _) => val linkedNode = DialectDomainElement(root).withId(id) diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/finder/JSONPointerUnionFinder.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/finder/JSONPointerUnionFinder.scala index cfcc7734..7034a03b 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/finder/JSONPointerUnionFinder.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/finder/JSONPointerUnionFinder.scala @@ -8,8 +8,9 @@ import org.yaml.model.YMap object JSONPointerUnionFinder { - def find(map: YMap, allPossibleMappings: Seq[NodeMapping], id: String, root: YMap)( - implicit ctx: DialectInstanceContext): DialectDomainElement = { + def find(map: YMap, allPossibleMappings: Seq[NodeMapping], id: String, root: YMap)(implicit + ctx: DialectInstanceContext + ): DialectDomainElement = { val entry = map.key("$ref").get val pointer = entry.value.as[String] val fullPointer = if (pointer.startsWith("#")) { diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/AmlSubGraphCollector.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/AmlSubGraphCollector.scala new file mode 100644 index 00000000..23727c17 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/AmlSubGraphCollector.scala @@ -0,0 +1,39 @@ +package amf.aml.internal.parse.instances.parser + +import amf.aml.client.scala.model.document.Dialect +import amf.aml.client.scala.model.domain.{NodeMapping, UnionNodeMapping} +import amf.aml.internal.utils.AmlExtensionSyntax.NodeMappable + +object AmlSubGraphCollector { + def collect(sourceId: String, dialect: Dialect): Set[String] = { + val acc = dialect.declares.collect { + case element: NodeMapping => (element.id -> element) + case element: UnionNodeMapping => (element.id -> element) + }.toMap + collect(sourceId, acc, Set(sourceId)) + } + + private def collect( + current: String, + mappingMap: Map[String, NodeMappable], + seen: Set[String] = Set.empty + ): Set[String] = { + mappingMap + .get(current) + .map { mapping => + val toCheck = ranges(mapping) + val toTraverse = toCheck.diff(seen) + val nextSeen = seen ++ toTraverse + toTraverse.foldLeft(nextSeen) { (nextSeen, toSee) => + nextSeen ++ collect(toSee, mappingMap, nextSeen) + } + } + .getOrElse(Set.empty) + } + + private def ranges(mapping: NodeMappable): Set[String] = mapping match { + case m: NodeMapping => m.propertiesMapping().flatMap(_.objectRange()).flatMap(_.option()).toSet + case m: UnionNodeMapping => m.objectRange().flatMap(_.option()).toSet + case _ => Set.empty + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/DialectExtensionParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/DialectExtensionParser.scala index 4e07e0b2..01febb2c 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/DialectExtensionParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/DialectExtensionParser.scala @@ -10,12 +10,14 @@ import org.yaml.model.{YMap, YMapEntry, YScalar, YType} object DialectExtensionParser { - def parse(id: String, - propertyEntry: YMapEntry, - property: PropertyLikeMapping[_], - node: DialectDomainElement, - root: Root, - nodeParser: NodeParser)(implicit ctx: DialectInstanceContext): Unit = { + def parse( + id: String, + propertyEntry: YMapEntry, + property: PropertyLikeMapping[_], + node: DialectDomainElement, + root: Root, + nodeParser: NodeParser + )(implicit ctx: DialectInstanceContext): Unit = { val nestedObjectId = pathSegment(id, List(propertyEntry.key.as[YScalar].text)) propertyEntry.value.tagType match { case YType.Str | YType.Include => @@ -31,14 +33,16 @@ object DialectExtensionParser { ctx.nestedDialects ++= Seq(dialect) ctx.withCurrentDialect(dialect) { val dialectDomainElement = - nodeParser(id, nestedObjectId, propertyEntry.value, nodeMapping, Map.empty) + nodeParser(id, nestedObjectId, propertyEntry.value, nodeMapping, Map.empty, false) node.withObjectField(property, dialectDomainElement, Right(propertyEntry)) } case None => - ctx.eh.violation(DialectError, - id, - s"Cannot find dialect for nested anyNode mapping $dialectNode", - nested.value.location) + ctx.eh.violation( + DialectError, + id, + s"Cannot find dialect for nested anyNode mapping $dialectNode", + nested.value.location + ) } case None => computeParsingScheme(map) match { @@ -54,17 +58,21 @@ object DialectExtensionParser { } } - protected def resolveLinkProperty(propertyEntry: YMapEntry, - mapping: PropertyLikeMapping[_], - id: String, - node: DialectDomainElement, - isRef: Boolean = false)(implicit ctx: DialectInstanceContext): Unit = + protected def resolveLinkProperty( + propertyEntry: YMapEntry, + mapping: PropertyLikeMapping[_], + id: String, + node: DialectDomainElement, + isRef: Boolean = false + )(implicit ctx: DialectInstanceContext): Unit = LinkIncludePropertyParser.parse(propertyEntry, mapping, id, node, isRef) - protected def resolveJSONPointerProperty(map: YMap, - mapping: PropertyLikeMapping[_], - id: String, - node: DialectDomainElement, - root: Root)(implicit ctx: DialectInstanceContext): Unit = + protected def resolveJSONPointerProperty( + map: YMap, + mapping: PropertyLikeMapping[_], + id: String, + node: DialectDomainElement, + root: Root + )(implicit ctx: DialectInstanceContext): Unit = JSONPointerPropertyParser.parse(map, mapping, id, node, root) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ElementPropertyParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ElementPropertyParser.scala index 07a3b57f..4d7ff2bd 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ElementPropertyParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ElementPropertyParser.scala @@ -8,38 +8,56 @@ import amf.core.client.scala.model.domain.DomainElement import amf.core.internal.parser.Root import org.yaml.model.{YMap, YMapEntry, YNode} +object LiteralPropertyParser { + def parse(propertyValueEntry: YMapEntry, property: PropertyLikeMapping[_], node: DialectDomainElement)(implicit + ctx: DialectInstanceContext + ): Unit = { + setLiteralValue(propertyValueEntry, property, node) + } + + private def setLiteralValue(entry: YMapEntry, property: PropertyLikeMapping[_], node: DialectDomainElement)(implicit + ctx: DialectInstanceContext + ): Unit = { + val parsed = LiteralValueParser.parseLiteralValue(entry.value, property, node)(ctx.eh) + LiteralValueSetter.setLiteralValue(parsed, entry, property, node) + } +} + class ElementPropertyParser(private val root: Root, private val rootMap: YMap, private val nodeParser: NodeParser) { - def parse(id: String, propertyEntry: YMapEntry, property: PropertyLikeMapping[_], node: DialectDomainElement)( - implicit ctx: DialectInstanceContext): Unit = { - property.classification() match { - case ExtensionPointProperty => parseDialectExtension(id, propertyEntry, property, node) - case LiteralProperty => parseLiteralProperty(id, propertyEntry, property, node) - case LiteralPropertyCollection => parseLiteralCollectionProperty(id, propertyEntry, property, node) - case ObjectProperty => parseObjectProperty(id, propertyEntry, property, node) - case ObjectPropertyCollection => parseObjectCollectionProperty(id, propertyEntry, property, node) - case ObjectMapProperty if property.isInstanceOf[PropertyMapping] => - parseObjectMapProperty(id, propertyEntry, property.asInstanceOf[PropertyMapping], node) - case ObjectPairProperty => parseObjectPairProperty(id, propertyEntry, property, node) - case ExternalLinkProperty => - parseExternalLinkProperty(id, propertyEntry, property, node) + def parse(id: String, propertyValueEntry: YMapEntry, propertyLikeMapping: PropertyLikeMapping[_], node: DialectDomainElement)(implicit + ctx: DialectInstanceContext + ): Unit = { + propertyLikeMapping.classification() match { + case ExtensionPointProperty => parseDialectExtension(id, propertyValueEntry, propertyLikeMapping, node) + case LiteralProperty => LiteralPropertyParser.parse(propertyValueEntry, propertyLikeMapping, node) + case LiteralPropertyCollection => parseLiteralCollectionProperty(id, propertyValueEntry, propertyLikeMapping, node) + case ObjectProperty => parseObjectProperty(id, propertyValueEntry, propertyLikeMapping, node) + case ObjectPropertyCollection => parseObjectCollectionProperty(id, propertyValueEntry, propertyLikeMapping, node) + case ObjectMapProperty => parseObjectMapProperty(id, propertyValueEntry, propertyLikeMapping, node) + case ObjectPairProperty => parseObjectPairProperty(id, propertyValueEntry, propertyLikeMapping, node) + case ExternalLinkProperty => parseExternalLinkProperty(id, propertyValueEntry, propertyLikeMapping, node) case _ => - ctx.eh.violation(DialectError, id, s"Unknown type of node property ${property.id}", propertyEntry.location) + ctx.eh.violation(DialectError, id, s"Unknown type of node property ${propertyLikeMapping.id}", propertyValueEntry.location) } } - protected def parseDialectExtension(id: String, - propertyEntry: YMapEntry, - property: PropertyLikeMapping[_], - node: DialectDomainElement)(implicit ctx: DialectInstanceContext): Unit = { - DialectExtensionParser.parse(id, propertyEntry, property, node, root, nodeParser) + protected def parseDialectExtension( + id: String, + propertyValueEntry: YMapEntry, + property: PropertyLikeMapping[_], + node: DialectDomainElement + )(implicit ctx: DialectInstanceContext): Unit = { + DialectExtensionParser.parse(id, propertyValueEntry, property, node, root, nodeParser) } - private def parseExternalLinkProperty(id: String, - propertyEntry: YMapEntry, - property: PropertyLikeMapping[_], - node: DialectDomainElement)(implicit ctx: DialectInstanceContext): Unit = { - ExternalLinkPropertyParser.parse(id, propertyEntry, property, node, root, parse) + private def parseExternalLinkProperty( + id: String, + propertyValueEntry: YMapEntry, + property: PropertyLikeMapping[_], + node: DialectDomainElement + )(implicit ctx: DialectInstanceContext): Unit = { + ExternalLinkPropertyParser.parse(id, propertyValueEntry, property, node, root, parse) } protected def parseObjectUnion[T <: DomainElement]( @@ -47,82 +65,65 @@ class ElementPropertyParser(private val root: Root, private val rootMap: YMap, p path: Seq[String], ast: YNode, unionMapping: NodeWithDiscriminator[_], - additionalProperties: Map[String, Any] = Map())(implicit ctx: DialectInstanceContext): DialectDomainElement = { + additionalProperties: Map[String, Any] = Map() + )(implicit ctx: DialectInstanceContext): DialectDomainElement = { ObjectUnionParser.parse(defaultId, path, ast, unionMapping, additionalProperties, root, rootMap, parse) } protected def parseObjectProperty( id: String, - propertyEntry: YMapEntry, + propertyValueEntry: YMapEntry, property: PropertyLikeMapping[_], node: DialectDomainElement, - additionalProperties: Map[String, Any] = Map())(implicit ctx: DialectInstanceContext): Unit = { - ObjectPropertyParser.parse(id, propertyEntry, property, node, additionalProperties, parseObjectUnion, nodeParser) + additionalProperties: Map[String, Any] = Map() + )(implicit ctx: DialectInstanceContext): Unit = { + ObjectPropertyParser.parse(id, propertyValueEntry, property, node, additionalProperties, parseObjectUnion, nodeParser) } protected def parseObjectMapProperty( id: String, - propertyEntry: YMapEntry, - property: PropertyMapping, + propertyValueEntry: YMapEntry, + property: PropertyLikeMapping[_], node: DialectDomainElement, - additionalProperties: Map[String, Any] = Map())(implicit ctx: DialectInstanceContext): Unit = { - ObjectMapPropertyParser.parse(id, - propertyEntry, - property, - node, - additionalProperties, - parseObjectUnion, - nodeParser) + additionalProperties: Map[String, Any] = Map() + )(implicit ctx: DialectInstanceContext): Unit = { + ObjectMapPropertyParser.parse(id, propertyValueEntry, property, node, additionalProperties, parseObjectUnion, nodeParser) } - protected def parseObjectPairProperty(id: String, - propertyEntry: YMapEntry, - property: PropertyLikeMapping[_], - node: DialectDomainElement)(implicit ctx: DialectInstanceContext): Unit = - KeyValuePropertyParser.parse(id, propertyEntry, property, node) + protected def parseObjectPairProperty( + id: String, + propertyValueEntry: YMapEntry, + property: PropertyLikeMapping[_], + node: DialectDomainElement + )(implicit ctx: DialectInstanceContext): Unit = + KeyValuePropertyParser.parse(id, propertyValueEntry, property, node) protected def parseObjectCollectionProperty( id: String, - propertyEntry: YMapEntry, + propertyValueEntry: YMapEntry, property: PropertyLikeMapping[_], node: DialectDomainElement, - additionalProperties: Map[String, Any] = Map())(implicit ctx: DialectInstanceContext): Unit = { - - ObjectCollectionPropertyParser.parse(id, - propertyEntry, - property, - node, - additionalProperties, - parseObjectUnion, - nodeParser) - } - - protected def parseLiteralValue(value: YNode, property: PropertyLikeMapping[_], node: DialectDomainElement)( - implicit ctx: DialectInstanceContext): Option[_] = { - - LiteralValueParser.parseLiteralValue(value, property, node) - } - - // TODO: This should receive annotations instead of an entry. Unrelated concepts in the same method - protected def setLiteralValue(entry: YMapEntry, property: PropertyLikeMapping[_], node: DialectDomainElement)( - implicit ctx: DialectInstanceContext): Unit = { - val parsed = parseLiteralValue(entry.value, property, node) - LiteralValueSetter.setLiteralValue(parsed, entry, property, node) - } - - protected def parseLiteralProperty(id: String, - propertyEntry: YMapEntry, - property: PropertyLikeMapping[_], - node: DialectDomainElement)(implicit ctx: DialectInstanceContext): Unit = { - setLiteralValue(propertyEntry, property, node) + additionalProperties: Map[String, Any] = Map() + )(implicit ctx: DialectInstanceContext): Unit = { + + ObjectCollectionPropertyParser.parse( + id, + propertyValueEntry, + property, + node, + additionalProperties, + parseObjectUnion, + nodeParser + ) } protected def parseLiteralCollectionProperty( id: String, - propertyEntry: YMapEntry, + propertyValueEntry: YMapEntry, property: PropertyLikeMapping[_], - node: DialectDomainElement)(implicit ctx: DialectInstanceContext): Unit = { - LiteralCollectionParser.parse(propertyEntry, property, node) + node: DialectDomainElement + )(implicit ctx: DialectInstanceContext): Unit = { + LiteralCollectionParser.parse(propertyValueEntry, property, node) } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ExternalLinkGenerator.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ExternalLinkGenerator.scala index fde4f8bc..10b39747 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ExternalLinkGenerator.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ExternalLinkGenerator.scala @@ -14,8 +14,9 @@ object ExternalLinkGenerator extends BaseDirectiveOverride { type PropertyParser = (String, YMapEntry, PropertyMapping, DialectDomainElement) => Unit - def generate(id: String, node: YNode, mapping: NodeMapping, root: Root, propertyParser: PropertyParser)( - implicit ctx: DialectInstanceContext): Option[DialectDomainElement] = { + def generate(id: String, node: YNode, mapping: NodeMapping, root: Root, propertyParser: PropertyParser)(implicit + ctx: DialectInstanceContext + ): Option[DialectDomainElement] = { lazy val instanceTypes = typesFrom(mapping) node.tagType match { case YType.Str => // plain link -> we generate an anonymous node and set the id to the ref and correct type information @@ -82,9 +83,10 @@ object ExternalLinkGenerator extends BaseDirectiveOverride { case _ => // error ctx.eh.violation( - DialectError, - id, - "AML links must URI links (strings or maps with $id directive) or ID Template links (maps with idTemplate variables)") + DialectError, + id, + "AML links must URI links (strings or maps with $id directive) or ID Template links (maps with idTemplate variables)" + ) None } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ExternalLinkPropertyParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ExternalLinkPropertyParser.scala index 4ece92d4..06fab13e 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ExternalLinkPropertyParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ExternalLinkPropertyParser.scala @@ -9,12 +9,14 @@ import org.yaml.model.{YMap, YMapEntry, YNode, YSequence, YType} object ExternalLinkPropertyParser { - def parse(id: String, - propertyEntry: YMapEntry, - property: PropertyLikeMapping[_], - node: DialectDomainElement, - root: Root, - propertyParser: PropertyParser)(implicit ctx: DialectInstanceContext): Unit = { + def parse( + id: String, + propertyEntry: YMapEntry, + property: PropertyLikeMapping[_], + node: DialectDomainElement, + root: Root, + propertyParser: PropertyParser + )(implicit ctx: DialectInstanceContext): Unit = { // First extract the mapping information // External links only work over single ranges, not unions or literal ranges val maybeMapping: Option[NodeMapping] = property.objectRange() match { @@ -29,10 +31,12 @@ object ExternalLinkPropertyParser { } case _ => ctx.eh - .violation(DialectError, - id, - s"Individual object range required for external link property", - propertyEntry.location) + .violation( + DialectError, + id, + s"Individual object range required for external link property", + propertyEntry.location + ) None } @@ -61,10 +65,12 @@ object ExternalLinkPropertyParser { if (elems.nonEmpty) node.withObjectCollectionProperty(property, elems, Right(propertyEntry)) case YType.Seq if !allowMultiple => // error - ctx.eh.violation(DialectError, - id, - s"AllowMultiple not enable, sequence of external links not supported", - propertyEntry.location) + ctx.eh.violation( + DialectError, + id, + s"AllowMultiple not enable, sequence of external links not supported", + propertyEntry.location + ) case _ => ctx.eh.violation(DialectError, id, s"Not supported external link range", propertyEntry.location) } @@ -77,7 +83,8 @@ object ExternalLinkPropertyParser { node: YNode, mapping: NodeMapping, root: Root, - parseProperty: PropertyParser)(implicit ctx: DialectInstanceContext): Option[DialectDomainElement] = { + parseProperty: PropertyParser + )(implicit ctx: DialectInstanceContext): Option[DialectDomainElement] = { ExternalLinkGenerator.generate(id, node, mapping, root, parseProperty) } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/IncludeNodeParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/IncludeNodeParser.scala index 03e9f2e0..6843324f 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/IncludeNodeParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/IncludeNodeParser.scala @@ -3,21 +3,23 @@ package amf.aml.internal.parse.instances.parser import amf.aml.client.scala.model.domain.DialectDomainElement import amf.aml.internal.annotations.RefInclude import amf.aml.internal.parse.instances.{DialectInstanceContext, NodeMappableHelper} -import amf.core.internal.annotations.SourceAST +import amf.core.internal.annotations.SourceYPart import amf.core.internal.parser.domain.{Annotations, SearchScope} import org.yaml.model.{YNode, YScalar} object IncludeNodeParser extends NodeMappableHelper { - def parse(ast: YNode, mapping: NodeMappable, id: String, givenAnnotations: Option[Annotations])( - implicit ctx: DialectInstanceContext): DialectDomainElement = { + def parse(ast: YNode, mapping: NodeMappable, id: String, givenAnnotations: Option[Annotations])(implicit + ctx: DialectInstanceContext + ): DialectDomainElement = { val link = resolveLink(ast, mapping, id, givenAnnotations) link.annotations += RefInclude() link } - def resolveLink(ast: YNode, mapping: NodeMappable, id: String, givenAnnotations: Option[Annotations])( - implicit ctx: DialectInstanceContext): DialectDomainElement = { + def resolveLink(ast: YNode, mapping: NodeMappable, id: String, givenAnnotations: Option[Annotations])(implicit + ctx: DialectInstanceContext + ): DialectDomainElement = { val refTuple = ctx.link(ast) match { case Left(key) => (key, ctx.declarations.findDialectDomainElement(key, mapping, SearchScope.Fragments)) @@ -34,7 +36,7 @@ object IncludeNodeParser extends NodeMappableHelper { .withId(id) // and the ID of the link at that position in the tree, not the ID of the linked element, tha goes in link-target linkedNode case (text: String, _) => - val loc = givenAnnotations.flatMap(_.find(classOf[SourceAST])).map(_.ast) match { + val loc = givenAnnotations.flatMap(_.find(classOf[SourceYPart])).map(_.ast) match { case Some(n) => n.location case _ => ast.location } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/InstanceElementParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/InstanceElementParser.scala new file mode 100644 index 00000000..f0aaecf7 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/InstanceElementParser.scala @@ -0,0 +1,213 @@ +package amf.aml.internal.parse.instances.parser + +import amf.aml.client.scala.model.domain._ +import amf.aml.internal.parse.common.AnnotationsParser.parseAnnotations +import amf.aml.internal.parse.instances.ClosedInstanceNode.checkNode +import amf.aml.internal.parse.instances.DialectInstanceParser.{computeParsingScheme, emptyElement, typesFrom} +import amf.aml.internal.parse.instances.InstanceNodeIdHandling.generateNodeId +import amf.aml.internal.parse.instances.parser.IncludeNodeParser.resolveLink +import amf.aml.internal.parse.instances.parser.applicable.ApplicableMappingFinder +import amf.aml.internal.parse.instances.{DialectInstanceContext, NodeMappableHelper} +import amf.aml.internal.validate.DialectValidations.DialectError +import amf.core.client.scala.model.domain.DomainElement +import amf.core.client.scala.parse.document.SyamlParsedDocument +import amf.core.internal.parser.domain.Annotations +import amf.core.internal.parser.{Root, YMapOps} +import amf.core.internal.utils.AmfStrings +import org.yaml.model._ + +import scala.language.{higherKinds, implicitConversions} + +case class InstanceElementParser(root: Root)(implicit ctx: DialectInstanceContext) extends NodeMappableHelper { + + private val map: YMap = root.parsed.asInstanceOf[SyamlParsedDocument].document.as[YMap] + + def parse( + path: String, + id: String, + entry: YNode, + mapping: NodeMappable, + additionalProperties: Map[String, Any], + parseAllOf: Boolean + )(implicit ctx: DialectInstanceContext): DialectDomainElement = + parse(path, id, entry, mapping, additionalProperties, givenAnnotations = None, parseAllOf = parseAllOf) + + def parse( + path: String, + defaultId: String, + ast: YNode, + mappable: NodeMappable, + additionalProperties: Map[String, Any] = Map(), + rootNode: Boolean = false, + givenAnnotations: Option[Annotations], + additionalKey: Option[String] = None, + parseAllOf: Boolean = true + )(implicit ctx: DialectInstanceContext): DialectDomainElement = { + val result: DialectDomainElement = ast.tagType match { + case YType.Map => + val astMap = ast.as[YMap] + parseNodeMap( + path, + defaultId, + astMap, + ast, + mappable, + additionalProperties, + rootNode, + givenAnnotations, + additionalKey, + parseAllOf + ) + + case YType.Str => resolveLink(ast, mappable, defaultId, givenAnnotations) + case YType.Include => resolveLink(ast, mappable, defaultId, givenAnnotations) + case YType.Null => emptyElement(defaultId, ast, mappable, givenAnnotations) + case _ => + ctx.eh.violation(DialectError, defaultId, "Cannot parse AST node for node in dialect instance", ast.location) + DialectDomainElement().withId(defaultId) + } + // if we are parsing a patch document we mark the node as abstract + + mappable match { + case anyMappable: AnyMapping + if anyMappable.and.nonEmpty || anyMappable.or.nonEmpty || anyMappable.ifMapping + .option() + .nonEmpty => // don't do anything + case _ => assignDefinedByAndTypes(mappable, result) + } + if (ctx.isPatch) result.withAbstract(true) + result + } + + private def assignDefinedByAndTypes(mappable: NodeMappable, result: DialectDomainElement) = { + mappable match { + case mapping: NodeMapping => + result + .withDefinedBy(mapping) + .withInstanceTypes(typesFrom(mapping)) + case _ => // ignore + } + } + + private def checkNodeForAdditionalKeys( + id: String, + nodetype: String, + entries: Map[YNode, YNode], + mapping: NodeMapping, + ast: YPart, + rootNode: Boolean, + additionalKey: Option[String] + )(implicit ctx: DialectInstanceContext): Unit = { + checkNode(id, nodetype, entries, mapping, ast, rootNode, additionalKey) + } + + private def parseNodeMap( + path: String, + defaultId: String, + astMap: YMap, + ast: YNode, + mappable: NodeMappable, + additionalProperties: Map[String, Any], + rootNode: Boolean, + givenAnnotations: Option[Annotations], + additionalKey: Option[String], + parseAllOf: Boolean = true + )(implicit ctx: DialectInstanceContext) = { + computeParsingScheme(astMap) match { + case "$ref" => RefNodeParser.parse(defaultId, astMap, mappable, root) + case "$include" => IncludeNodeParser.parse(ast, mappable, defaultId, givenAnnotations) + case _ => + mappable match { + case any: AnyMapping + if parseAllOf && (any.and.nonEmpty || any.or.nonEmpty || any.ifMapping.option().nonEmpty) => + val applicableMapping = ApplicableMappingFinder(root).find(map, any) + applicableMapping + .map { foundMapping => + parseWithNodeMapping( + defaultId, + astMap, + ast, + additionalProperties, + rootNode, + givenAnnotations, + additionalKey, + foundMapping + ) + } + .getOrElse { + // TODO: add error + emptyElement(defaultId, astMap, mappable, givenAnnotations) + } + case mapping: NodeMapping => + parseWithNodeMapping( + defaultId, + astMap, + ast, + additionalProperties, + rootNode, + givenAnnotations, + additionalKey, + mapping + ) + case unionMapping: UnionNodeMapping => + parseObjectUnion(defaultId, Seq(path), ast, unionMapping, additionalProperties) + } + + } + } + + private def parseWithNodeMapping( + defaultId: String, + astMap: YMap, + ast: YNode, + additionalProperties: Map[String, Any], + rootNode: Boolean, + givenAnnotations: Option[Annotations], + additionalKey: Option[String], + mapping: NodeMapping + )(implicit ctx: DialectInstanceContext) = { + val annotations = givenAnnotations.getOrElse(Annotations(ast)) + val node: DialectDomainElement = DialectDomainElement(defaultId.urlDecoded, mapping, annotations) + val finalId = + generateNodeId(node, astMap, Seq(defaultId), defaultId, mapping, additionalProperties, rootNode, root) + node.withId(finalId) + parseAnnotations(astMap, node, ctx.declarations) + mapping.propertiesMapping().foreach { propertyMapping => + val propertyName = propertyMapping.name().value() + astMap.key(propertyName).foreach { entry => + val nestedId = computeNestedPropertyId(defaultId, rootNode, ctx) + parseProperty(nestedId, entry, propertyMapping, node) + } + } + val shouldErrorOnExtraProperties = mapping.closed.option().getOrElse(true) // default behaviour is to error out + if (shouldErrorOnExtraProperties) + checkNodeForAdditionalKeys(finalId, mapping.id, astMap.map, mapping, astMap, rootNode, additionalKey) + node + } + + private def computeNestedPropertyId(defaultId: String, rootNode: Boolean, ctx: DialectInstanceContext) = { + if (Option(ctx.dialect.documents()).flatMap(_.selfEncoded().option()).getOrElse(false) && rootNode) + defaultId + "#/" + else defaultId + } + + private def parseProperty( + id: String, + propertyEntry: YMapEntry, + property: PropertyMapping, + node: DialectDomainElement + )(implicit ctx: DialectInstanceContext): Unit = { + new ElementPropertyParser(root, map, parse).parse(id, propertyEntry, property, node) + } + + private def parseObjectUnion[T <: DomainElement]( + defaultId: String, + path: Seq[String], + ast: YNode, + unionMapping: NodeWithDiscriminator[_], + additionalProperties: Map[String, Any] = Map() + )(implicit ctx: DialectInstanceContext): DialectDomainElement = { + + ObjectUnionParser.parse(defaultId, path, ast, unionMapping, additionalProperties, root, map, parseProperty) + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/InstanceNodeParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/InstanceNodeParser.scala deleted file mode 100644 index 07c56741..00000000 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/InstanceNodeParser.scala +++ /dev/null @@ -1,165 +0,0 @@ -package amf.aml.internal.parse.instances.parser - -import amf.aml.client.scala.model.domain._ -import amf.aml.internal.metamodel.domain.NodeMappableModel -import amf.aml.internal.parse.common.AnnotationsParser.parseAnnotations -import amf.aml.internal.parse.instances.ClosedInstanceNode.checkNode -import amf.aml.internal.parse.instances.DialectInstanceParser.{computeParsingScheme, emptyElement, typesFrom} -import amf.aml.internal.parse.instances.InstanceNodeIdHandling.generateNodeId -import amf.aml.internal.parse.instances.parser.IncludeNodeParser.resolveLink -import amf.aml.internal.parse.instances.{DialectInstanceContext, NodeMappableHelper} -import amf.aml.internal.validate.DialectValidations.DialectError -import amf.core.client.scala.model.domain.DomainElement -import amf.core.client.scala.parse.document.SyamlParsedDocument -import amf.core.internal.parser.domain.Annotations -import amf.core.internal.parser.{Root, YMapOps} -import org.yaml.model._ - -case class InstanceNodeParser(root: Root)(implicit ctx: DialectInstanceContext) extends NodeMappableHelper { - - private val map: YMap = root.parsed.asInstanceOf[SyamlParsedDocument].document.as[YMap] - - def parse( - path: String, - id: String, - entry: YNode, - mapping: NodeMappable, - additionalProperties: Map[String, Any])(implicit ctx: DialectInstanceContext): DialectDomainElement = - parse(path, id, entry, mapping, additionalProperties, givenAnnotations = None) - - def parse(path: String, - defaultId: String, - ast: YNode, - mappable: NodeMappable, - additionalProperties: Map[String, Any] = Map(), - rootNode: Boolean = false, - givenAnnotations: Option[Annotations], - additionalKey: Option[String] = None, - )(implicit ctx: DialectInstanceContext): DialectDomainElement = { - val result: DialectDomainElement = ast.tagType match { - case YType.Map => - val astMap = ast.as[YMap] - parseNodeMap(path, - defaultId, - astMap, - ast, - mappable, - additionalProperties, - rootNode, - givenAnnotations, - additionalKey) - - case YType.Str => resolveLink(ast, mappable, defaultId, givenAnnotations) - case YType.Include => resolveLink(ast, mappable, defaultId, givenAnnotations) - case YType.Null => emptyElement(defaultId, ast, mappable, givenAnnotations) - case _ => - ctx.eh.violation(DialectError, defaultId, "Cannot parse AST node for node in dialect instance", ast.location) - DialectDomainElement().withId(defaultId) - } - // if we are parsing a patch document we mark the node as abstract - - if (ctx.isPatch) result.withAbstract(true) - assignDefinedByAndTypes(mappable, result) - result - } - - private def assignDefinedByAndTypes(mappable: NodeMappable, result: DialectDomainElement) = { - mappable match { - case mapping: NodeMapping => - result - .withDefinedBy(mapping) - .withInstanceTypes(typesFrom(mapping)) - case _ => // ignore - } - } - - private def checkNodeForAdditionalKeys(id: String, - nodetype: String, - entries: Map[YNode, YNode], - mapping: NodeMapping, - ast: YPart, - rootNode: Boolean, - additionalKey: Option[String])(implicit ctx: DialectInstanceContext): Unit = { - checkNode(id, nodetype, entries, mapping, ast, rootNode, additionalKey) - } - - private def parseNodeMap(path: String, - defaultId: String, - astMap: YMap, - ast: YNode, - mappable: NodeMappable, - additionalProperties: Map[String, Any], - rootNode: Boolean, - givenAnnotations: Option[Annotations], - additionalKey: Option[String])(implicit ctx: DialectInstanceContext) = { - computeParsingScheme(astMap) match { - case "$ref" => RefNodeParser.parse(defaultId, astMap, mappable, root) - case "$include" => IncludeNodeParser.parse(ast, mappable, defaultId, givenAnnotations) - case _ => - mappable match { - case mapping: NodeMapping => - parseWithNodeMapping(defaultId, - astMap, - ast, - additionalProperties, - rootNode, - givenAnnotations, - additionalKey, - mapping) - case unionMapping: UnionNodeMapping => - parseObjectUnion(defaultId, Seq(path), ast, unionMapping, additionalProperties) - } - - } - } - - private def parseWithNodeMapping(defaultId: String, - astMap: YMap, - ast: YNode, - additionalProperties: Map[String, Any], - rootNode: Boolean, - givenAnnotations: Option[Annotations], - additionalKey: Option[String], - mapping: NodeMapping)(implicit ctx: DialectInstanceContext) = { - val node: DialectDomainElement = - DialectDomainElement(givenAnnotations.getOrElse(Annotations(ast))).withDefinedBy(mapping) - val finalId = - generateNodeId(node, astMap, Seq(defaultId), defaultId, mapping, additionalProperties, rootNode, root) - node.withId(finalId) - assignDefinedByAndTypes(mapping, node) - parseAnnotations(astMap, node, ctx.declarations) - mapping.propertiesMapping().foreach { propertyMapping => - val propertyName = propertyMapping.name().value() - astMap.key(propertyName) match { - case Some(entry) => - val nestedId = - if (Option(ctx.dialect.documents()) - .flatMap(_.selfEncoded().option()) - .getOrElse(false) && rootNode) - defaultId + "#/" - else defaultId - parseProperty(nestedId, entry, propertyMapping, node) - case None => // ignore - } - } - checkNodeForAdditionalKeys(finalId, mapping.id, astMap.map, mapping, astMap, rootNode, additionalKey) - node - } - - private def parseProperty(id: String, - propertyEntry: YMapEntry, - property: PropertyMapping, - node: DialectDomainElement)(implicit ctx: DialectInstanceContext): Unit = { - new ElementPropertyParser(root, map, parse).parse(id, propertyEntry, property, node) - } - - private def parseObjectUnion[T <: DomainElement]( - defaultId: String, - path: Seq[String], - ast: YNode, - unionMapping: NodeWithDiscriminator[_], - additionalProperties: Map[String, Any] = Map())(implicit ctx: DialectInstanceContext): DialectDomainElement = { - - ObjectUnionParser.parse(defaultId, path, ast, unionMapping, additionalProperties, root, map, parseProperty) - } -} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/JSONPointerPropertyParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/JSONPointerPropertyParser.scala index e2637480..db132518 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/JSONPointerPropertyParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/JSONPointerPropertyParser.scala @@ -9,8 +9,9 @@ import org.yaml.model.YMap object JSONPointerPropertyParser { - def parse(map: YMap, mapping: PropertyLikeMapping[_], id: String, node: DialectDomainElement, root: Root)( - implicit ctx: DialectInstanceContext): Unit = { + def parse(map: YMap, mapping: PropertyLikeMapping[_], id: String, node: DialectDomainElement, root: Root)(implicit + ctx: DialectInstanceContext + ): Unit = { val entry = map.key("$ref").get val pointer = entry.value.as[String] val fullPointer = if (pointer.startsWith("#")) { @@ -32,20 +33,24 @@ object JSONPointerPropertyParser { val linkedExternal = s .link(pointer, Annotations(map)) .asInstanceOf[DialectDomainElement] - .withId(id) // and the ID of the link at that position in the tree, not the ID of the linked element, tha goes in link-target + .withId( + id + ) // and the ID of the link at that position in the tree, not the ID of the linked element, tha goes in link-target node.withObjectField(mapping, linkedExternal, Right(entry)) case None => - ctx.eh.violation(DialectError, - id, - s"Cannot find dialect for anyNode node mapping ${s.definedBy.id}", - map.location) + ctx.eh.violation( + DialectError, + id, + s"Cannot find dialect for anyNode node mapping ${s.definedBy.id}", + map.location + ) } case None => ctx.eh.violation( - DialectError, - id, - s"anyNode reference must be to a known node or an external fragment, unknown JSON Pointer: '$pointer'", - map.location + DialectError, + id, + s"anyNode reference must be to a known node or an external fragment, unknown JSON Pointer: '$pointer'", + map.location ) } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/KeyValuePropertyParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/KeyValuePropertyParser.scala index 4a05f39a..625b3da1 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/KeyValuePropertyParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/KeyValuePropertyParser.scala @@ -14,8 +14,9 @@ import org.yaml.model.{YMap, YMapEntry, YScalar, YSequence} object KeyValuePropertyParser { - def parse(id: String, propertyEntry: YMapEntry, property: PropertyLikeMapping[_], node: DialectDomainElement)( - implicit ctx: DialectInstanceContext): Unit = { + def parse(id: String, propertyEntry: YMapEntry, property: PropertyLikeMapping[_], node: DialectDomainElement)(implicit + ctx: DialectInstanceContext + ): Unit = { val (propertyKeyMapping, propertyValueMapping) = computeMapKeyAndValueFrom(property) if (propertyKeyMapping.isDefined && propertyValueMapping.isDefined) { val nested = ctx.dialect.declares.find(_.id == property.objectRange().head.value()) match { @@ -32,44 +33,47 @@ object KeyValuePropertyParser { .withDefinedBy(nodeMapping) .withInstanceTypes(effectiveTypes) try { - nestedNode.set(Field(Str, ValueType(propertyKeyMapping.get)), - AmfScalar(pair.key.as[YScalar].text), - Annotations(pair.key)) + nestedNode.set( + Field(Str, ValueType(propertyKeyMapping.get)), + AmfScalar(pair.key.as[YScalar].text), + Annotations(pair.key) + ) if (valueAllowsMultiple) { pair.value.value match { case seq: YSequence => nestedNode.set( - Field(Array(Str), ValueType(propertyValueMapping.get)), - AmfArray(seq.nodes.flatMap(_.asScalar).map(AmfScalar(_)), Annotations(seq)), - Annotations(pair.value) + Field(Array(Str), ValueType(propertyValueMapping.get)), + AmfArray(seq.nodes.flatMap(_.asScalar).map(AmfScalar(_)), Annotations(seq)), + Annotations(pair.value) ) case scalar: YScalar => - nestedNode.set(Field(Array(Str), ValueType(propertyValueMapping.get)), - AmfArray(Seq(AmfScalar(scalar.text))), - Annotations(pair.value)) - case _ => // ignore + nestedNode.set( + Field(Array(Str), ValueType(propertyValueMapping.get)), + AmfArray(Seq(AmfScalar(scalar.text))), + Annotations(pair.value) + ) + case _ => // ignore TODO handle YMaps } } else { - nestedNode.set(Field(Str, ValueType(propertyValueMapping.get)), - AmfScalar(pair.value.as[YScalar].text), - Annotations(pair.value)) + nestedNode.set( + Field(Str, ValueType(propertyValueMapping.get)), + AmfScalar(pair.value.as[YScalar].text), + Annotations(pair.value) + ) } } catch { case e: UnknownMapKeyProperty => - ctx.eh.violation(DialectError, - e.id, - s"Cannot find mapping for key map property ${e.id}", - pair.location) + ctx.eh.violation(DialectError, e.id, s"Cannot find mapping for key map property ${e.id}", pair.location) } Some(nestedNode) } case _ => ctx.eh.violation( - DialectError, - id, - s"Cannot find mapping for property range of mapValue property: ${property.objectRange().head.value()}", - propertyEntry.location + DialectError, + id, + s"Cannot find mapping for property range of mapValue property: ${property.objectRange().head.value()}", + propertyEntry.location ) Nil } @@ -77,10 +81,12 @@ object KeyValuePropertyParser { node.withObjectCollectionProperty(property, nested, Left(propertyEntry.key)) } else { - ctx.eh.violation(DialectError, - id, - s"Both 'mapKey' and 'mapValue' are mandatory in a map pair property mapping", - propertyEntry.location) + ctx.eh.violation( + DialectError, + id, + s"Both 'mapKey' and 'mapValue' are mandatory in a map pair property mapping", + propertyEntry.location + ) } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/LinkIncludePropertyParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/LinkIncludePropertyParser.scala index 509b4ccc..832cdad3 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/LinkIncludePropertyParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/LinkIncludePropertyParser.scala @@ -8,11 +8,13 @@ import amf.core.internal.parser.domain.{Annotations, SearchScope} import org.yaml.model.{YMapEntry, YScalar} object LinkIncludePropertyParser { - def parse(propertyEntry: YMapEntry, - mapping: PropertyLikeMapping[_], - id: String, - node: DialectDomainElement, - isRef: Boolean = false)(implicit ctx: DialectInstanceContext): Unit = { + def parse( + propertyEntry: YMapEntry, + mapping: PropertyLikeMapping[_], + id: String, + node: DialectDomainElement, + isRef: Boolean = false + )(implicit ctx: DialectInstanceContext): Unit = { val refTuple = ctx.link(propertyEntry.value) match { case Left(key) => (key, ctx.declarations.findAnyDialectDomainElement(key, SearchScope.Fragments)) @@ -28,21 +30,25 @@ object LinkIncludePropertyParser { val linkedExternal = s .link(text, Annotations(propertyEntry.value)) .asInstanceOf[DialectDomainElement] - .withId(id) // and the ID of the link at that position in the tree, not the ID of the linked element, tha goes in link-target + .withId( + id + ) // and the ID of the link at that position in the tree, not the ID of the linked element, tha goes in link-target if (isRef) linkedExternal.annotations += RefInclude() node.withObjectField(mapping, linkedExternal, Right(propertyEntry)) case None => - ctx.eh.violation(DialectError, - id, - s"Cannot find dialect for anyNode node mapping ${s.definedBy.id}", - propertyEntry.value.location) + ctx.eh.violation( + DialectError, + id, + s"Cannot find dialect for anyNode node mapping ${s.definedBy.id}", + propertyEntry.value.location + ) } case _ => ctx.eh.violation( - DialectError, - id, - s"anyNode reference must be to a known node or an external fragment, unknown value: '${propertyEntry.value}'", - propertyEntry.value.location + DialectError, + id, + s"anyNode reference must be to a known node or an external fragment, unknown value: '${propertyEntry.value}'", + propertyEntry.value.location ) } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/LiteralCollectionParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/LiteralCollectionParser.scala index 3931edca..fa7812e4 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/LiteralCollectionParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/LiteralCollectionParser.scala @@ -6,15 +6,16 @@ import org.yaml.model.{YMapEntry, YSequence, YType} object LiteralCollectionParser { - def parse(propertyEntry: YMapEntry, property: PropertyLikeMapping[_], node: DialectDomainElement)( - implicit ctx: DialectInstanceContext): Unit = { + def parse(propertyEntry: YMapEntry, property: PropertyLikeMapping[_], node: DialectDomainElement)(implicit + ctx: DialectInstanceContext + ): Unit = { val finalValues = propertyEntry.value.tagType match { case YType.Seq => val values = propertyEntry.value .as[YSequence] .nodes .flatMap { elemValue => - LiteralValueParser.parseLiteralValue(elemValue, property, node) + LiteralValueParser.parseLiteralValue(elemValue, property, node)(ctx.eh) } values.headOption match { @@ -23,7 +24,7 @@ object LiteralCollectionParser { } case _ => - LiteralValueParser.parseLiteralValue(propertyEntry.value, property, node) match { + LiteralValueParser.parseLiteralValue(propertyEntry.value, property, node)(ctx.eh) match { case Some(("link", v)) => Seq(v) case Some(v) => Seq(v) case _ => Nil diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/LiteralValueParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/LiteralValueParser.scala index 0a90c9ea..9501ca5f 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/LiteralValueParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/LiteralValueParser.scala @@ -1,23 +1,29 @@ package amf.aml.internal.parse.instances.parser -import amf.aml.client.scala.model.domain.{DialectDomainElement, PropertyLikeMapping, PropertyMapping} -import amf.aml.internal.parse.instances.DialectInstanceContext -import amf.aml.internal.validate.DialectValidations.DialectError +import amf.aml.client.scala.model.domain.{DialectDomainElement, PropertyLikeMapping} +import amf.aml.internal.validate.DialectValidations.{DialectError, InconsistentPropertyRangeValueSpecification} +import amf.core.client.scala.errorhandling.AMFErrorHandler import amf.core.client.scala.model.DataType import amf.core.client.scala.vocabulary.Namespace +import amf.core.internal.annotations.LexicalInformation +import amf.core.internal.parser.domain.Annotations +import amf.core.internal.plugins.syntax.SyamlAMFErrorHandler import org.mulesoft.common.time.SimpleDateTime import org.yaml.model.{YMapEntry, YNode, YScalar, YType} object LiteralValueSetter { - def setLiteralValue(parsed: Option[_], - entry: YMapEntry, - property: PropertyLikeMapping[_], - node: DialectDomainElement): Unit = { + def setLiteralValue( + parsed: Option[_], + entry: YMapEntry, + property: PropertyLikeMapping[_], + node: DialectDomainElement + ): Unit = { parsed match { case Some(b: Boolean) => node.setProperty(property, b, entry) case Some(i: Int) => node.setProperty(property, i, entry) case Some(f: Float) => node.setProperty(property, f, entry) case Some(d: Double) => node.setProperty(property, d, entry) + case Some(l: Long) => node.setProperty(property, l, entry) case Some(s: String) => node.setProperty(property, s, entry) case Some(("link", l: String)) => node.setProperty(property, l, entry) case Some(d: SimpleDateTime) => node.setProperty(property, d, entry) @@ -28,8 +34,15 @@ object LiteralValueSetter { object LiteralValueParser { - def parseLiteralValue(value: YNode, property: PropertyLikeMapping[_], node: DialectDomainElement)( - implicit ctx: DialectInstanceContext): Option[_] = { + def parseLiteralValue(value: YNode, property: PropertyLikeMapping[_], element: DialectDomainElement)(implicit + eh: AMFErrorHandler + ): Option[_] = { + parseLiteralValue(value, property, element.id, Annotations(value))(new SyamlAMFErrorHandler(eh)) + } + + def parseLiteralValue(value: YNode, property: PropertyLikeMapping[_], nodeId: String, annotations: Annotations)( + implicit eh: SyamlAMFErrorHandler + ): Option[_] = { value.tagType match { case YType.Bool @@ -38,11 +51,13 @@ object LiteralValueParser { .value() == DataType.Any => Some(value.as[Boolean]) case YType.Bool => - ctx.inconsistentPropertyRangeValueViolation(node.id, - property, - property.literalRange().value(), - DataType.Boolean, - value) + inconsistentPropertyRangeValueViolation( + nodeId, + property, + property.literalRange().value(), + DataType.Boolean, + annotations + )(eh) None case YType.Int if property.literalRange().value() == DataType.Integer || property @@ -53,12 +68,16 @@ object LiteralValueParser { if property.literalRange().value() == DataType.Float || property.literalRange().value() == DataType.Double => Some(value.as[Double]) + case YType.Int if property.literalRange().value() == DataType.Long => + Some(value.as[Long]) case YType.Int => - ctx.inconsistentPropertyRangeValueViolation(node.id, - property, - property.literalRange().value(), - DataType.Integer, - value) + inconsistentPropertyRangeValueViolation( + nodeId, + property, + property.literalRange().value(), + DataType.Integer, + annotations + )(eh) None case YType.Str if property.literalRange().value() == DataType.String || property.literalRange().value() == DataType.Any => @@ -75,11 +94,13 @@ object LiteralValueParser { case YType.Str if property.literalRange().value() == (Namespace.Shapes + "guid").iri() => Some(value.as[YScalar].text) case YType.Str => - ctx.inconsistentPropertyRangeValueViolation(node.id, - property, - property.literalRange().value(), - DataType.String, - value) + inconsistentPropertyRangeValueViolation( + nodeId, + property, + property.literalRange().value(), + DataType.String, + annotations + )(eh) None case YType.Float if property.literalRange().value() == DataType.Float || @@ -88,11 +109,13 @@ object LiteralValueParser { property.literalRange().value() == DataType.Any => Some(value.as[Double]) case YType.Float => - ctx.inconsistentPropertyRangeValueViolation(node.id, - property, - property.literalRange().value(), - DataType.Float, - value) + inconsistentPropertyRangeValueViolation( + nodeId, + property, + property.literalRange().value(), + DataType.Float, + annotations + )(eh) None case YType.Timestamp @@ -106,18 +129,38 @@ object LiteralValueParser { Some(value.as[YScalar].text) case YType.Timestamp => - ctx.inconsistentPropertyRangeValueViolation(node.id, - property, - property.literalRange().value(), - DataType.DateTime, - value) + inconsistentPropertyRangeValueViolation( + nodeId, + property, + property.literalRange().value(), + DataType.DateTime, + annotations + )(eh) Some(value.as[String]) case YType.Null => None case _ => - ctx.eh.violation(DialectError, node.id, s"Unsupported scalar type ${value.tagType}", value.location) + eh.violation(DialectError, nodeId, s"Unsupported scalar type ${value.tagType}", annotations) Some(value.as[String]) } } + + private def inconsistentPropertyRangeValueViolation( + node: String, + property: PropertyLikeMapping[_], + expected: String, + found: String, + annotations: Annotations + )(eh: SyamlAMFErrorHandler): Unit = { + eh.violation( + InconsistentPropertyRangeValueSpecification, + node, + Some(property.nodePropertyMapping().value()), + s"Cannot find expected range for property ${property.nodePropertyMapping().value()} (${property.name().value()}). Found '$found', expected '$expected'", + Some(LexicalInformation(annotations.lexical())), + annotations.location() + ) + + } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ObjectCollectionPropertyParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ObjectCollectionPropertyParser.scala index 4fa4931f..861b70bb 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ObjectCollectionPropertyParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ObjectCollectionPropertyParser.scala @@ -18,18 +18,20 @@ import scala.language.higherKinds object ObjectCollectionPropertyParser extends NodeMappableHelper { - type NodeParser = (String, String, YNode, NodeMappable, Map[String, Any]) => DialectDomainElement + type NodeParser = (String, String, YNode, NodeMappable, Map[String, Any], Boolean) => DialectDomainElement type ObjectUnionParser[T <: DomainElement] = (String, Seq[String], YNode, NodeWithDiscriminator[_], Map[String, Any]) => DialectDomainElement - def parse[T <: DomainElement](id: String, - propertyEntry: YMapEntry, - property: PropertyLikeMapping[_], - node: DialectDomainElement, - additionalProperties: Map[String, Any] = Map(), - unionParser: ObjectUnionParser[T], - nodeParser: NodeParser)(implicit ctx: DialectInstanceContext): Unit = { + def parse[T <: DomainElement]( + id: String, + propertyEntry: YMapEntry, + property: PropertyLikeMapping[_], + node: DialectDomainElement, + additionalProperties: Map[String, Any] = Map(), + unionParser: ObjectUnionParser[T], + nodeParser: NodeParser + )(implicit ctx: DialectInstanceContext): Unit = { // just to store Ids, and detect potentially duplicated elements in the collection val idsMap: mutable.Map[String, Boolean] = mutable.Map() @@ -38,40 +40,43 @@ object ObjectCollectionPropertyParser extends NodeMappableHelper { case _ => Seq(propertyEntry.value) } - val elems = entries.zipWithIndex.flatMap { - case (elementNode, nextElem) => - val path = List(propertyEntry.key.as[YScalar].text, nextElem.toString) - val nestedObjectId = pathSegment(id, path) - property.nodesInRange match { - case range: Seq[String] if range.size > 1 => - val parsed = unionParser(nestedObjectId, path, elementNode, property, additionalProperties) - checkDuplicated(parsed, elementNode, idsMap) - Some(parsed) - case range: Seq[String] if range.size == 1 => - ctx.dialect.declares.find(_.id == range.head) match { - case Some(nodeMapping: NodeMappable) => - val dialectDomainElement = - nodeParser(id, nestedObjectId, elementNode, nodeMapping, additionalProperties) - checkDuplicated(dialectDomainElement, elementNode, idsMap) - Some(dialectDomainElement) - case _ => None - } - case _ => None - } + val elems = entries.zipWithIndex.flatMap { case (elementNode, nextElem) => + val path = List(propertyEntry.key.as[YScalar].text, nextElem.toString) + val nestedObjectId = pathSegment(id, path) + property.nodesInRange match { + case range: Seq[String] if range.size > 1 => + val parsed = unionParser(nestedObjectId, path, elementNode, property, additionalProperties) + checkDuplicated(parsed, elementNode, idsMap) + Some(parsed) + case range: Seq[String] if range.size == 1 => + ctx.dialect.declares.find(_.id == range.head) match { + case Some(nodeMapping: NodeMappable) => + val dialectDomainElement = + nodeParser(id, nestedObjectId, elementNode, nodeMapping, additionalProperties, false) + checkDuplicated(dialectDomainElement, elementNode, idsMap) + Some(dialectDomainElement) + case _ => None + } + case _ => None + } } node.withObjectCollectionProperty(property, elems, Right(propertyEntry)) } - def checkDuplicated(dialectDomainElement: DialectDomainElement, - elementNode: YNode, - idsMap: mutable.Map[String, Boolean])(implicit ctx: DialectInstanceContext): Unit = { + def checkDuplicated( + dialectDomainElement: DialectDomainElement, + elementNode: YNode, + idsMap: mutable.Map[String, Boolean] + )(implicit ctx: DialectInstanceContext): Unit = { idsMap.get(dialectDomainElement.id) match { case None => idsMap.update(dialectDomainElement.id, true) case _ => - ctx.eh.violation(DialectError, - dialectDomainElement.id, - s"Duplicated element in collection ${dialectDomainElement.id}", - elementNode.location) + ctx.eh.violation( + DialectError, + dialectDomainElement.id, + s"Duplicated element in collection ${dialectDomainElement.id}", + elementNode.location + ) } } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ObjectMapPropertyParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ObjectMapPropertyParser.scala index 822585ae..c3418697 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ObjectMapPropertyParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ObjectMapPropertyParser.scala @@ -1,12 +1,13 @@ package amf.aml.internal.parse.instances.parser -import amf.aml.client.scala.model.domain.{DialectDomainElement, NodeMappable, PropertyMapping, UnknownMapKeyProperty} -import amf.aml.internal.parse.instances.{DialectInstanceContext, NodeMappableHelper} +import amf.aml.client.scala.model.domain.{DialectDomainElement, PropertyLikeMapping, UnknownMapKeyProperty} import amf.aml.internal.parse.instances.DialectInstanceParser.pathSegment import amf.aml.internal.parse.instances.parser.ObjectCollectionPropertyParser.{NodeParser, ObjectUnionParser} +import amf.aml.internal.parse.instances.{DialectInstanceContext, NodeMappableHelper} import amf.aml.internal.validate.DialectValidations.DialectError import amf.core.client.scala.model.domain.{AmfScalar, DomainElement} import amf.core.client.scala.vocabulary.ValueType +import amf.core.internal.annotations.LexicalInformation import amf.core.internal.metamodel.Field import amf.core.internal.metamodel.Type.Str import amf.core.internal.parser.domain.Annotations @@ -14,57 +15,70 @@ import org.yaml.model.{YMap, YMapEntry, YScalar, YType} object ObjectMapPropertyParser extends NodeMappableHelper { - def parse[T <: DomainElement](id: String, - propertyEntry: YMapEntry, - property: PropertyMapping, - node: DialectDomainElement, - additionalProperties: Map[String, Any] = Map(), - unionParser: ObjectUnionParser[T], - nodeParser: NodeParser)(implicit ctx: DialectInstanceContext): Unit = { - val nested = propertyEntry.value.as[YMap].entries.map { keyEntry => - val path = List(propertyEntry.key.as[YScalar].text, keyEntry.key.as[YScalar].text) + def parse[T <: DomainElement]( + id: String, + propertyValueEntry: YMapEntry, + propertyLikeMapping: PropertyLikeMapping[_], + node: DialectDomainElement, + additionalProperties: Map[String, Any] = Map(), + unionParser: ObjectUnionParser[T], + nodeParser: NodeParser + )(implicit ctx: DialectInstanceContext): Unit = { + val nested = propertyValueEntry.value.as[YMap].entries.map { keyEntry => + val path = List(propertyValueEntry.key.as[YScalar].text, keyEntry.key.as[YScalar].text) val nestedObjectId = pathSegment(id, path) + // we add the potential mapKey additional property - val keyAdditionalProperties: Map[String, Any] = findHashProperties(property, keyEntry) match { + val keyAdditionalProperties: Map[String, Any] = findHashProperties(propertyLikeMapping, keyEntry) match { case Some((k, v)) => additionalProperties + (k -> v) case _ => additionalProperties } - val parsedNode = property.nodesInRange match { - case range: Seq[String] if range.size > 1 => + val isUnion = (range: Seq[String]) => range.size > 1 + val parsedNode = propertyLikeMapping.nodesInRange match { + + case range: Seq[String] if isUnion(range) => // we also add the potential mapValue property - val keyValueAdditionalProperties = property.mapTermValueProperty().option() match { + val keyValueAdditionalProperties = propertyLikeMapping.mapTermValueProperty().option() match { case Some(mapValueProperty) => keyAdditionalProperties + (mapValueProperty -> "") case _ => keyAdditionalProperties } // now we can parse the union with all the required properties to find the right node in the union - Some(unionParser(nestedObjectId, path, keyEntry.value, property, keyValueAdditionalProperties)) + Some(unionParser(nestedObjectId, path, keyEntry.value, propertyLikeMapping, keyValueAdditionalProperties)) + case range: Seq[String] if range.size == 1 => ctx.dialect.declares.find(_.id == range.head) match { case Some(nodeMapping: NodeMappable) if keyEntry.value.tagType != YType.Null => - Some(nodeParser(id, nestedObjectId, keyEntry.value, nodeMapping, keyAdditionalProperties)) + Some(nodeParser(id, nestedObjectId, keyEntry.value, nodeMapping, keyAdditionalProperties, false)) case _ => None } + case _ => None } parsedNode match { - case Some(dialectDomainElement) => Some(checkHashProperties(dialectDomainElement, property, keyEntry)) - case None => None + case Some(dialectDomainElement) => + Some(checkHashProperties(dialectDomainElement, propertyLikeMapping, keyEntry)) + case None => None } } - node.withObjectCollectionProperty(property, nested.flatten, Right(propertyEntry)) + node.withObjectCollectionProperty(propertyLikeMapping, nested.flatten, Right(propertyValueEntry)) } protected def checkHashProperties( node: DialectDomainElement, - propertyMapping: PropertyMapping, - propertyEntry: YMapEntry)(implicit ctx: DialectInstanceContext): DialectDomainElement = { + propertyMapping: PropertyLikeMapping[_], + propertyEntry: YMapEntry + )(implicit ctx: DialectInstanceContext): DialectDomainElement = { // TODO: check if the node already has a value and that it matches (maybe coming from a declaration) propertyMapping.mapTermKeyProperty().option() match { case Some(propId) => try { - node.set(Field(Str, ValueType(propId)), - AmfScalar(propertyEntry.key.as[YScalar].text), - Annotations(propertyEntry.key)) + node.set( + Field(Str, ValueType(propId)), + AmfScalar(propertyEntry.key.as[YScalar].text), + Annotations(propertyEntry.key) + ) + node.annotations.reject(_.isInstanceOf[LexicalInformation]) ++= Annotations(propertyEntry) + node } catch { case e: UnknownMapKeyProperty => ctx.eh.violation(DialectError, e.id, s"Cannot find mapping for key map property ${e.id}") @@ -74,8 +88,9 @@ object ObjectMapPropertyParser extends NodeMappableHelper { } } - protected def findHashProperties(propertyMapping: PropertyMapping, propertyEntry: YMapEntry)( - implicit ctx: DialectInstanceContext): Option[(String, Any)] = { + protected def findHashProperties(propertyMapping: PropertyLikeMapping[_], propertyEntry: YMapEntry)(implicit + ctx: DialectInstanceContext + ): Option[(String, Any)] = { propertyMapping.mapTermKeyProperty().option() match { case Some(propId) => Some((propId, propertyEntry.key.as[YScalar].text)) case None => None diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ObjectPropertyParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ObjectPropertyParser.scala index cfd28832..99cc9c09 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ObjectPropertyParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ObjectPropertyParser.scala @@ -10,13 +10,15 @@ import org.yaml.model.{YMapEntry, YScalar} object ObjectPropertyParser extends NodeMappableHelper { - def parse[T <: DomainElement](id: String, - propertyEntry: YMapEntry, - property: PropertyLikeMapping[_], - node: DialectDomainElement, - additionalProperties: Map[String, Any] = Map(), - unionParser: ObjectUnionParser[T], - nodeParser: NodeParser)(implicit ctx: DialectInstanceContext): Unit = { + def parse[T <: DomainElement]( + id: String, + propertyEntry: YMapEntry, + property: PropertyLikeMapping[_], + node: DialectDomainElement, + additionalProperties: Map[String, Any] = Map(), + unionParser: ObjectUnionParser[T], + nodeParser: NodeParser + )(implicit ctx: DialectInstanceContext): Unit = { val path = propertyEntry.key.as[YScalar].text val nestedObjectId = pathSegment(id, List(path)) property.nodesInRange match { @@ -25,44 +27,50 @@ object ObjectPropertyParser extends NodeMappableHelper { unionParser(nestedObjectId, Seq(path), propertyEntry.value, property, additionalProperties) node.withObjectField(property, parsedRange, Right(propertyEntry)) case range: Seq[String] if range.size == 1 => - SimpleObjectPropertyParser.parse(id, - nestedObjectId, - range.head, - propertyEntry, - property, - node, - additionalProperties, - nodeParser) + SimpleObjectPropertyParser.parse( + id, + nestedObjectId, + range.head, + propertyEntry, + property, + node, + additionalProperties, + nodeParser + ) case _ => // TODO: throw exception, illegal range } } } object SimpleObjectPropertyParser { - def parse(id: String, - propertyEntry: YMapEntry, - property: PropertyLikeMapping[_], - node: DialectDomainElement, - additionalProperties: Map[String, Any], - nodeParser: NodeParser)(implicit ctx: DialectInstanceContext): Unit = { + def parse( + id: String, + propertyEntry: YMapEntry, + property: PropertyLikeMapping[_], + node: DialectDomainElement, + additionalProperties: Map[String, Any], + nodeParser: NodeParser + )(implicit ctx: DialectInstanceContext): Unit = { val path = propertyEntry.key.as[YScalar].text val nestedObjectId = pathSegment(id, List(path)) val range = property.nodesInRange.head parse(id, nestedObjectId, range, propertyEntry, property, node, additionalProperties, nodeParser) } - def parse(id: String, - nestedObjectId: String, - rangeId: String, - propertyEntry: YMapEntry, - property: PropertyLikeMapping[_], - node: DialectDomainElement, - additionalProperties: Map[String, Any] = Map(), - nodeParser: NodeParser)(implicit ctx: DialectInstanceContext): Unit = { + def parse( + id: String, + nestedObjectId: String, + rangeId: String, + propertyEntry: YMapEntry, + property: PropertyLikeMapping[_], + node: DialectDomainElement, + additionalProperties: Map[String, Any] = Map(), + nodeParser: NodeParser + )(implicit ctx: DialectInstanceContext): Unit = { ctx.dialect.declares.find(_.id == rangeId) match { case Some(nodeMapping: NodeMappable) => val dialectDomainElement = - nodeParser(id, nestedObjectId, propertyEntry.value, nodeMapping, additionalProperties) + nodeParser(id, nestedObjectId, propertyEntry.value, nodeMapping, additionalProperties, false) node.withObjectField(property, dialectDomainElement, Right(propertyEntry)) case _ => // ignore } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ObjectUnionParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ObjectUnionParser.scala index 4e6590b7..ebe8a2df 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ObjectUnionParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/ObjectUnionParser.scala @@ -1,22 +1,17 @@ package amf.aml.internal.parse.instances.parser -import amf.aml.client.scala.model.domain.{DialectDomainElement, NodeMapping, NodeWithDiscriminator, UnionNodeMapping} -import amf.aml.internal.annotations.{DiscriminatorField, FromUnionNodeMapping, JsonPointerRef, RefInclude} -import amf.aml.internal.metamodel.domain.NodeWithDiscriminatorModel +import amf.aml.client.scala.model.domain._ +import amf.aml.internal.annotations._ import amf.aml.internal.parse.instances.ClosedInstanceNode.checkNode import amf.aml.internal.parse.instances.InstanceNodeIdHandling.generateNodeId import amf.aml.internal.parse.instances.finder.{IncludeFirstUnionElementFinder, JSONPointerUnionFinder} import amf.aml.internal.parse.instances.parser.ExternalLinkGenerator.PropertyParser import amf.aml.internal.parse.instances.{DialectInstanceContext, DialectInstanceParser} -import amf.aml.internal.validate.DialectValidations.{ - DialectAmbiguousRangeSpecification, - DialectError, - InvalidUnionType -} +import amf.aml.internal.validate.DialectValidations.{DialectAmbiguousRangeSpecification, DialectError, InvalidUnionType} import amf.core.client.scala.model.domain.{Annotation, DomainElement} import amf.core.internal.parser.Root import amf.core.internal.parser.domain.Annotations -import org.yaml.model.{YMap, YNode, YPart, YScalar, YType} +import org.yaml.model._ object ObjectUnionParser { @@ -28,43 +23,14 @@ object ObjectUnionParser { additionalProperties: Map[String, Any] = Map(), root: Root, rootMap: YMap, - propertyParser: PropertyParser)(implicit ctx: DialectInstanceContext): DialectDomainElement = { + propertyParser: PropertyParser + )(implicit ctx: DialectInstanceContext): DialectDomainElement = { // potential node range based in the objectRange - val unionMembers: Seq[NodeMapping] = unionMapping.objectRange().flatMap { memberId => - ctx.dialect.declares.find(_.id == memberId.value()) match { - case Some(nodeMapping: NodeMapping) => Some(nodeMapping) - case _ => - ctx.eh - .violation(DialectError, - defaultId, - s"Cannot find mapping for property ${unionMapping.id} in union", - ast.location) - None - } - } + val unionMembers: Seq[NodeMapping] = findUnionMembers(defaultId, unionMapping, ast) // potential node range based in discriminators map - val discriminatorsMapping: Map[String, NodeMapping] = { - Option(unionMapping.typeDiscriminator()) match { - case Some(discriminatorValueMapping) => - discriminatorValueMapping.flatMap { - case (discriminatorValue, nodeMappingId) => - ctx.dialect.declares.find(_.id == nodeMappingId) match { - case Some(nodeMapping: NodeMapping) => Some(discriminatorValue -> nodeMapping) - case _ => - ctx.eh.violation( - DialectError, - defaultId, - s"Cannot find mapping for property $nodeMappingId in discriminator value '$discriminatorValue' in union", - ast.location) - None - } - } - case None => - Map.empty - } - } + val discriminatorsMapping: Map[String, NodeMapping] = findDiscriminatorMappings(unionMapping, defaultId, ast) // all possible mappings combining objectRange and type discriminator // TODO: we should choose either of these, not both @@ -90,32 +56,36 @@ object ObjectUnionParser { ref case _ => val discriminatorName = unionMapping.typeDiscriminatorName().option() - val mappings = findCompatibleMapping(defaultId, - unionMembers, - discriminatorsMapping, - discriminatorName, - nodeMap, - additionalProperties.keys.toSeq) + val mappings = findCompatibleMapping( + defaultId, + unionMembers, + discriminatorsMapping, + discriminatorName, + nodeMap, + additionalProperties.keys.toSeq + ) if (mappings.isEmpty) { ctx.eh.violation( - DialectAmbiguousRangeSpecification, - defaultId, - s"Ambiguous node in union range, found 0 compatible mappings from ${allPossibleMappings.size} mappings: [${allPossibleMappings.map(_.id).mkString(",")}]", - ast.location + DialectAmbiguousRangeSpecification, + defaultId, + s"Ambiguous node in union range, found 0 compatible mappings from ${allPossibleMappings.size} mappings: [${allPossibleMappings.map(_.id).mkString(",")}]", + ast.location ) - DialectDomainElement(annotations) + DialectDomainElement(annotations += FromUnionRangeMapping(allPossibleMappings.map(_.id))) .withId(defaultId) } else if (mappings.size == 1) { val node: DialectDomainElement = DialectDomainElement(annotations).withDefinedBy(mappings.head) val finalId = - generateNodeId(node, - nodeMap, - path, - defaultId, - mappings.head, - additionalProperties, - rootNode = false, - root) + generateNodeId( + node, + nodeMap, + path, + defaultId, + mappings.head, + additionalProperties, + rootNode = false, + root + ) node.withId(finalId) var instanceTypes: Seq[String] = Nil mappings.foreach { mapping => @@ -137,21 +107,23 @@ object ObjectUnionParser { } node.withInstanceTypes(instanceTypes ++ Seq(mappings.head.id)) discriminatorAnnotation(discriminatorName, nodeMap).foreach(node.add) - checkNodeForAdditionalKeys(finalId, - mappings.head.id, - nodeMap.map, - mappings.head, - nodeMap, - rootNode = false, - discriminatorName) + checkNodeForAdditionalKeys( + finalId, + mappings.head.id, + nodeMap.map, + mappings.head, + nodeMap, + rootNode = false, + discriminatorName + ) node } else { ctx.eh.violation( - DialectAmbiguousRangeSpecification, - defaultId, - None, // Some(property.nodePropertyMapping().value()), - s"Ambiguous node, please provide a type disambiguator. Nodes ${mappings.map(_.id).mkString(",")} have been found compatible, only one is allowed", - rootMap.location + DialectAmbiguousRangeSpecification, + defaultId, + None, // Some(property.nodePropertyMapping().value()), + s"Ambiguous node, please provide a type disambiguator. Nodes ${mappings.map(_.id).mkString(",")} have been found compatible, only one is allowed", + rootMap.location ) DialectDomainElement(annotations) .withId(defaultId) @@ -163,54 +135,124 @@ object ObjectUnionParser { case _ => ctx.eh.violation(InvalidUnionType, defaultId, "Cannot parse AST for union node mapping", ast.location) - DialectDomainElement().withId(defaultId) + DialectDomainElement(Annotations(ast) += FromUnionRangeMapping(allPossibleMappings.map(_.id))) + .withId(defaultId) + } + } + + private def findDiscriminatorMappings[T <: DomainElement]( + unionMapping: NodeWithDiscriminator[_], + defaultId: String, + ast: YPart + )(implicit ctx: DialectInstanceContext): Map[String, NodeMapping] = { + + Option(unionMapping.typeDiscriminator()) match { + case Some(discriminatorValueMapping) => + discriminatorValueMapping.flatMap { case (discriminatorValue, nodeMappingId) => + ctx.dialect.declares.find(_.id == nodeMappingId) match { + case Some(nodeMapping: NodeMapping) => Some(discriminatorValue -> nodeMapping) + case _ => + ctx.eh.violation( + DialectError, + defaultId, + s"Cannot find mapping for property $nodeMappingId in discriminator value '$discriminatorValue' in union", + ast.location + ) + None + } + } + case None => + Map.empty + } + } + + private def findUnionMembers[T <: DomainElement]( + defaultId: String, + unionMapping: NodeWithDiscriminator[_], + ast: YPart + )(implicit ctx: DialectInstanceContext) = { + unionMapping.objectRange().flatMap { memberId => + ctx.dialect.declares.find(_.id == memberId.value()) match { + case Some(nodeMapping: NodeMapping) => Some(nodeMapping) + case _ => + ctx.eh + .violation( + DialectError, + defaultId, + s"Cannot find mapping for property ${unionMapping.id} in union", + ast.location + ) + None + } } } def findCompatibleMapping( id: String, unionMappings: Seq[NodeMapping], - discriminatorMapping: Map[String, NodeMapping], + discriminatorsMapping: Map[String, NodeMapping], discriminator: Option[String], nodeMap: YMap, - additionalProperties: Seq[String])(implicit ctx: DialectInstanceContext): Seq[NodeMapping] = { + additionalProperties: Seq[String] + )(implicit ctx: DialectInstanceContext): Seq[NodeMapping] = { discriminator match { // Using explicit discriminator case Some(propertyName) => - val explicitMapping = nodeMap.entries.find(_.key.as[YScalar].text == propertyName).flatMap { entry => - discriminatorMapping.get(entry.value.as[YScalar].text) - } + val explicitMapping = findExplicitMapping(nodeMap, propertyName, discriminatorsMapping) explicitMapping match { case Some(nodeMapping) => Seq(nodeMapping) case None => - ctx.eh.violation(DialectError, - id, - s"Cannot find discriminator value for discriminator '$propertyName'", - nodeMap.location) + ctx.eh.violation( + DialectError, + id, + s"Cannot find discriminator value for discriminator '$propertyName'", + nodeMap.location + ) Nil } // Inferring based on properties case None => - val properties: Set[String] = nodeMap.entries.map(_.key.as[YScalar].text).toSet + val properties: Set[String] = keys(nodeMap).filter(isRegularKey) unionMappings.filter { mapping => val baseProperties = mapping.propertiesMapping().filter(pm => !additionalProperties.contains(pm.nodePropertyMapping().value())) - val mappingRequiredSet: Set[String] = baseProperties - .filter(_.minCount().value() > 0) - .map(_.name().value()) - .toSet + val mappingRequiredSet: Set[String] = requiredProperties(baseProperties) val mappingSet: Set[String] = baseProperties .map(_.name().value()) .toSet // There are not additional properties in the set and all required properties are in the set - properties.diff(mappingSet).isEmpty && mappingRequiredSet.diff(properties).isEmpty + val canParseAllProperties = properties.diff(mappingSet).isEmpty + val hasAllRequiredProperties = mappingRequiredSet.diff(properties).isEmpty + canParseAllProperties && hasAllRequiredProperties } } } - private def discriminatorAnnotation(discriminatorName: Option[String], nodeMap: YMap)( - implicit ctx: DialectInstanceContext): Option[Annotation] = { + private def findExplicitMapping( + nodeMap: YMap, + propertyName: String, + discriminatorsMapping: Map[String, NodeMapping] + ) = { + nodeMap.entries.find(_.key.as[YScalar].text == propertyName).flatMap { entry => + discriminatorsMapping.get(entry.value.as[YScalar].text) + } + } + + private def requiredProperties(baseProperties: Seq[PropertyMapping]) = { + baseProperties + .filter(_.minCount().value() > 0) + .map(_.name().value()) + .toSet + } + + private def keys(nodeMap: YMap) = nodeMap.entries.map(_.key.as[YScalar].text).toSet + + private def isRegularKey = (x: String) => !x.startsWith("$") + + private def discriminatorAnnotation(discriminatorName: Option[String], nodeMap: YMap)(implicit + ctx: DialectInstanceContext + ): Option[Annotation] = { discriminatorName.flatMap { propertyName => nodeMap.entries.find(_.key.as[YScalar].text == propertyName).map { entry => DiscriminatorField(propertyName, entry.value.as[YScalar].text) @@ -218,23 +260,27 @@ object ObjectUnionParser { } } - protected def resolveLinkUnion(ast: YNode, allPossibleMappings: Seq[NodeMapping], id: String, root: YMap)( - implicit ctx: DialectInstanceContext): DialectDomainElement = { + protected def resolveLinkUnion(ast: YNode, allPossibleMappings: Seq[NodeMapping], id: String, root: YMap)(implicit + ctx: DialectInstanceContext + ): DialectDomainElement = { IncludeFirstUnionElementFinder.find(ast, allPossibleMappings, id, root) } - protected def resolveJSONPointerUnion(map: YMap, allPossibleMappings: Seq[NodeMapping], id: String)( - implicit ctx: DialectInstanceContext): DialectDomainElement = { + protected def resolveJSONPointerUnion(map: YMap, allPossibleMappings: Seq[NodeMapping], id: String)(implicit + ctx: DialectInstanceContext + ): DialectDomainElement = { JSONPointerUnionFinder.find(map, allPossibleMappings, id, map) } - private def checkNodeForAdditionalKeys(id: String, - nodetype: String, - entries: Map[YNode, YNode], - mapping: NodeMapping, - ast: YPart, - rootNode: Boolean, - additionalKey: Option[String])(implicit ctx: DialectInstanceContext): Unit = { + private def checkNodeForAdditionalKeys( + id: String, + nodetype: String, + entries: Map[YNode, YNode], + mapping: NodeMapping, + ast: YPart, + rootNode: Boolean, + additionalKey: Option[String] + )(implicit ctx: DialectInstanceContext): Unit = { checkNode(id, nodetype, entries, mapping, ast, rootNode, additionalKey) } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/RefNodeParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/RefNodeParser.scala index 5721c0d1..ced83943 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/RefNodeParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/RefNodeParser.scala @@ -8,8 +8,9 @@ import org.yaml.model.YMap object RefNodeParser extends NodeMappableHelper { - def parse(defaultId: String, astMap: YMap, mappable: NodeMappable, root: Root)( - implicit ctx: DialectInstanceContext) = { + def parse(defaultId: String, astMap: YMap, mappable: NodeMappable, root: Root)(implicit + ctx: DialectInstanceContext + ) = { val ref = JsonPointerResolver.resolveJSONPointer(astMap, mappable, defaultId, root) ref.annotations += JsonPointerRef() mappable match { diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/applicable/AndFinderPath.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/applicable/AndFinderPath.scala new file mode 100644 index 00000000..83dad46c --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/applicable/AndFinderPath.scala @@ -0,0 +1,19 @@ +package amf.aml.internal.parse.instances.parser.applicable + +import amf.aml.client.scala.model.domain.AnyMapping +import amf.aml.internal.parse.instances.DialectInstanceContext +import ApplicableMapping.aggregate +import amf.aml.internal.render.emitters.instances.DialectIndex +import amf.core.internal.parser.Root +import org.yaml.model.YMap + +object AndFinderPath extends FinderPath { + override def walk(mapping: AnyMapping, map: YMap, index: DialectIndex, finder: ApplicableMappingFinder)(implicit + ctx: DialectInstanceContext + ): ApplicableMapping = { + if (mapping.and.isEmpty) return ApplicableMapping.empty + val andMappings = findMappingsFor(mapping.and, index) + val aggregateMapping = aggregate(andMappings.map(node => finder.find(map, node, index))) + aggregateMapping + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/applicable/ApplicableMappingFinder.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/applicable/ApplicableMappingFinder.scala new file mode 100644 index 00000000..9fc49304 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/applicable/ApplicableMappingFinder.scala @@ -0,0 +1,58 @@ +package amf.aml.internal.parse.instances.parser.applicable + +import amf.aml.client.scala.model.domain.{AnyMapping, NodeMapping} +import amf.aml.internal.parse.instances.DialectInstanceContext +import NodePropertyConforms.conformsAgainstProperties +import amf.aml.internal.render.emitters.instances.{DefaultNodeMappableFinder, DialectIndex} +import amf.core.internal.parser.Root +import org.yaml.model.YMap + +import scala.language.higherKinds + +case class ApplicableMappingFinder(private val root: Root) { + + val paths = List( + AndFinderPath, + OrFinderPath(root), + IfThenElseFinderPath(root) + ) + + def find(map: YMap, mapping: AnyMapping)(implicit ctx: DialectInstanceContext): Option[NodeMapping] = { + val index = DialectIndex(ctx.dialect, DefaultNodeMappableFinder(ctx.dialect)) + val ApplicableMapping(_, ids) = find(map, mapping, index) + val isMappingCombination = ids.size != 1 + if (isMappingCombination) index.findCompositeMapping(ids).collect { case mapping: NodeMapping => mapping } + else + index.maybeFindNodeMappingById(ids.head).collect { case (_, mapping: NodeMapping) => + mapping + } + + } + + private[parser] def find(map: YMap, mapping: AnyMapping, index: DialectIndex)(implicit + ctx: DialectInstanceContext + ): ApplicableMapping = { + val appliesToCurrent = + if (conformsAgainstProperties(map, mapping, root)) ApplicableMapping(couldFind = true, Set(mapping.id)) + else ApplicableMapping(couldFind = true, Set.empty[String]) + paths.foldLeft(appliesToCurrent) { (applicable, path) => + applicable.add(path.walk(mapping, map, index, this)) + } + } +} + +object ApplicableMapping { + val invalid: ApplicableMapping = ApplicableMapping(couldFind = false, Set.empty) + val empty: ApplicableMapping = ApplicableMapping(couldFind = true, Set.empty) + + def aggregate(mappings: Seq[ApplicableMapping]): ApplicableMapping = { + mappings.foldLeft(empty) { (acc, curr) => + acc.add(curr) + } + } +} + +case class ApplicableMapping(couldFind: Boolean, mappings: Set[String]) { + def add(applicable: ApplicableMapping): ApplicableMapping = + copy(couldFind = this.couldFind && applicable.couldFind, this.mappings ++ applicable.mappings) +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/applicable/FinderPath.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/applicable/FinderPath.scala new file mode 100644 index 00000000..d3353697 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/applicable/FinderPath.scala @@ -0,0 +1,29 @@ +package amf.aml.internal.parse.instances.parser.applicable + +import amf.aml.client.scala.model.domain.AnyMapping +import amf.aml.internal.parse.instances.DialectInstanceContext +import amf.aml.internal.render.emitters.instances.DialectIndex +import amf.core.client.scala.model.StrField +import amf.core.internal.parser.Root +import org.yaml.model.YMap + +trait FinderPath { + + def walk(mapping: AnyMapping, map: YMap, index: DialectIndex, finder: ApplicableMappingFinder)(implicit + ctx: DialectInstanceContext + ): ApplicableMapping + + protected def findMappingsFor(ids: Seq[StrField], index: DialectIndex)(implicit + ctx: DialectInstanceContext + ): Seq[AnyMapping] = { + val mappings = ids + .flatMap(_.option()) + .flatMap(index.maybeFindNodeMappingById) + .collect { case (_, mapping: AnyMapping) => mapping } + val foundAllMappings = mappings.size == ids.size + if (!foundAllMappings) { + // TODO: throw error if for a component, there aren't any suitable mappings + } + mappings + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/applicable/IfThenElseFinderPath.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/applicable/IfThenElseFinderPath.scala new file mode 100644 index 00000000..061fa4c4 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/applicable/IfThenElseFinderPath.scala @@ -0,0 +1,26 @@ +package amf.aml.internal.parse.instances.parser.applicable + +import amf.aml.client.scala.model.domain.AnyMapping +import amf.aml.internal.parse.instances.DialectInstanceContext +import NodePropertyConforms.conformsAgainstProperties +import amf.aml.internal.render.emitters.instances.DialectIndex +import amf.core.internal.parser.Root +import org.yaml.model.YMap + +case class IfThenElseFinderPath(root: Root) extends FinderPath { + override def walk(mapping: AnyMapping, map: YMap, index: DialectIndex, finder: ApplicableMappingFinder)(implicit + ctx: DialectInstanceContext + ): ApplicableMapping = { + mapping.ifMapping.option() match { + case Some(id) => + val ifMapping = index.maybeFindNodeMappingById(id).collect { case (_, mapping: AnyMapping) => mapping }.get + val conformsWithIf = conformsAgainstProperties(map, ifMapping, root) + val nextApplicable = + if (conformsWithIf) mapping.thenMapping.option().toSet else mapping.elseMapping.option().toSet + ApplicableMapping(couldFind = true, nextApplicable) + case None => + // TODO: add error + ApplicableMapping.empty + } + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/applicable/NodePropertyConforms.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/applicable/NodePropertyConforms.scala new file mode 100644 index 00000000..91bd615d --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/applicable/NodePropertyConforms.scala @@ -0,0 +1,45 @@ +package amf.aml.internal.parse.instances.parser.applicable + +import amf.aml.client.scala.model.domain.{AnyMapping, NodeMapping} +import amf.aml.internal.parse.instances.DialectInstanceContext +import amf.aml.internal.parse.instances.parser.{AmlSubGraphCollector, InstanceElementParser} +import amf.core.client.common.validation.AMFStyle +import amf.core.client.scala.errorhandling.DefaultErrorHandler +import amf.core.client.scala.validation.AMFValidationResult +import amf.core.internal.parser.Root +import amf.validation.internal.shacl.custom.CustomShaclValidator +import org.yaml.model.YMap + +object NodePropertyConforms { + def conformsAgainstProperties(map: YMap, mapping: AnyMapping, root: Root)(implicit + ctx: DialectInstanceContext + ): Boolean = { + mapping match { + case nodeMapping: NodeMapping if nodeMapping.propertiesMapping().nonEmpty => + parseAndValidate(map, nodeMapping, root) + case _ => false + } + } + + private def parseAndValidate(map: YMap, mapping: NodeMapping, root: Root)(implicit + ctx: DialectInstanceContext + ): Boolean = { + val nextContext = ctx.copy(DefaultErrorHandler()) + val element = + InstanceElementParser(root).parse("", mapping.id, map, mapping, Map.empty, parseAllOf = false)(nextContext) + val conforms = ignoreClosedShapeErrors(nextContext.eh.getResults).isEmpty + if (!conforms) return false + val mappingsInTree = AmlSubGraphCollector.collect(mapping.id, ctx.dialect) + val validator = new CustomShaclValidator(Map.empty, AMFStyle) + val validations = ctx.constraints + .map(p => p.validations.filter(x => x.targetClass.intersect(mappingsInTree).nonEmpty)) + .getOrElse(Nil) + .toList + val report = validator.validate(element, validations) + report.conforms + } + + private def ignoreClosedShapeErrors(results: Seq[AMFValidationResult]): Seq[AMFValidationResult] = { + results.filterNot(_.validationId.contains("closed")) + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/applicable/OrFinderPath.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/applicable/OrFinderPath.scala new file mode 100644 index 00000000..a618b764 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/instances/parser/applicable/OrFinderPath.scala @@ -0,0 +1,38 @@ +package amf.aml.internal.parse.instances.parser.applicable + +import amf.aml.client.scala.model.domain.AnyMapping +import amf.aml.internal.parse.instances.DialectInstanceContext +import ApplicableMapping.invalid +import NodePropertyConforms.conformsAgainstProperties +import amf.aml.internal.render.emitters.instances.DialectIndex +import amf.core.internal.parser.Root +import org.yaml.model.YMap + +case class OrFinderPath(root: Root) extends FinderPath { + + override def walk(mapping: AnyMapping, map: YMap, index: DialectIndex, finder: ApplicableMappingFinder)(implicit + ctx: DialectInstanceContext + ): ApplicableMapping = { + if (mapping.or.isEmpty) return ApplicableMapping.empty + val orMappings = findMappingsFor(mapping.or, index) + val applicableList = orMappings.map { mapping => + findMatches(map, index, mapping, finder) + } + val onlyOneMappingConforms = applicableList.count(_.couldFind) == 1 + if (!onlyOneMappingConforms) { + // TODO: throw error + } + applicableList.find(_.couldFind).getOrElse(invalid) + } + + protected def findMatches(map: YMap, index: DialectIndex, orMap: AnyMapping, finder: ApplicableMappingFinder)(implicit + ctx: DialectInstanceContext + ): ApplicableMapping = { + val applies = conformsAgainstProperties(map, orMap, root) + if (!applies) ApplicableMapping(couldFind = false, Set.empty[String]) + else { + val nested = finder.find(map, orMap, index) + nested + } + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/plugin/AMLDialectInstanceParsingPlugin.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/plugin/AMLDialectInstanceParsingPlugin.scala index 2d8554c8..926ce674 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/plugin/AMLDialectInstanceParsingPlugin.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/plugin/AMLDialectInstanceParsingPlugin.scala @@ -3,26 +3,25 @@ package amf.aml.internal.parse.plugin import amf.aml.client.scala.model.document.{Dialect, DialectInstance, kind} import amf.aml.internal.AMLDialectInstancePlugin import amf.aml.internal.parse.common.SyntaxExtensionsReferenceHandler -import amf.aml.internal.parse.headers.DialectHeader +import amf.aml.internal.parse.hints.{DialectInstanceGuess, Guess} import amf.aml.internal.parse.instances._ import amf.aml.internal.render.emitters.instances.DefaultNodeMappableFinder import amf.core.client.common.{NormalPriority, PluginPriority} import amf.core.client.scala.errorhandling.AMFErrorHandler import amf.core.client.scala.model.document.BaseUnit import amf.core.client.scala.parse.AMFParsePlugin -import amf.core.client.scala.parse.document.{ParserContext, ReferenceHandler, SyamlParsedDocument} -import amf.core.internal.parser._ -import amf.core.internal.remote.Mimes._ +import amf.core.client.scala.parse.document.{ParserContext, ReferenceHandler} import amf.core.internal.parser._ import amf.core.internal.remote.Mimes._ import amf.core.internal.remote.{AmlDialectSpec, Mimes, Spec} -import org.yaml.model.YMap +import amf.core.internal.validation.core.ValidationProfile +import org.mulesoft.common.core.Strings -/** - * Parsing plugin for dialect instance like units derived from a resolved dialect - * @param dialect resolved dialect +/** Parsing plugin for dialect instance like units derived from a resolved dialect + * @param dialect + * resolved dialect */ -class AMLDialectInstanceParsingPlugin(val dialect: Dialect) +class AMLDialectInstanceParsingPlugin(val dialect: Dialect, val constraints: Option[ValidationProfile] = None) extends AMFParsePlugin with AMLDialectInstancePlugin[Root] { @@ -30,19 +29,35 @@ class AMLDialectInstanceParsingPlugin(val dialect: Dialect) override def priority: PluginPriority = NormalPriority - override def parse(document: Root, ctx: ParserContext): BaseUnit = { + protected def guess: Guess[kind.DialectInstanceDocumentKind] = DialectInstanceGuess(dialect) + + override def parse(root: Root, ctx: ParserContext): BaseUnit = { val finder = DefaultNodeMappableFinder(ctx) - val maybeUnit = documentKindFor(document) map { + val maybeUnit = guess.from(root) map { case kind.DialectInstanceFragment => - val name = DialectHeader.root(document).get // Should always be defined - new DialectInstanceFragmentParser(document)(new DialectInstanceContext(dialect, finder, ctx)).parse(name) + /** Extract a name form the hint. Examples: #%Library / Dialect 1.0 -> Library #%My Fragment / My Test Dialect + * 1.0 -> My Fragment + */ + val name = { + val hint = guess.hint(root).get // Should always be defined + val normalizedStr = hint.stripPrefix("%").stripSpaces + normalizedStr.substring(0, normalizedStr.indexOf("/")) + } + new DialectInstanceFragmentParser(root)( + new DialectInstanceContext(dialect, finder, ctx, constraints = constraints) + ).parse(name) case kind.DialectInstanceLibrary => - new DialectInstanceLibraryParser(document)(new DialectInstanceContext(dialect, finder, ctx)).parse() + new DialectInstanceLibraryParser(root)( + new DialectInstanceContext(dialect, finder, ctx, constraints = constraints) + ).parse() case kind.DialectInstancePatch => - new DialectInstancePatchParser(document)(new DialectInstanceContext(dialect, finder, ctx).forPatch()) + new DialectInstancePatchParser(root)( + new DialectInstanceContext(dialect, finder, ctx, constraints = constraints).forPatch() + ) .parse() case kind.DialectInstance => - new DialectInstanceParser(document)(new DialectInstanceContext(dialect, finder, ctx)).parseDocument() + new DialectInstanceParser(root)(new DialectInstanceContext(dialect, finder, ctx, constraints = constraints)) + .parseDocument() case _ => DialectInstance() } @@ -55,60 +70,15 @@ class AMLDialectInstanceParsingPlugin(val dialect: Dialect) override def allowRecursiveReferences: Boolean = true - override def applies(root: Root): Boolean = documentKindFor(root).isDefined - - private def documentKindFor(root: Root): Option[kind.DialectInstanceDocumentKind] = { - if (dialect.usesKeyPropertyMatching) { - matchByKeyProperty(root) - } else { - matchByHeader(root) - } - } - - private def matchByHeader(root: Root): Option[kind.DialectInstanceDocumentKind] = { - for { - header <- DialectHeader(root) - kind <- { - header.split("\\|") match { - case Array(header, dialectUri) => - matchByHeaderForInlineDialect(header, dialectUri) - case _ => - dialect.documentKindFor(header) - } - } - } yield { - kind - } - } - - private def matchByHeaderForInlineDialect(header: String, dialectUri: String) = { - if (dialectUri.stripPrefix("<").stripSuffix(">") == dialect.id) { - dialect.documentKindFor(header) - } else { - None - } - } - - private def matchByKeyProperty(root: Root): Option[kind.DialectInstanceDocumentKind] = { - val name = dialect.name().value() - val version = dialect.version().value() - root.parsed match { - case SyamlParsedDocument(document, _) if document.toOption[YMap].exists(_.hasEntry(name, version)) => - Some(kind.DialectInstance) // We can only define dialect instances (not fragments, etc.) with key properties - case _ => - None - } - } + override def applies(root: Root): Boolean = guess.from(root).isDefined - /** - * media types which specifies vendors that are parsed by this plugin. + /** media types which specifies vendors that are parsed by this plugin. */ override def mediaTypes: Seq[String] = Seq(Mimes.`application/yaml`, `application/json`) override def spec: Spec = AmlDialectSpec(dialect.nameAndVersion()) - /** - * media types which specifies vendors that may be referenced. + /** media types which specifies vendors that may be referenced. */ override def validSpecsToReference: Seq[Spec] = Nil diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/plugin/AMLDialectParsingPlugin.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/plugin/AMLDialectParsingPlugin.scala index 863ec88e..e199cbe7 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/plugin/AMLDialectParsingPlugin.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/plugin/AMLDialectParsingPlugin.scala @@ -1,8 +1,9 @@ package amf.aml.internal.parse.plugin +import amf.aml.client.scala.model.document.kind import amf.aml.internal.parse.common.SyntaxExtensionsReferenceHandler import amf.aml.internal.parse.dialects.{DialectContext, DialectsParser} -import amf.aml.internal.parse.headers.{DialectHeader, ExtensionHeader} +import amf.aml.internal.parse.hints.DialectGuess import amf.aml.internal.parse.plugin.error.CannotParseDocumentException import amf.core.client.common.{NormalPriority, PluginPriority} import amf.core.client.scala.errorhandling.AMFErrorHandler @@ -17,23 +18,16 @@ class AMLDialectParsingPlugin extends AMFParsePlugin { override def spec: Spec = Spec.AML - val knownHeaders = - IndexedSeq(ExtensionHeader.DialectHeader, - ExtensionHeader.DialectFragmentHeader, - ExtensionHeader.DialectLibraryHeader) + override def parse(root: Root, ctx: ParserContext): BaseUnit = { - override def parse(document: Root, ctx: ParserContext): BaseUnit = { - val header = DialectHeader(document) - - header match { - case Some(ExtensionHeader.DialectLibraryHeader) => - new DialectsParser(document)(cleanDialectContext(ctx, document)).parseLibrary() - case Some(ExtensionHeader.DialectFragmentHeader) => - new DialectsParser(document)(new DialectContext(ctx)).parseFragment() - case Some(ExtensionHeader.DialectHeader) => - parseDialect(document, cleanDialectContext(ctx, document)) - case Some(header) => throw CannotParseDocumentException(s"Header $header is not a valid AML Dialect header") - case _ => throw CannotParseDocumentException("Missing header for AML Dialect") + DialectGuess.from(root) match { + case Some(kind.DialectLibrary) => + new DialectsParser(root)(cleanDialectContext(ctx, root)).parseLibrary() + case Some(kind.DialectFragment) => + new DialectsParser(root)(new DialectContext(ctx)).parseFragment() + case Some(kind.Dialect) => + parseDialect(root, cleanDialectContext(ctx, root)) + case _ => throw CannotParseDocumentException("Cannot parse document as an AML Dialect") } } @@ -53,22 +47,15 @@ class AMLDialectParsingPlugin extends AMFParsePlugin { override val id: String = "dialect-parsing-plugin" - override def applies(root: Root): Boolean = { - DialectHeader(root) match { - case Some(header) => knownHeaders.contains(header) - case _ => false - } - } + override def applies(root: Root): Boolean = DialectGuess.from(root).isDefined override def priority: PluginPriority = NormalPriority - /** - * media types which specifies vendors that are parsed by this plugin. + /** media types which specifies vendors that are parsed by this plugin. */ override def mediaTypes: Seq[String] = Seq(`application/yaml`) - /** - * media types which specifies vendors that may be referenced. + /** media types which specifies vendors that may be referenced. */ override def validSpecsToReference: Seq[Spec] = Seq(Spec.AML) diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/plugin/AMLVocabularyParsingPlugin.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/plugin/AMLVocabularyParsingPlugin.scala index 4da2e2a0..38094b8b 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/plugin/AMLVocabularyParsingPlugin.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/plugin/AMLVocabularyParsingPlugin.scala @@ -1,7 +1,8 @@ package amf.aml.internal.parse.plugin +import amf.aml.client.scala.model.document.kind import amf.aml.internal.parse.common.SyntaxExtensionsReferenceHandler -import amf.aml.internal.parse.headers.{DialectHeader, ExtensionHeader} +import amf.aml.internal.parse.hints.VocabularyGuess import amf.aml.internal.parse.plugin.error.CannotParseDocumentException import amf.aml.internal.parse.vocabularies.{VocabulariesParser, VocabularyContext} import amf.core.client.common.{NormalPriority, PluginPriority} @@ -17,14 +18,12 @@ class AMLVocabularyParsingPlugin extends AMFParsePlugin { override def spec: Spec = Spec.AML - override def parse(document: Root, ctx: ParserContext): BaseUnit = { - val header = DialectHeader(document) + override def parse(root: Root, ctx: ParserContext): BaseUnit = { - header match { - case Some(ExtensionHeader.VocabularyHeader) => - new VocabulariesParser(document)(new VocabularyContext(ctx)).parseDocument() - case Some(header) => throw CannotParseDocumentException(s"Header $header is not a valid AML Vocabulary header") - case _ => throw CannotParseDocumentException("Missing header for AML Vocabulary") + VocabularyGuess.from(root) match { + case Some(kind.Vocabulary) => + new VocabulariesParser(root)(new VocabularyContext(ctx)).parseDocument() + case _ => throw CannotParseDocumentException("Cannot parse document as an AML Vocabulary") } } @@ -35,22 +34,15 @@ class AMLVocabularyParsingPlugin extends AMFParsePlugin { override val id: String = "vocabulary-parsing-plugin" - override def applies(root: Root): Boolean = { - DialectHeader(root) match { - case Some(ExtensionHeader.VocabularyHeader) => true - case _ => false - } - } + override def applies(root: Root): Boolean = VocabularyGuess.from(root).isDefined override def priority: PluginPriority = NormalPriority - /** - * media types which specifies vendors that are parsed by this plugin. + /** media types which specifies vendors that are parsed by this plugin. */ - override def mediaTypes: Seq[String] = Seq(`application/yaml`) + override def mediaTypes: Seq[String] = Seq(`application/yaml`, `application/json`) - /** - * media types which specifies vendors that may be referenced. + /** media types which specifies vendors that may be referenced. */ override def validSpecsToReference: scala.Seq[Spec] = Seq(Spec.AML) diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/ClassTermParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/ClassTermParser.scala new file mode 100644 index 00000000..667ea224 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/ClassTermParser.scala @@ -0,0 +1,96 @@ +package amf.aml.internal.parse.vocabularies + +import amf.aml.client.scala.model.document.Vocabulary +import amf.aml.client.scala.model.domain.ClassTerm +import amf.aml.internal.metamodel.domain.ClassTermModel +import amf.aml.internal.parse.dialects.DialectAstOps.DialectYMapOps +import amf.core.client.scala.model.domain.{AmfArray, AmfScalar} +import amf.core.internal.parser.domain.{Annotations, ValueNode} +import org.yaml.model.{YMap, YMapEntry, YScalar, YType} + +case class ClassTermParser()(implicit val ctx: VocabularyContext) + extends SingleOrMultipleItems + with IriReferenceParsing { + + def parse(entry: YMapEntry, vocabulary: Vocabulary): ClassTerm = { + val classTerm = ClassTerm(Annotations(entry)) + val classTermAlias = entry.key.as[YScalar].text + classTerm.withName(classTermAlias) + + ctx.resolveClassTermAlias(vocabulary.base.value(), classTermAlias, entry.key, strictLocal = false) match { + case None => ctx.missingClassTermWarning(classTermAlias, vocabulary.id, entry.key) + case Some(id) => classTerm.id = id + } + + entry.value.tagType match { + case YType.Null => + case _ => + val map = entry.value.as[YMap] + ctx.closedNode("classTerm", classTerm.id, map) + parseDisplayName(map, classTerm) + parseDescription(map, classTerm) + parseProperties(map, classTerm, vocabulary) + parseExtends(map, classTerm, vocabulary) // just declaration + } + + ctx.register(classTermAlias, classTerm) + classTerm + } + + private def parseExtends(classTermMap: YMap, classTerm: ClassTerm, vocabulary: Vocabulary)(implicit + ctx: VocabularyContext + ) = { + classTermMap.key( + "extends", + entry => { + val terms = singleOrMultipleItemsAsString(entry) + val superClasses = parseIriAlias( + terms, + term => ctx.resolveClassTermAlias(vocabulary.base.value(), term, entry.value, strictLocal = true), + term => ctx.missingClassTermWarning(term, classTerm.id, entry.value) + ) + + classTerm.set(ClassTermModel.SubClassOf, AmfArray(superClasses, Annotations(entry.value)), Annotations(entry)) + } + ) + } + + private def parseProperties(classTermMap: YMap, classTerm: ClassTerm, vocabulary: Vocabulary)(implicit + ctx: VocabularyContext + ) = { + classTermMap.key( + "properties", + entry => { + val terms = singleOrMultipleItemsAsString(entry) + val properties = parseIriAlias( + terms, + term => ctx.resolvePropertyTermAlias(vocabulary.base.value(), term, entry.value, strictLocal = true), + term => ctx.missingPropertyTermWarning(term, classTerm.id, entry.value) + ) + + if (properties.nonEmpty) + classTerm.set(ClassTermModel.Properties, AmfArray(properties, Annotations(entry.value)), Annotations(entry)) + } + ) + } + + private def parseDescription(classTermMap: YMap, classTerm: ClassTerm) = { + classTermMap.key( + "description", + entry => { + val value = ValueNode(entry.value) + classTerm.set(ClassTermModel.Description, value.string()) + } + ) + } + + private def parseDisplayName(classTermMap: YMap, classTerm: ClassTerm) = { + classTermMap.key( + "displayName", + entry => { + val value = ValueNode(entry.value) + classTerm.set(ClassTermModel.DisplayName, value.string()) + } + ) + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/IriReferenceParsing.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/IriReferenceParsing.scala new file mode 100644 index 00000000..91222490 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/IriReferenceParsing.scala @@ -0,0 +1,23 @@ +package amf.aml.internal.parse.vocabularies + +import amf.core.client.scala.model.domain.AmfScalar +import amf.core.internal.parser.domain.Annotations +import org.yaml.model.YPart + +trait IriReferenceParsing { + + protected def parseIriAlias( + iris: Seq[String], + computeAliasedTerm: String => Option[String], + onError: String => Unit + ) = { + iris.flatMap { term => + computeAliasedTerm(term) match { + case Some(v) => Some(AmfScalar(v, Annotations.synthesized())) + case None => + onError(term) + None + } + } + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/PropertyTermParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/PropertyTermParser.scala new file mode 100644 index 00000000..42432f5f --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/PropertyTermParser.scala @@ -0,0 +1,127 @@ +package amf.aml.internal.parse.vocabularies + +import amf.aml.client.scala.model.document.Vocabulary +import amf.aml.client.scala.model.domain.{ClassTerm, DatatypePropertyTerm, ObjectPropertyTerm, PropertyTerm} +import amf.aml.internal.metamodel.domain.{ClassTermModel, DatatypePropertyTermModel, ObjectPropertyTermModel} +import amf.aml.internal.parse.dialects.DialectAstOps.DialectYMapOps +import amf.core.client.scala.model.DataType +import amf.core.client.scala.model.domain.{AmfArray, AmfScalar} +import amf.core.client.scala.vocabulary.Namespace +import amf.core.internal.parser.domain.{Annotations, DefaultArrayNode, ValueNode} +import org.yaml.model.{YMap, YMapEntry, YScalar, YType} + +case class PropertyTermParser()(implicit val ctx: VocabularyContext) + extends SingleOrMultipleItems + with IriReferenceParsing { + + def parse(entry: YMapEntry, vocabulary: Vocabulary): PropertyTerm = { + val propertyTerm = createPropertyTerm(entry) + val propertyTermAlias = entry.key.as[YScalar].text + propertyTerm.withName(propertyTermAlias) + + ctx.resolvePropertyTermAlias(vocabulary.base.value(), propertyTermAlias, entry.key, strictLocal = false) match { + case None => ctx.missingPropertyTermWarning(propertyTermAlias, vocabulary.id, entry.key) + case Some(id) => propertyTerm.id = id + } + + entry.value.tagType match { + case YType.Null => // ignore + case _ => + val map = entry.value.as[YMap] + ctx.closedNode("propertyTerm", propertyTerm.id, map) + parseDisplayName(map, propertyTerm) + parseDescription(map, propertyTerm) + parseRange(map, propertyTerm, vocabulary) + parseExtends(map, propertyTerm, vocabulary) + } + + ctx.register(propertyTermAlias, propertyTerm) + propertyTerm + } + + private def parseExtends(map: YMap, propertyTerm: PropertyTerm, vocabulary: Vocabulary)(implicit + ctx: VocabularyContext + ) = { + map.key( + "extends", + entry => { + val refs = singleOrMultipleItemsAsString(entry) + val superClasses = parseIriAlias( + refs, + term => ctx.resolvePropertyTermAlias(vocabulary.base.value(), term, entry.value, strictLocal = true), + term => ctx.missingPropertyTermWarning(term, propertyTerm.id, entry.value) + ) + propertyTerm.set( + ObjectPropertyTermModel.SubPropertyOf, + AmfArray(superClasses, Annotations(entry.value)), + Annotations(entry) + ) + } + ) + } + + private def parseRange(map: YMap, propertyTerm: PropertyTerm, vocabulary: Vocabulary)(implicit + ctx: VocabularyContext + ) = { + map.key( + "range", + entry => { + val text = entry.value.as[YScalar].text + val rangeId = text match { + case "guid" => + Some(AmfScalar((Namespace.Shapes + "guid").iri(), Annotations(entry.value))) + case "any" | "uri" | "string" | "integer" | "float" | "double" | "long" | "boolean" | "time" | "date" | + "dateTime" => + Some(AmfScalar(DataType(text), Annotations(entry.value))) + case classAlias => + ctx.resolveClassTermAlias(vocabulary.base.value(), classAlias, entry.value, strictLocal = true) match { + case Some(classTermId) => Some(AmfScalar(classTermId, Annotations.synthesized())) + case None => + ctx.missingClassTermWarning(classAlias, propertyTerm.id, entry.value) + None + } + } + + rangeId.foreach(scalar => propertyTerm.set(DatatypePropertyTermModel.Range, scalar, Annotations(entry))) + } + ) + } + + private def parseDescription(map: YMap, propertyTerm: PropertyTerm) = { + map.key( + "description", + entry => { + val value = ValueNode(entry.value) + propertyTerm.set(ClassTermModel.Description, value.string()) + } + ) + } + + private def parseDisplayName(map: YMap, propertyTerm: PropertyTerm) = { + map.key( + "displayName", + entry => { + val value = ValueNode(entry.value) + propertyTerm.set(ClassTermModel.DisplayName, value.string()) + } + ) + } + + private def createPropertyTerm(entry: YMapEntry) = { + val propertyTerm: PropertyTerm = entry.value.tagType match { + case YType.Null => DatatypePropertyTerm(Annotations(entry)) + case _ => + entry.value.as[YMap].key("range") match { + case None => DatatypePropertyTerm(Annotations(entry)) + case Some(value) => + value.value.as[YScalar].text match { + case "string" | "integer" | "float" | "double" | "long" | "boolean" | "uri" | "any" | "time" | "date" | + "dateTime" => + DatatypePropertyTerm(Annotations(entry)) + case _ => ObjectPropertyTerm(Annotations(entry)) + } + } + } + propertyTerm + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/SingleOrMultipleItems.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/SingleOrMultipleItems.scala new file mode 100644 index 00000000..bdcdecb7 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/SingleOrMultipleItems.scala @@ -0,0 +1,18 @@ +package amf.aml.internal.parse.vocabularies + +import amf.core.client.scala.parse.document.SyamlBasedParserErrorHandler +import amf.core.internal.parser.domain.{DefaultArrayNode, ValueNode} +import org.yaml.model.{YMapEntry, YSequence, YType} + +trait SingleOrMultipleItems { + + implicit val ctx: SyamlBasedParserErrorHandler + + protected def singleOrMultipleItemsAsString(entry: YMapEntry) = { + entry.value.tagType match { + case YType.Str => Seq(ValueNode(entry.value).text().toString) + case YType.Seq => entry.value.as[YSequence].nodes.map(_.as[String]) + case YType.Null => Seq.empty + } + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/VocabulariesParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/VocabulariesParser.scala index 03a0f18b..3db32b83 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/VocabulariesParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/VocabulariesParser.scala @@ -28,26 +28,9 @@ class VocabulariesParser(root: Root)(implicit override val ctx: VocabularyContex } def parseDocument(): BaseUnit = { - map.key("vocabulary") match { - case Some(entry) => { - val value = ValueNode(entry.value) - vocabulary.set(VocabularyModel.Name, value.string(), Annotations(entry)) - } - case None => ctx.missingVocabularyTermWarning(vocabulary.id, map) - } - - map.key("base") match { - case Some(entry) => { - val value = ValueNode(entry.value) - vocabulary.set(VocabularyModel.Base, value.string(), Annotations(entry)) - } - case None => ctx.missingBaseTermViolation(vocabulary.id, map) - } - - map.key("usage", entry => { - val value = ValueNode(entry.value) - vocabulary.set(VocabularyModel.Usage, value.string(), Annotations(entry)) - }) + parseName(vocabulary) + parseBase(vocabulary) + parseUsage(vocabulary) // closed node validation ctx.closedNode("vocabulary", vocabulary.id, map) @@ -61,242 +44,83 @@ class VocabulariesParser(root: Root)(implicit override val ctx: VocabularyContex parsePropertyTerms(map) val declarables = ctx.terms() - val imported = ctx.imported map { - case (alias, library) => - VocabularyReference() - .withAlias(alias) - .withReference(library.id) - .withBase(library.base.value()) - .adopted(vocabulary.id) + val imported = ctx.imported map { case (alias, library) => + VocabularyReference() + .withAlias(alias) + .withReference(library.id) + .withBase(library.base.value()) + .adopted(vocabulary.id) } if (imported.nonEmpty) vocabulary.withImports(imported.toSeq) addDeclarationsToModel(vocabulary, declarables) if (references.nonEmpty) vocabulary.withReferences(references.baseUnitReferences()) // we raise exceptions for missing terms - ctx.pendingLocal.foreach { - case (term, alias, location, isProperty) => - if (isProperty) { - ctx.missingPropertyTermWarning(term, vocabulary.id, location) - } else { - ctx.missingClassTermWarning(term, vocabulary.id, location) - } + ctx.pendingLocal.foreach { case (term, alias, location, isProperty) => + if (isProperty) { + ctx.missingPropertyTermWarning(term, vocabulary.id, location) + } else { + ctx.missingClassTermWarning(term, vocabulary.id, location) + } } vocabulary.processingData.withSourceSpec(AML) vocabulary } - def parseClassTerms(map: YMap): Unit = { + private def parseUsage(vocabulary: Vocabulary) = { map.key( - "classTerms", - entry => { - addDeclarationKey(DeclarationKey(entry)) - val classDeclarations = entry.value.as[YMap] - classDeclarations.entries.foreach { classTermDeclaration => - parseClassTerm(classTermDeclaration) - } - } + "usage", + entry => { + val value = ValueNode(entry.value) + vocabulary.set(VocabularyModel.Usage, value.string(), Annotations(entry)) + } ) } - def parseClassTerm(classTermDeclaration: YMapEntry): Unit = { - val classTerm = ClassTerm(Annotations(classTermDeclaration)) - val classTermAlias = classTermDeclaration.key.as[YScalar].text - classTerm.withName(classTermAlias) - - ctx.resolveClassTermAlias(vocabulary.base.value(), classTermAlias, classTermDeclaration.key, strictLocal = false) match { - case None => ctx.missingClassTermWarning(classTermAlias, vocabulary.id, classTermDeclaration.key) - case Some(id) => classTerm.id = id + private def parseBase(vocabulary: Vocabulary) = { + map.key("base") match { + case Some(entry) => { + val value = ValueNode(entry.value) + vocabulary.set(VocabularyModel.Base, value.string(), Annotations(entry)) + } + case None => ctx.missingBaseTermViolation(vocabulary.id, map) } + } - classTermDeclaration.value.tagType match { - case YType.Null => // just declaration - case _ => - val classTermMap = classTermDeclaration.value.as[YMap] - ctx.closedNode("classTerm", classTerm.id, classTermMap) - - classTermMap.key("displayName", entry => { - val value = ValueNode(entry.value) - classTerm.set(ClassTermModel.DisplayName, value.string()) - }) - - classTermMap.key("description", entry => { - val value = ValueNode(entry.value) - classTerm.set(ClassTermModel.Description, value.string()) - }) - - classTermMap.key( - "properties", - entry => { - val refs: Seq[String] = entry.value.tagType match { - case YType.Str => Seq(ValueNode(entry.value).string().toString) - case YType.Seq => - DefaultArrayNode(entry.value).nodes._1 - .map(_.value.toString) // ArrayNode(entry.value).strings().scalars.map(_.toString) - case YType.Null => Seq.empty - } - - val properties: Seq[AmfScalar] = refs - .map { term: String => - ctx.resolvePropertyTermAlias(vocabulary.base.value(), term, entry.value, strictLocal = true) match { - case Some(v) => Some(AmfScalar(v)) - case None => - ctx.missingPropertyTermWarning(term, classTerm.id, entry.value) - None - } - } - .filter(_.nonEmpty) - .map(_.get) - - if (properties.nonEmpty) - classTerm.set(ClassTermModel.Properties, - AmfArray(properties, Annotations(entry.value)), - Annotations(entry)) - } - ) - - classTermMap.key( - "extends", - entry => { - val refs: Seq[String] = entry.value.tagType match { - case YType.Str => Seq(ValueNode(entry.value).string().toString) - case YType.Seq => - // ArrayNode(entry.value).strings().scalars.map(_.toString) - DefaultArrayNode(node = entry.value).nodes._1.map(_.value.toString) - case YType.Null => Seq.empty - } - - val superClasses: Seq[String] = refs - .map { term: String => - ctx.resolveClassTermAlias(vocabulary.base.value(), term, entry.value, strictLocal = true) match { - case Some(v) => Some(v) - case None => - ctx.missingClassTermWarning(term, classTerm.id, entry.value) - None - } - } - .filter(_.nonEmpty) - .map(_.get) - - classTerm.set(ClassTermModel.SubClassOf, superClasses) - } - ) + private def parseName(vocabulary: Vocabulary) = { + map.key("vocabulary") match { + case Some(entry) => { + val value = ValueNode(entry.value) + vocabulary.set(VocabularyModel.Name, value.string(), Annotations(entry)) + } + case None => ctx.missingVocabularyTermWarning(vocabulary.id, map) } - - ctx.register(classTermAlias, classTerm) } - def parsePropertyTerms(map: YMap): Unit = { + private def parseClassTerms(map: YMap): Unit = { map.key( - "propertyTerms", - entry => { - addDeclarationKey(DeclarationKey(entry)) - val classDeclarations = entry.value.as[YMap] - classDeclarations.entries.foreach { propertyTermDeclaration => - parsePropertyTerm(propertyTermDeclaration) - } + "classTerms", + entry => { + addDeclarationKey(DeclarationKey(entry)) + val classDeclarations = entry.value.as[YMap] + classDeclarations.entries.foreach { classTermDeclaration => + ClassTermParser().parse(classTermDeclaration, vocabulary) } + } ) } - def parsePropertyTerm(propertyTermDeclaration: YMapEntry): Unit = { - val propertyTerm: PropertyTerm = propertyTermDeclaration.value.tagType match { - case YType.Null => DatatypePropertyTerm(Annotations(propertyTermDeclaration)) - case _ => - propertyTermDeclaration.value.as[YMap].key("range") match { - case None => DatatypePropertyTerm(Annotations(propertyTermDeclaration)) - case Some(value) => - value.value.as[YScalar].text match { - case "string" | "integer" | "float" | "double" | "long" | "boolean" | "uri" | "any" | "time" | "date" | - "dateTime" => - DatatypePropertyTerm(Annotations(propertyTermDeclaration)) - case _ => ObjectPropertyTerm(Annotations(propertyTermDeclaration)) - } + private def parsePropertyTerms(map: YMap): Unit = { + map.key( + "propertyTerms", + entry => { + addDeclarationKey(DeclarationKey(entry)) + val classDeclarations = entry.value.as[YMap] + classDeclarations.entries.foreach { propertyTermDeclaration => + PropertyTermParser().parse(propertyTermDeclaration, vocabulary) } - } - - val propertyTermAlias = propertyTermDeclaration.key.as[YScalar].text - propertyTerm.withName(propertyTermAlias) - - ctx.resolvePropertyTermAlias(vocabulary.base.value(), - propertyTermAlias, - propertyTermDeclaration.key, - strictLocal = false) match { - case None => ctx.missingPropertyTermWarning(propertyTermAlias, vocabulary.id, propertyTermDeclaration.key) - case Some(id) => propertyTerm.id = id - } - - propertyTermDeclaration.value.tagType match { - case YType.Null => // ignore - case _ => - val propertyTermMap = propertyTermDeclaration.value.as[YMap] - ctx.closedNode("propertyTerm", propertyTerm.id, propertyTermMap) - - propertyTermMap.key("displayName", entry => { - val value = ValueNode(entry.value) - propertyTerm.set(ClassTermModel.DisplayName, value.string()) - }) - - propertyTermMap.key("description", entry => { - val value = ValueNode(entry.value) - propertyTerm.set(ClassTermModel.Description, value.string()) - }) - - propertyTermMap.key( - "range", - entry => { - val text = entry.value.as[YScalar].text - val rangeId = text match { - case "guid" => - Some((Namespace.Shapes + "guid").iri()) - case "any" | "uri" | "string" | "integer" | "float" | "double" | "long" | "boolean" | "time" | "date" | - "dateTime" => - Some(DataType(text)) - case classAlias => - ctx.resolveClassTermAlias(vocabulary.base.value(), classAlias, entry.value, strictLocal = true) match { - case Some(classTermId) => Some(classTermId) - case None => - ctx.missingClassTermWarning(classAlias, propertyTerm.id, entry.value) - None - } - } - - rangeId match { - case Some(id: String) => propertyTerm.withRange(id) - case None => // ignore - } - } - ) - - propertyTermMap.key( - "extends", - entry => { - val refs: Seq[String] = entry.value.tagType match { - case YType.Str => Seq(ValueNode(entry.value).string().toString) - case YType.Seq => - DefaultArrayNode(entry.value).nodes._1.map(_.as[YScalar].text) - // ArrayNode(entry.value).strings().scalars.map(_.toString) - case YType.Null => Seq.empty - } - - val superClasses: Seq[String] = refs - .map { term: String => - ctx.resolvePropertyTermAlias(vocabulary.base.value(), term, entry.value, strictLocal = true) match { - case Some(v) => Some(v) - case None => - ctx.missingPropertyTermWarning(term, propertyTerm.id, entry.value) - None - } - } - .filter(_.nonEmpty) - .map(_.get) - - propertyTerm.set(ObjectPropertyTermModel.SubPropertyOf, superClasses) - } - ) - } - - ctx.register(propertyTermAlias, propertyTerm) + } + ) } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/VocabulariesReferencesParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/VocabulariesReferencesParser.scala index 04ff4fbb..e5f6390b 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/VocabulariesReferencesParser.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/VocabulariesReferencesParser.scala @@ -22,42 +22,43 @@ case class VocabulariesReferencesParser(map: YMap, references: Seq[ParsedReferen private def parseLibraries(result: ReferenceCollector[AmfObject], id: String): Unit = { map.key( - "uses", - entry => - entry.value - .as[YMap] - .entries - .foreach( - e => { - val alias: String = e.key.as[YScalar].text - val url: String = e.value.as[YScalar].text - target(url) - .foreach { - case module: DeclaresModel => - result += (alias, collectAlias(module, alias -> ReferencedInfo(module.id, module.id, url))) - case other => - ctx.eh.violation(ExpectedVocabularyModule, - id, - s"Expected vocabulary module but found: $other", - e.location) // todo Uses should only reference modules... - } - }) + "uses", + entry => + entry.value + .as[YMap] + .entries + .foreach(e => { + val alias: String = e.key.as[YScalar].text + val url: String = e.value.as[YScalar].text + target(url) + .foreach { + case module: DeclaresModel => + result += (alias, collectAlias(module, alias -> ReferencedInfo(module.id, module.id, url))) + case other => + ctx.eh.violation( + ExpectedVocabularyModule, + id, + s"Expected vocabulary module but found: $other", + e.location + ) // todo Uses should only reference modules... + } + }) ) } private def parseExternals(result: ReferenceCollector[AmfObject], id: String): Unit = { map.key( - "external", - entry => - entry.value - .as[YMap] - .entries - .foreach(e => { - val alias: String = e.key.as[YScalar].text - val base: String = e.value.as[YScalar].text - val external = External() - result += (alias, external.withAlias(alias).withBase(base)) - }) + "external", + entry => + entry.value + .as[YMap] + .entries + .foreach(e => { + val alias: String = e.key.as[YScalar].text + val base: String = e.value.as[YScalar].text + val external = External() + result += (alias, external.withAlias(alias).withBase(base)) + }) ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/VocabularyContext.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/VocabularyContext.scala index 3585330a..b310536f 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/VocabularyContext.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/VocabularyContext.scala @@ -9,10 +9,12 @@ import amf.core.internal.plugins.syntax.SYamlAMFParserErrorHandler import org.yaml.model.YPart class VocabularyContext(private val wrapped: ParserContext, private val ds: Option[VocabularyDeclarations] = None) - extends SyamlBasedParserErrorHandler(wrapped.rootContextDocument, - wrapped.refs, - wrapped.futureDeclarations, - wrapped.config) + extends SyamlBasedParserErrorHandler( + wrapped.rootContextDocument, + wrapped.refs, + wrapped.futureDeclarations, + wrapped.config + ) with VocabularySyntax with SyntaxErrorReporter { @@ -46,10 +48,12 @@ class VocabularyContext(private val wrapped: ParserContext, private val ds: Opti } } - def resolvePropertyTermAlias(base: String, - propertyTermAlias: String, - where: YPart, - strictLocal: Boolean): Option[String] = { + def resolvePropertyTermAlias( + base: String, + propertyTermAlias: String, + where: YPart, + strictLocal: Boolean + ): Option[String] = { if (propertyTermAlias.contains(".")) { val prefix = propertyTermAlias.split("\\.").head val value = propertyTermAlias.split("\\.").last @@ -65,13 +69,21 @@ class VocabularyContext(private val wrapped: ParserContext, private val ds: Opti val local = s"$base$propertyTermAlias" declarations.getPropertyTermId(propertyTermAlias) match { case Some(_) => // ignore - case None => if (strictLocal) { pendingLocal ++= Seq((local, propertyTermAlias, where, true)) } + case None => + if (strictLocal) { + pendingLocal ++= Seq((local, propertyTermAlias, where, true)) + } } Some(local) } } - def resolveClassTermAlias(base: String, classTermAlias: String, where: YPart, strictLocal: Boolean): Option[String] = { + def resolveClassTermAlias( + base: String, + classTermAlias: String, + where: YPart, + strictLocal: Boolean + ): Option[String] = { if (classTermAlias.contains(".")) { val prefix = classTermAlias.split("\\.").head val value = classTermAlias.split("\\.").last diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/VocabularyDeclarations.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/VocabularyDeclarations.scala index 37e13b95..dd5c6ec5 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/VocabularyDeclarations.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/VocabularyDeclarations.scala @@ -2,20 +2,21 @@ package amf.aml.internal.parse.vocabularies import amf.core.client.scala.errorhandling.AMFErrorHandler import amf.core.client.scala.parse.document.EmptyFutureDeclarations import amf.core.client.scala.vocabulary.Namespace -import amf.core.internal.parser.domain.{Declarations, FutureDeclarations} +import amf.core.internal.parser.domain.{Declarations, DotQualifiedNameExtractor, FutureDeclarations} import amf.aml.client.scala.model.document.Vocabulary import amf.aml.client.scala.model.domain.{ClassTerm, External, PropertyTerm} import scala.util.{Failure, Success, Try} -class VocabularyDeclarations(var externals: Map[String, External] = Map(), - var classTerms: Map[String, ClassTerm] = Map(), - var propertyTerms: Map[String, PropertyTerm] = Map(), - var usedVocabs: Map[String, Vocabulary] = Map(), - libs: Map[String, VocabularyDeclarations] = Map(), - errorHandler: AMFErrorHandler, - futureDeclarations: FutureDeclarations) - extends Declarations(libs, Map(), Map(), errorHandler, futureDeclarations) { +class VocabularyDeclarations( + var externals: Map[String, External] = Map(), + var classTerms: Map[String, ClassTerm] = Map(), + var propertyTerms: Map[String, PropertyTerm] = Map(), + var usedVocabs: Map[String, Vocabulary] = Map(), + libs: Map[String, VocabularyDeclarations] = Map(), + errorHandler: AMFErrorHandler, + futureDeclarations: FutureDeclarations +) extends Declarations(libs, Map(), Map(), errorHandler, futureDeclarations, DotQualifiedNameExtractor) { def registerTerm(term: PropertyTerm): Unit = { if (!term.name.value().contains(".")) { diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/VocabularySyntax.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/VocabularySyntax.scala index fd61abb7..ffecb480 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/VocabularySyntax.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/parse/vocabularies/VocabularySyntax.scala @@ -4,7 +4,7 @@ import org.yaml.model.{IllegalTypeHandler, YMap, YScalar} trait VocabularySyntax { this: VocabularyContext => val vocabulary: Map[String, String] = Map( - "$dialect" -> "string", + "$type" -> "string", "base" -> "string", "usage" -> "string", "vocabulary" -> "string", diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/registries/AMLRegistry.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/registries/AMLRegistry.scala index 63f1e74b..b0ed5239 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/registries/AMLRegistry.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/registries/AMLRegistry.scala @@ -4,8 +4,10 @@ import amf.aml.client.scala.model.document.Dialect import amf.aml.client.scala.model.domain.SemanticExtension import amf.core.client.common.validation.ProfileName import amf.core.client.scala.model.domain.AnnotationGraphLoader +import amf.core.client.scala.parse.AMFParsePlugin import amf.core.client.scala.transform.TransformationPipeline import amf.core.client.scala.validation.EffectiveValidationsCompute +import amf.core.client.scala.vocabulary.{Namespace, NamespaceAliases} import amf.core.internal.metamodel.ModelDefaultBuilder import amf.core.internal.plugins.AMFPlugin import amf.core.internal.plugins.parse.DomainParsingFallback @@ -14,30 +16,53 @@ import amf.core.internal.registries.{AMFRegistry, PluginsRegistry} import amf.core.internal.validation.EffectiveValidations import amf.core.internal.validation.core.ValidationProfile -/** - * Registry to store plugins, entities, transformation pipelines, constraint rules and semantic extensions +/** Registry to store plugins, entities, transformation pipelines, constraint rules and semantic extensions * - * @param plugins [[PluginsRegistry]] - * @param entitiesRegistry [[EntitiesRegistry]] - * @param transformationPipelines a map of [[TransformationPipeline]]s - * @param constraintsRules a map of [[ProfileName]] -> [[amf.core.internal.validation.core.ValidationProfile]] - * @param extensions a map of [[SemanticExtension]] -> [[Dialect]] + * @param plugins + * [[PluginsRegistry]] + * @param entitiesRegistry + * [[EntitiesRegistry]] + * @param transformationPipelines + * a map of [[TransformationPipeline]]s + * @param constraintsRules + * a map of [[ProfileName]] -> [[amf.core.internal.validation.core.ValidationProfile]] + * @param extensions + * a map of [[SemanticExtension]] -> [[Dialect]] */ -private[amf] class AMLRegistry(plugins: PluginsRegistry, - entitiesRegistry: EntitiesRegistry, - transformationPipelines: Map[String, TransformationPipeline], - constraintsRules: Map[ProfileName, ValidationProfile], - effectiveValidations: Map[ProfileName, EffectiveValidations], - extensions: Map[String, Dialect]) - extends AMFRegistry(plugins, entitiesRegistry, transformationPipelines, constraintsRules, effectiveValidations) { +private[amf] class AMLRegistry( + plugins: PluginsRegistry, + entitiesRegistry: EntitiesRegistry, + transformationPipelines: Map[String, TransformationPipeline], + constraintsRules: Map[ProfileName, ValidationProfile], + effectiveValidations: Map[ProfileName, EffectiveValidations], + extensions: Map[String, Dialect], + namespaceAliases: NamespaceAliases +) extends AMFRegistry( + plugins, + entitiesRegistry, + transformationPipelines, + constraintsRules, + effectiveValidations, + namespaceAliases + ) { override def withPlugin(amfPlugin: AMFPlugin[_]): AMLRegistry = copy(plugins = plugins.withPlugin(amfPlugin)) - override def removePlugin(id: String): AMLRegistry = copy(plugins = plugins.removePlugin(id)) + override def withReferenceParsePlugin(plugin: AMFParsePlugin): AMLRegistry = + copy(plugins = plugins.withReferenceParsePlugin(plugin)) + + override def withReferenceParsePlugins(parsePlugin: List[AMFParsePlugin]): AMLRegistry = + copy(plugins = plugins.withReferenceParsePlugins(parsePlugin)) override def withPlugins(amfPlugins: List[AMFPlugin[_]]): AMLRegistry = copy(plugins = plugins.withPlugins(amfPlugins)) + override def withRootParsePlugin(aMFParsePlugin: AMFParsePlugin): AMLRegistry = + copy(plugins = plugins.withRootParsePlugin(aMFParsePlugin)) + + override def withRootParsePlugins(amfParsePlugins: List[AMFParsePlugin]): AMLRegistry = + copy(plugins = plugins.withRootParsePlugins(amfParsePlugins)) + override def withFallback(plugin: DomainParsingFallback): AMLRegistry = copy(plugins = plugins.withFallback(plugin)) override def withConstraints(profile: ValidationProfile): AMLRegistry = { @@ -67,6 +92,9 @@ private[amf] class AMLRegistry(plugins: PluginsRegistry, override def withAnnotations(annotations: Map[String, AnnotationGraphLoader]): AMLRegistry = copy(entitiesRegistry = entitiesRegistry.withAnnotations(annotations)) + override def withAliases(aliases: NamespaceAliases): AMLRegistry = + copy(namespaceAliases = namespaceAliases.merge(aliases)) + def withExtensions(dialect: Dialect): AMLRegistry = { copy(extensions = this.extensions ++ dialect.extensionIndex) .copy(entitiesRegistry = this.entitiesRegistry.withExtensions(dialect.extensionModels)) @@ -79,18 +107,24 @@ private[amf] class AMLRegistry(plugins: PluginsRegistry, private[amf] def findExtension(extensionName: String): Option[Dialect] = extensions.get(extensionName) - private def copy(plugins: PluginsRegistry = plugins, - entitiesRegistry: EntitiesRegistry = entitiesRegistry, - transformationPipelines: Map[String, TransformationPipeline] = transformationPipelines, - constraintsRules: Map[ProfileName, ValidationProfile] = constraintsRules, - effectiveValidations: Map[ProfileName, EffectiveValidations] = effectiveValidations, - extensions: Map[String, Dialect] = extensions): AMLRegistry = - new AMLRegistry(plugins, - entitiesRegistry, - transformationPipelines, - constraintsRules, - effectiveValidations, - extensions) + private def copy( + plugins: PluginsRegistry = plugins, + entitiesRegistry: EntitiesRegistry = entitiesRegistry, + transformationPipelines: Map[String, TransformationPipeline] = transformationPipelines, + constraintsRules: Map[ProfileName, ValidationProfile] = constraintsRules, + effectiveValidations: Map[ProfileName, EffectiveValidations] = effectiveValidations, + extensions: Map[String, Dialect] = extensions, + namespaceAliases: NamespaceAliases = namespaceAliases + ): AMLRegistry = + new AMLRegistry( + plugins, + entitiesRegistry, + transformationPipelines, + constraintsRules, + effectiveValidations, + extensions, + namespaceAliases + ) } @@ -98,15 +132,30 @@ object AMLRegistry { /** Creates an empty AML Registry */ val empty = - new AMLRegistry(PluginsRegistry.empty, EntitiesRegistry.empty, Map.empty, Map.empty, Map.empty, Map.empty) + new AMLRegistry( + PluginsRegistry.empty, + EntitiesRegistry.empty, + Map.empty, + Map.empty, + Map.empty, + Map.empty, + NamespaceAliases() + ) def apply(registry: AMFRegistry): AMLRegistry = new AMLRegistry( - registry.getPluginsRegistry, - registry.getEntitiesRegistry, - registry.getTransformationPipelines, - registry.getConstraintsRules, - registry.getEffectiveValidations, - Map.empty + registry.getPluginsRegistry, + registry.getEntitiesRegistry, + registry.getTransformationPipelines, + registry.getConstraintsRules, + registry.getEffectiveValidations, + Map.empty, + registry.getNamespaceAliases ) + + def apply(registry: AMFRegistry, dialects: Seq[Dialect]): AMLRegistry = { + dialects.foldLeft(AMLRegistry(registry)) { (acc, curr) => + acc.withExtensions(curr) + } + } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/common/ExternalEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/common/ExternalEmitter.scala index f09a587e..3f994b3a 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/common/ExternalEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/common/ExternalEmitter.scala @@ -1,12 +1,12 @@ package amf.aml.internal.render.emitters.common -import amf.core.client.common.position.Position -import amf.core.client.common.position.Position.ZERO +import amf.aml.client.scala.model.domain.External import amf.core.internal.annotations.LexicalInformation import amf.core.internal.render.BaseEmitters.MapEntryEmitter import amf.core.internal.render.SpecOrdering import amf.core.internal.render.emitters.EntryEmitter -import amf.aml.client.scala.model.domain.External +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO import org.yaml.model.YDocument case class ExternalEmitter(external: External, ordering: SpecOrdering) extends EntryEmitter { diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/AliasEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/AliasEmitter.scala index 0e24ca92..96b80e65 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/AliasEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/AliasEmitter.scala @@ -1,11 +1,13 @@ package amf.aml.internal.render.emitters.dialects -import amf.core.internal.render.BaseEmitters.MapEntryEmitter +import amf.core.internal.render.BaseEmitters.{ArrayEmitter, MapEntryEmitter} import amf.core.internal.render.emitters.EntryEmitter import amf.core.internal.metamodel.Field import amf.core.client.scala.model.StrField -import amf.core.client.scala.model.domain.DomainElement -import org.yaml.model.YType +import amf.core.client.scala.model.domain.{AmfArray, AmfScalar, DomainElement} +import amf.core.internal.parser.domain.{FieldEntry, Value} +import amf.core.internal.render.SpecOrdering +import org.yaml.model.{YMapEntry, YType} trait AliasEmitter extends AliasesConsumer with PosExtractor { @@ -17,4 +19,12 @@ trait AliasEmitter extends AliasesConsumer with PosExtractor { MapEntryEmitter(key, targetAlias, yType, pos) } } + + protected def emitAliasSet(key: String, entry: FieldEntry, ordering: SpecOrdering, yType: YType): EntryEmitter = { + val scalars = entry.array.scalars.map { scalar => + aliasFor(scalar.value.toString).map(alias => scalar.copy(value = alias)).getOrElse(scalar) + } + val nextEntry = entry.copy(value = new Value(entry.array.copy(values = scalars), entry.value.annotations)) + ArrayEmitter(key, nextEntry, ordering = ordering, valuesTag = yType) + } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/AliasesConsumer.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/AliasesConsumer.scala index 450e0ed3..da0469c9 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/AliasesConsumer.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/AliasesConsumer.scala @@ -10,14 +10,12 @@ trait AliasesConsumer extends AmlEmittersHelper { def aliasFor(id: String): Option[String] = { if (Option(id).isEmpty) { None - } - else { + } else { maybeFindNodeMappingById(id) match { case Some((_, nodeMapping: NodeMappable)) => if (id.startsWith(dialect.id)) { Some(nodeMapping.name.value()) - } - else { + } else { val matchingAliases = aliases.keySet.filter(id.contains(_)) // we pick the most specific (longer) matching URI matchingAliases.toList.sorted.reverse.headOption.map { key => @@ -32,8 +30,7 @@ trait AliasesConsumer extends AmlEmittersHelper { if (id.startsWith(dialect.id)) { // local reference Some(id.split(dialect.id).last.replace("/declarations/", "")) - } - else { + } else { aliases.keySet.find(id.contains(_)) map { key => val alias = aliases(key)._1 val postfix = id.split(key).last match { @@ -42,8 +39,7 @@ trait AliasesConsumer extends AmlEmittersHelper { } if (postfix.startsWith("#")) { alias + "." + postfix.drop(1) // recursive references - } - else { + } else { alias + "." + postfix } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/AnnotationMappingsEntryEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/AnnotationMappingsEntryEmitter.scala index fc58cda9..37431fe6 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/AnnotationMappingsEntryEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/AnnotationMappingsEntryEmitter.scala @@ -1,22 +1,24 @@ package amf.aml.internal.render.emitters.dialects -import amf.core.client.common.position.Position +import amf.aml.client.scala.model.document.Dialect +import amf.aml.client.scala.model.domain.AnnotationMapping +import amf.aml.internal.metamodel.domain.AnnotationMappingModel.Domain +import amf.aml.internal.render.emitters.instances.NodeMappableFinder import amf.core.internal.render.BaseEmitters.{pos, traverse} import amf.core.internal.render.SpecOrdering import amf.core.internal.render.emitters.EntryEmitter -import amf.aml.internal.render.emitters.instances.NodeMappableFinder -import amf.aml.internal.metamodel.domain.AnnotationMappingModel.Domain -import amf.aml.client.scala.model.document.Dialect -import amf.aml.client.scala.model.domain.AnnotationMapping +import org.mulesoft.common.client.lexical.Position import org.yaml.model.YDocument.EntryBuilder import org.yaml.model.YType import scala.collection.mutable.ArrayBuffer -case class AnnotationMappingsEntryEmitter(dialect: Dialect, - annotationMappings: Seq[AnnotationMapping], - aliases: Map[String, (String, String)], - ordering: SpecOrdering)(implicit val nodeMappableFinder: NodeMappableFinder) +case class AnnotationMappingsEntryEmitter( + dialect: Dialect, + annotationMappings: Seq[AnnotationMapping], + aliases: Map[String, (String, String)], + ordering: SpecOrdering +)(implicit val nodeMappableFinder: NodeMappableFinder) extends EntryEmitter with AliasesConsumer with PosExtractor @@ -24,33 +26,40 @@ case class AnnotationMappingsEntryEmitter(dialect: Dialect, override def emit(b: EntryBuilder): Unit = { b.entry( - "annotationMappings", - _.obj { b => - val emitters = - annotationMappings.map(mapping => AnnotationMappingEmitter(dialect, mapping, aliases, ordering)) - traverse(ordering.sorted(emitters), b) - } + "annotationMappings", + _.obj { b => + val emitters = + annotationMappings.map(mapping => AnnotationMappingEmitter(dialect, mapping, aliases, ordering)) + traverse(ordering.sorted(emitters), b) + } ) } override def position(): Position = groupPosition(annotationMappings) } -case class AnnotationMappingEmitter(dialect: Dialect, - element: AnnotationMapping, - aliases: Map[String, (String, String)], - ordering: SpecOrdering)(implicit val nodeMappableFinder: NodeMappableFinder) +case class AnnotationMappingEmitter( + dialect: Dialect, + element: AnnotationMapping, + aliases: Map[String, (String, String)], + ordering: SpecOrdering +)(implicit val nodeMappableFinder: NodeMappableFinder) extends EntryEmitter with AliasEmitter { override def emit(b: EntryBuilder): Unit = { b.entry( - element.name.value(), - _.obj { b => - val emitters = ArrayBuffer.empty[EntryEmitter] - emitters.appendAll(emitAlias("domain", element.domain(), Domain, YType.Str)) - emitters.appendAll(PropertyLikeMappingEmitter(dialect, element, ordering, aliases).emitters) - traverse(ordering.sorted(emitters), b) - } + element.name.value(), + _.obj { b => + val emitters = ArrayBuffer.empty[EntryEmitter] + emitters ++= element.fields + .entry(Domain) + .map { entry => + emitAliasSet("domain", entry, ordering, YType.Seq) + } + .toSeq + emitters.appendAll(PropertyLikeMappingEmitter(dialect, element, ordering, aliases).emitters) + traverse(ordering.sorted(emitters), b) + } ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DefaultFacetEmission.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DefaultFacetEmission.scala new file mode 100644 index 00000000..14f44211 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DefaultFacetEmission.scala @@ -0,0 +1,24 @@ +package amf.aml.internal.render.emitters.dialects + +import amf.aml.client.scala.model.domain.WithDefaultFacet +import amf.core.client.scala.errorhandling.IgnoringErrorHandler +import amf.core.internal.datanode.DataNodeEmitter +import amf.core.internal.metamodel.domain.ShapeModel +import amf.core.internal.render.BaseEmitters.EntryPartEmitter +import amf.core.internal.render.SpecOrdering +import amf.core.internal.render.emitters.EntryEmitter + +trait DefaultFacetEmission extends PosExtractor { + protected def emitDefault(mapping: WithDefaultFacet): List[EntryEmitter] = { + mapping + .default() + .map { dataNode => + EntryPartEmitter( + "default", + DataNodeEmitter(dataNode, SpecOrdering.Lexical)(IgnoringErrorHandler), + position = fieldPos(mapping, ShapeModel.Default) + ) + } + .toList + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DialectDocumentsEmitters.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DialectDocumentsEmitters.scala index 49e69c47..9d008e79 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DialectDocumentsEmitters.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DialectDocumentsEmitters.scala @@ -1,17 +1,17 @@ package amf.aml.internal.render.emitters.dialects +import amf.aml.client.scala.model.document.{Dialect, Vocabulary} +import amf.aml.client.scala.model.domain.{AnnotationMapping, NodeMappable, NodeMapping, UnionNodeMapping} +import amf.aml.internal.render.emitters.common.ExternalEmitter +import amf.aml.internal.render.emitters.instances.AmlEmittersHelper +import amf.core.client.scala.model.document.DeclaresModel import amf.core.internal.annotations.Aliases.{Alias, ImportLocation} import amf.core.internal.annotations.LexicalInformation import amf.core.internal.render.BaseEmitters.traverse -import amf.core.internal.render.emitters.EntryEmitter -import amf.core.client.scala.model.document.DeclaresModel -import amf.core.client.common.position.Position -import amf.core.client.common.position.Position.ZERO import amf.core.internal.render.SpecOrdering -import amf.aml.internal.render.emitters.common.ExternalEmitter -import amf.aml.internal.render.emitters.instances.AmlEmittersHelper -import amf.aml.client.scala.model.document.{Dialect, Vocabulary} -import amf.aml.client.scala.model.domain.{AnnotationMapping, NodeMappable, NodeMapping, UnionNodeMapping} +import amf.core.internal.render.emitters.EntryEmitter +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO import org.yaml.model.YDocument.EntryBuilder trait DialectDocumentsEmitters extends AmlEmittersHelper { @@ -41,9 +41,12 @@ trait DialectDocumentsEmitters extends AmlEmittersHelper { if (dialect.externals.nonEmpty) { Seq(new EntryEmitter { override def emit(b: EntryBuilder): Unit = { - b.entry("external", _.obj({ b => - traverse(ordering.sorted(dialect.externals.map(external => ExternalEmitter(external, ordering))), b) - })) + b.entry( + "external", + _.obj({ b => + traverse(ordering.sorted(dialect.externals.map(external => ExternalEmitter(external, ordering))), b) + }) + ) } override def position(): Position = { @@ -59,9 +62,11 @@ trait DialectDocumentsEmitters extends AmlEmittersHelper { } } - private def nodeMappingDeclarationEmitters(dialect: Dialect, - ordering: SpecOrdering, - aliases: Map[String, (String, String)]): Seq[EntryEmitter] = { + private def nodeMappingDeclarationEmitters( + dialect: Dialect, + ordering: SpecOrdering, + aliases: Map[String, (String, String)] + ): Seq[EntryEmitter] = { type NodeMappable = NodeMappable.AnyNodeMappable val nodeMappingDeclarations: Seq[NodeMappable] = dialect.declares.collect { case nm: NodeMapping => nm @@ -72,20 +77,24 @@ trait DialectDocumentsEmitters extends AmlEmittersHelper { else Nil } - private def annotationMappingDeclarationEmitters(dialect: Dialect, - aliases: Map[String, (String, String)], - ordering: SpecOrdering): Seq[EntryEmitter] = { - val annotationMappings = dialect.declares.collect { - case mapping: AnnotationMapping => mapping + private def annotationMappingDeclarationEmitters( + dialect: Dialect, + aliases: Map[String, (String, String)], + ordering: SpecOrdering + ): Seq[EntryEmitter] = { + val annotationMappings = dialect.declares.collect { case mapping: AnnotationMapping => + mapping } if (annotationMappings.nonEmpty) Seq(AnnotationMappingsEntryEmitter(dialect, annotationMappings, aliases, ordering)) else Seq.empty } - private def extensionsEmitter(dialect: Dialect, - aliases: Map[String, (String, String)], - ordering: SpecOrdering): Seq[EntryEmitter] = { + private def extensionsEmitter( + dialect: Dialect, + aliases: Map[String, (String, String)], + ordering: SpecOrdering + ): Seq[EntryEmitter] = { if (dialect.extensions().nonEmpty) Seq(ExtensionMappingsEntryEmitter(dialect, aliases, ordering)) else Seq.empty } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DialectEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DialectEmitter.scala index 50ec4a33..5a1ca5b2 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DialectEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DialectEmitter.scala @@ -1,21 +1,26 @@ package amf.aml.internal.render.emitters.dialects -import amf.core.internal.annotations.Aliases.{Alias, FullUrl, ImportLocation} +import amf.aml.client.scala.model.document.Dialect +import amf.aml.internal.metamodel.document.DialectModel +import amf.aml.internal.render.emitters.dialects.FieldEntryImplicit._ +import amf.aml.internal.render.emitters.instances.NodeMappableFinder +import amf.core.internal.annotations.Aliases.{Alias, ImportLocation} import amf.core.internal.render.BaseEmitters._ +import amf.core.internal.render.SpecOrdering import amf.core.internal.render.SpecOrdering.Lexical import amf.core.internal.render.emitters.EntryEmitter -import amf.core.client.common.position.Position -import amf.core.client.common.position.Position.ZERO -import amf.core.internal.render.SpecOrdering -import amf.aml.internal.render.emitters.dialects.FieldEntryImplicit._ -import amf.aml.internal.render.emitters.instances.NodeMappableFinder -import amf.aml.internal.metamodel.document.DialectModel -import amf.aml.client.scala.model.document.Dialect +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO import org.yaml.model.YDocument import org.yaml.model.YDocument.EntryBuilder -case class DialectEmitter(dialect: Dialect)(implicit val nodeMappableFinder: NodeMappableFinder) - extends DialectDocumentsEmitters { +trait DocumentCreator { + def apply(content: Seq[EntryEmitter]): YDocument +} + +case class DialectEmitter(dialect: Dialect, document: DocumentCreator)(implicit + val nodeMappableFinder: NodeMappableFinder +) extends DialectDocumentsEmitters { val ordering: SpecOrdering = Lexical val aliases: Map[RefKey, (Alias, ImportLocation)] = @@ -23,13 +28,7 @@ case class DialectEmitter(dialect: Dialect)(implicit val nodeMappableFinder: Nod def emitDialect(): YDocument = { val content: Seq[EntryEmitter] = rootLevelEmitters(ordering) ++ dialectEmitters(ordering) - - YDocument(b => { - b.comment("%Dialect 1.0") - b.obj { b => - traverse(ordering.sorted(content), b) - } - }) + document(ordering.sorted(content)) } def dialectEmitters(ordering: SpecOrdering): Seq[EntryEmitter] = diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DiscriminatorEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DiscriminatorEmitter.scala index 5eb96457..34fef981 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DiscriminatorEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DiscriminatorEmitter.scala @@ -1,18 +1,19 @@ package amf.aml.internal.render.emitters.dialects +import amf.aml.client.scala.model.domain.NodeWithDiscriminator +import amf.aml.internal.metamodel.domain.NodeWithDiscriminatorModel +import amf.core.client.scala.model.domain.AmfScalar import amf.core.internal.render.BaseEmitters.MapEntryEmitter import amf.core.internal.render.emitters.EntryEmitter -import amf.core.client.scala.model.domain.AmfScalar -import amf.core.client.common.position.Position -import amf.aml.internal.metamodel.domain.NodeWithDiscriminatorModel -import amf.aml.client.scala.model.domain.NodeWithDiscriminator +import org.mulesoft.common.client.lexical.Position import org.yaml.model.YDocument.EntryBuilder import org.yaml.model.YType trait DiscriminatorEmitter extends PosExtractor with AliasesConsumer { def emitDiscriminator[M <: NodeWithDiscriminatorModel]( - nodeWithDiscriminator: NodeWithDiscriminator[M]): Seq[EntryEmitter] = { + nodeWithDiscriminator: NodeWithDiscriminator[M] + ): Seq[EntryEmitter] = { var emitters: Seq[EntryEmitter] = Seq() nodeWithDiscriminator.fields.entry(nodeWithDiscriminator.meta.TypeDiscriminator) foreach { entry => val pos = fieldPos(nodeWithDiscriminator, entry.field) @@ -20,16 +21,15 @@ trait DiscriminatorEmitter extends PosExtractor with AliasesConsumer { emitters ++= Seq(new EntryEmitter { override def emit(b: EntryBuilder): Unit = b.entry( - "typeDiscriminator", - _.obj { b => - typesMapping.foreach { - case (alias, nodeMappingId) => - aliasFor(nodeMappingId) match { - case Some(nodeMapping) => b.entry(alias, nodeMapping) - case _ => b.entry(alias, nodeMappingId) - } + "typeDiscriminator", + _.obj { b => + typesMapping.foreach { case (alias, nodeMappingId) => + aliasFor(nodeMappingId) match { + case Some(nodeMapping) => b.entry(alias, nodeMapping) + case _ => b.entry(alias, nodeMappingId) } } + } ) override def position(): Position = pos diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DocumentsModelEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DocumentsModelEmitter.scala index e826f701..078a61a8 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DocumentsModelEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DocumentsModelEmitter.scala @@ -1,47 +1,47 @@ package amf.aml.internal.render.emitters.dialects -import amf.core.client.common.position.Position -import amf.core.client.common.position.Position.ZERO +import amf.aml.client.scala.model.document.Dialect +import amf.aml.client.scala.model.domain.{DocumentsModel, PublicNodeMapping} +import amf.aml.internal.metamodel.domain.DocumentMappingModel +import amf.aml.internal.render.emitters.instances.NodeMappableFinder import amf.core.internal.annotations.LexicalInformation import amf.core.internal.render.BaseEmitters.traverse import amf.core.internal.render.SpecOrdering import amf.core.internal.render.emitters.EntryEmitter -import amf.aml.internal.render.emitters.instances.NodeMappableFinder -import amf.aml.internal.metamodel.domain.DocumentMappingModel -import amf.aml.client.scala.model.document.Dialect -import amf.aml.client.scala.model.domain.{DocumentsModel, PublicNodeMapping} +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO import org.yaml.model.YDocument.EntryBuilder case class DocumentsModelEmitter(dialect: Dialect, ordering: SpecOrdering, aliases: Map[String, (String, String)])( - implicit val nodeMappableFinder: NodeMappableFinder) - extends EntryEmitter + implicit val nodeMappableFinder: NodeMappableFinder +) extends EntryEmitter with AliasesConsumer { val documents: DocumentsModel = dialect.documents() var emitters: Seq[EntryEmitter] = Seq() override def emit(b: EntryBuilder): Unit = { b.entry( - "documents", - _.obj { b => - // Root Emitter - if (Option(documents.root()).isDefined) { - emitters ++= Seq(RootDocumentModelEmitter(dialect, ordering, aliases)) - } + "documents", + _.obj { b => + // Root Emitter + if (Option(documents.root()).isDefined) { + emitters ++= Seq(RootDocumentModelEmitter(dialect, ordering, aliases)) + } - // Fragments emitter - if (documents.fragments().nonEmpty) { - emitters ++= Seq(FragmentsDocumentModelEmitter(dialect, ordering, aliases)) - } + // Fragments emitter + if (documents.fragments().nonEmpty) { + emitters ++= Seq(FragmentsDocumentModelEmitter(dialect, ordering, aliases)) + } - // Module emitter - if (Option(documents.library()).isDefined) { - emitters ++= Seq(LibraryDocumentModelEmitter(dialect, ordering, aliases)) - } + // Module emitter + if (Option(documents.library()).isDefined) { + emitters ++= Seq(LibraryDocumentModelEmitter(dialect, ordering, aliases)) + } - emitters ++= Seq(DocumentsModelOptionsEmitter(dialect, ordering)) + emitters ++= Seq(DocumentsModelOptionsEmitter(dialect, ordering)) - traverse(ordering.sorted(emitters), b) - } + traverse(ordering.sorted(emitters), b) + } ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DocumentsModelOptionsEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DocumentsModelOptionsEmitter.scala index f2752776..910129e5 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DocumentsModelOptionsEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/DocumentsModelOptionsEmitter.scala @@ -1,20 +1,21 @@ package amf.aml.internal.render.emitters.dialects -import amf.core.internal.render.BaseEmitters.{MapEntryEmitter, pos, traverse} -import amf.core.internal.render.emitters.EntryEmitter -import amf.core.client.common.position.Position -import amf.core.client.common.position.Position.ZERO -import amf.core.internal.render.SpecOrdering -import amf.aml.internal.render.emitters.instances.NodeMappableFinder import amf.aml.client.scala.model.document.Dialect import amf.aml.client.scala.model.domain.DocumentsModel +import amf.aml.internal.render.emitters.instances.NodeMappableFinder +import amf.core.internal.render.BaseEmitters.{MapEntryEmitter, pos, traverse} +import amf.core.internal.render.SpecOrdering +import amf.core.internal.render.emitters.EntryEmitter +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO import org.yaml.model.YDocument.EntryBuilder import org.yaml.model.YType case class DocumentsModelOptionsEmitter( dialect: Dialect, ordering: SpecOrdering, - aliases: Map[String, (String, String)] = Map())(implicit val nodeMappableFinder: NodeMappableFinder) + aliases: Map[String, (String, String)] = Map() +)(implicit val nodeMappableFinder: NodeMappableFinder) extends EntryEmitter with AliasesConsumer { @@ -22,36 +23,41 @@ case class DocumentsModelOptionsEmitter( var emitters: Seq[EntryEmitter] = Seq() private def hasOptions: Boolean = - Seq(mapping.selfEncoded().option(), mapping.declarationsPath().option(), mapping.keyProperty().option()).flatten.nonEmpty + Seq( + mapping.selfEncoded().option(), + mapping.declarationsPath().option(), + mapping.keyProperty().option() + ).flatten.nonEmpty val sortedNodes: Seq[MapEntryEmitter] = if (hasOptions) { val options = Map( - "selfEncoded" -> mapping.selfEncoded().option(), - "declarationsPath" -> mapping.declarationsPath().option(), - "keyProperty" -> mapping.keyProperty().option(), - "referenceStyle" -> mapping.referenceStyle().option() + "selfEncoded" -> mapping.selfEncoded().option(), + "declarationsPath" -> mapping.declarationsPath().option(), + "keyProperty" -> mapping.keyProperty().option(), + "referenceStyle" -> mapping.referenceStyle().option() ) - val types = Map("selfEncoded" -> YType.Bool, - "keyProperty" -> YType.Bool, - "declarationsPath" -> YType.Str, - "referenceStyle" -> YType.Str) + val types = Map( + "selfEncoded" -> YType.Bool, + "keyProperty" -> YType.Bool, + "declarationsPath" -> YType.Str, + "referenceStyle" -> YType.Str + ) val annotations = Map( - "selfEncoded" -> mapping.selfEncoded().annotations(), - "declarationsPath" -> mapping.declarationsPath().annotations(), - "keyProperty" -> mapping.keyProperty().annotations(), - "referenceStyle" -> mapping.referenceStyle().annotations() + "selfEncoded" -> mapping.selfEncoded().annotations(), + "declarationsPath" -> mapping.declarationsPath().annotations(), + "keyProperty" -> mapping.keyProperty().annotations(), + "referenceStyle" -> mapping.referenceStyle().annotations() ) val optionNodes: Seq[MapEntryEmitter] = options - .map { - case (optionName, maybeValue) => - maybeValue map { value => - val key = optionName - val nodetype = types(optionName) - val position: Position = pos(annotations(optionName)) - MapEntryEmitter(optionName, value.toString, nodetype, position) - } + .map { case (optionName, maybeValue) => + maybeValue map { value => + val key = optionName + val nodetype = types(optionName) + val position: Position = pos(annotations(optionName)) + MapEntryEmitter(optionName, value.toString, nodetype, position) + } } .collect({ case Some(node) => node }) .toSeq @@ -62,9 +68,12 @@ case class DocumentsModelOptionsEmitter( override def emit(b: EntryBuilder): Unit = { if (sortedNodes.nonEmpty) { - b.entry("options", _.obj { b => - traverse(sortedNodes, b) - }) + b.entry( + "options", + _.obj { b => + traverse(sortedNodes, b) + } + ) } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/ExtensionMappingsEntryEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/ExtensionMappingsEntryEmitter.scala index 4d80f98d..f9cf1586 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/ExtensionMappingsEntryEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/ExtensionMappingsEntryEmitter.scala @@ -3,27 +3,29 @@ package amf.aml.internal.render.emitters.dialects import amf.core.internal.render.BaseEmitters.{pos, traverse} import amf.core.internal.render.SpecOrdering import amf.core.internal.render.emitters.EntryEmitter -import amf.core.client.common.position.Position import amf.aml.internal.render.emitters.instances.NodeMappableFinder import amf.aml.internal.metamodel.domain.SemanticExtensionModel import amf.aml.client.scala.model.document.Dialect import amf.aml.client.scala.model.domain.SemanticExtension +import org.mulesoft.common.client.lexical.Position import org.yaml.model.YDocument.EntryBuilder import org.yaml.model.YType -case class ExtensionMappingsEntryEmitter(dialect: Dialect, - aliases: Map[String, (String, String)], - ordering: SpecOrdering)(implicit val nodeMappableFinder: NodeMappableFinder) +case class ExtensionMappingsEntryEmitter( + dialect: Dialect, + aliases: Map[String, (String, String)], + ordering: SpecOrdering +)(implicit val nodeMappableFinder: NodeMappableFinder) extends EntryEmitter with GroupPosition { override def emit(b: EntryBuilder): Unit = { b.entry( - "extensions", - _.obj { b => - val results = extensions.map(ext => SemanticExtensionEmitter(dialect, ext, aliases, ordering)) - traverse(ordering.sorted(results), b) - } + "extensions", + _.obj { b => + val results = extensions.map(ext => SemanticExtensionEmitter(dialect, ext, aliases, ordering)) + traverse(ordering.sorted(results), b) + } ) } @@ -32,17 +34,21 @@ case class ExtensionMappingsEntryEmitter(dialect: Dialect, private def extensions = dialect.extensions() } -case class SemanticExtensionEmitter(dialect: Dialect, - element: SemanticExtension, - aliases: Map[String, (String, String)], - ordering: SpecOrdering)(implicit val nodeMappableFinder: NodeMappableFinder) +case class SemanticExtensionEmitter( + dialect: Dialect, + element: SemanticExtension, + aliases: Map[String, (String, String)], + ordering: SpecOrdering +)(implicit val nodeMappableFinder: NodeMappableFinder) extends EntryEmitter with AliasEmitter { override def emit(b: EntryBuilder): Unit = { - val emitters = emitAlias(element.extensionName().value(), - element.extensionMappingDefinition(), - SemanticExtensionModel.ExtensionMappingDefinition, - YType.Str).toSeq + val emitters = emitAlias( + element.extensionName().value(), + element.extensionMappingDefinition(), + SemanticExtensionModel.ExtensionMappingDefinition, + YType.Str + ).toSeq traverse(ordering.sorted(emitters), b) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/FieldEntryImplicit.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/FieldEntryImplicit.scala index be7853f7..18f68d56 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/FieldEntryImplicit.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/FieldEntryImplicit.scala @@ -1,8 +1,8 @@ package amf.aml.internal.render.emitters.dialects -import amf.core.client.common.position.Position import amf.core.internal.annotations.LexicalInformation import amf.core.internal.parser.domain.FieldEntry +import org.mulesoft.common.client.lexical.Position private object FieldEntryImplicit { implicit class FieldEntryWithPosition(entry: FieldEntry) { diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/FragmentMappingEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/FragmentMappingEmitter.scala index a851df4d..1ac86d6b 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/FragmentMappingEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/FragmentMappingEmitter.scala @@ -1,21 +1,22 @@ package amf.aml.internal.render.emitters.dialects -import amf.core.client.common.position.Position -import amf.core.client.common.position.Position.ZERO +import amf.aml.client.scala.model.document.Dialect +import amf.aml.client.scala.model.domain.DocumentMapping +import amf.aml.internal.render.emitters.instances.NodeMappableFinder import amf.core.internal.annotations.LexicalInformation import amf.core.internal.render.BaseEmitters.MapEntryEmitter import amf.core.internal.render.SpecOrdering import amf.core.internal.render.emitters.EntryEmitter -import amf.aml.internal.render.emitters.instances.NodeMappableFinder -import amf.aml.client.scala.model.document.Dialect -import amf.aml.client.scala.model.domain.DocumentMapping +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO import org.yaml.model.YDocument.EntryBuilder case class FragmentMappingEmitter( dialect: Dialect, fragment: DocumentMapping, ordering: SpecOrdering, - aliases: Map[String, (String, String)])(implicit val nodeMappableFinder: NodeMappableFinder) + aliases: Map[String, (String, String)] +)(implicit val nodeMappableFinder: NodeMappableFinder) extends EntryEmitter with AliasesConsumer { diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/FragmentsDocumentModelEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/FragmentsDocumentModelEmitter.scala index 4bc2602c..fe1cafa2 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/FragmentsDocumentModelEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/FragmentsDocumentModelEmitter.scala @@ -1,17 +1,18 @@ package amf.aml.internal.render.emitters.dialects -import amf.core.client.common.position.Position -import amf.core.client.common.position.Position.ZERO import amf.core.internal.render.SpecOrdering import amf.core.internal.render.emitters.EntryEmitter import amf.aml.internal.render.emitters.instances.NodeMappableFinder import amf.aml.client.scala.model.document.Dialect +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO import org.yaml.model.YDocument.EntryBuilder case class FragmentsDocumentModelEmitter( dialect: Dialect, ordering: SpecOrdering, - aliases: Map[String, (String, String)])(implicit val nodeMappableFinder: NodeMappableFinder) + aliases: Map[String, (String, String)] +)(implicit val nodeMappableFinder: NodeMappableFinder) extends EntryEmitter with AliasesConsumer { var emitters: Seq[EntryEmitter] = dialect.documents().fragments().map { fragmentMapping => @@ -20,11 +21,17 @@ case class FragmentsDocumentModelEmitter( override def emit(b: EntryBuilder): Unit = { - b.entry("fragments", _.obj { b => - b.entry("encodes", _.obj { b => - ordering.sorted(emitters).foreach(_.emit(b)) - }) - }) + b.entry( + "fragments", + _.obj { b => + b.entry( + "encodes", + _.obj { b => + ordering.sorted(emitters).foreach(_.emit(b)) + } + ) + } + ) } override def position(): Position = diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/GroupPosition.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/GroupPosition.scala index a1c8c250..3b443a64 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/GroupPosition.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/GroupPosition.scala @@ -1,8 +1,8 @@ package amf.aml.internal.render.emitters.dialects -import amf.core.internal.annotations.LexicalInformation import amf.core.client.scala.model.domain.DomainElement -import amf.core.client.common.position.Position.ZERO +import amf.core.internal.annotations.LexicalInformation +import org.mulesoft.common.client.lexical.Position.ZERO trait GroupPosition { def groupPosition(elements: Seq[DomainElement]) = diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/LibraryDocumentModelEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/LibraryDocumentModelEmitter.scala index 66a242d8..03eb1678 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/LibraryDocumentModelEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/LibraryDocumentModelEmitter.scala @@ -1,7 +1,5 @@ package amf.aml.internal.render.emitters.dialects -import amf.core.client.common.position.Position -import amf.core.client.common.position.Position.ZERO import amf.core.internal.annotations.LexicalInformation import amf.core.internal.render.BaseEmitters.{MapEntryEmitter, traverse} import amf.core.internal.render.SpecOrdering @@ -9,12 +7,15 @@ import amf.core.internal.render.emitters.EntryEmitter import amf.aml.internal.render.emitters.instances.NodeMappableFinder import amf.aml.client.scala.model.document.Dialect import amf.aml.client.scala.model.domain.DocumentMapping +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO import org.yaml.model.YDocument.EntryBuilder case class LibraryDocumentModelEmitter( dialect: Dialect, ordering: SpecOrdering, - aliases: Map[String, (String, String)])(implicit val nodeMappableFinder: NodeMappableFinder) + aliases: Map[String, (String, String)] +)(implicit val nodeMappableFinder: NodeMappableFinder) extends EntryEmitter with AliasesConsumer { val mapping: DocumentMapping = dialect.documents().library() @@ -33,17 +34,23 @@ case class LibraryDocumentModelEmitter( emitters ++= Seq(new EntryEmitter { override def emit(b: EntryBuilder): Unit = { - b.entry("declares", _.obj { b => - traverse(sortedNodes, b) - }) + b.entry( + "declares", + _.obj { b => + traverse(sortedNodes, b) + } + ) } override def position(): Position = sortedNodes.head.position }) - b.entry("library", _.obj { b => - traverse(ordering.sorted(emitters), b) - }) + b.entry( + "library", + _.obj { b => + traverse(ordering.sorted(emitters), b) + } + ) } override def position(): Position = { diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/NodeMappingEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/NodeMappingEmitter.scala index 0649467a..b8e3ad55 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/NodeMappingEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/NodeMappingEmitter.scala @@ -1,16 +1,16 @@ package amf.aml.internal.render.emitters.dialects +import amf.aml.client.scala.model.document.{Dialect, DialectFragment} +import amf.aml.client.scala.model.domain._ +import amf.aml.internal.metamodel.domain.{NodeMappableModel, UnionNodeMappingModel} +import amf.aml.internal.render.emitters.instances.NodeMappableFinder +import amf.core.client.scala.model.domain.{AmfScalar, DomainElement, Linkable} import amf.core.internal.annotations.LexicalInformation import amf.core.internal.render.BaseEmitters.{MapEntryEmitter, ScalarEmitter, traverse} -import amf.core.internal.render.emitters.EntryEmitter -import amf.core.client.scala.model.domain.{AmfScalar, DomainElement, Linkable} -import amf.core.client.common.position.Position -import amf.core.client.common.position.Position.ZERO import amf.core.internal.render.SpecOrdering -import amf.aml.internal.render.emitters.instances.NodeMappableFinder -import amf.aml.internal.metamodel.domain.{NodeMappableModel, UnionNodeMappingModel} -import amf.aml.client.scala.model.document.{Dialect, DialectFragment} -import amf.aml.client.scala.model.domain.{NodeMappable, NodeMapping, PropertyMapping, UnionNodeMapping} +import amf.core.internal.render.emitters.EntryEmitter +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO import org.yaml.model.YDocument.EntryBuilder import org.yaml.model.YNode @@ -18,7 +18,8 @@ case class NodeMappingEmitter( dialect: Dialect, nodeMappable: NodeMappable[_ <: NodeMappableModel], ordering: SpecOrdering, - aliases: Map[String, (String, String)])(implicit val nodeMappableFinder: NodeMappableFinder) + aliases: Map[String, (String, String)] +)(implicit val nodeMappableFinder: NodeMappableFinder) extends EntryEmitter with DiscriminatorEmitter with AliasesConsumer @@ -35,7 +36,7 @@ case class NodeMappingEmitter( } else { nodeMappable match { case nodeMapping: NodeMapping => emitSingleNode(b, nodeMapping) - case unionNodeMapping: UnionNodeMapping => emitUnioNode(b, unionNodeMapping) + case unionNodeMapping: UnionNodeMapping => emitUnionNode(b, unionNodeMapping) case _ => // ignore } } @@ -43,73 +44,130 @@ case class NodeMappingEmitter( protected def emitSingleNode(b: EntryBuilder, nodeMapping: NodeMapping): Unit = { b.entry( - nodeMapping.name.value(), - _.obj { b => - aliasFor(nodeMapping.nodetypeMapping.value()) match { - case Some(classTermAlias) => MapEntryEmitter("classTerm", classTermAlias).emit(b) - case None => nodeMapping.nodetypeMapping - } - nodeMapping.propertiesMapping() match { - case properties: Seq[PropertyMapping] if properties.nonEmpty => - b.entry( - "mapping", - _.obj { b => - val propertiesEmitters: Seq[PropertyMappingEmitter] = properties.map { pm: PropertyMapping => - PropertyMappingEmitter(dialect, pm, ordering, aliases) - } - traverse(ordering.sorted(propertiesEmitters), b) + nodeMapping.name.value(), + _.obj { b => + emitAnyNode(b, nodeMapping) + aliasFor(nodeMapping.nodetypeMapping.value()) match { + case Some(classTermAlias) => MapEntryEmitter("classTerm", classTermAlias).emit(b) + case None => nodeMapping.nodetypeMapping + } + nodeMapping.propertiesMapping() match { + case properties: Seq[PropertyMapping] if properties.nonEmpty => + b.entry( + "mapping", + _.obj { b => + val propertiesEmitters: Seq[PropertyMappingEmitter] = properties.map { pm: PropertyMapping => + PropertyMappingEmitter(dialect, pm, ordering, aliases) + } + traverse(ordering.sorted(propertiesEmitters), b) + } + ) + case _ => // ignore + } + if (nodeMapping.extend.nonEmpty) { + if (nodeMapping.extend.length == 1) { + b.entry("extends", nodeMapping.extend.head.asInstanceOf[Linkable].linkLabel.value()) + } else { + b.entry( + "extends", + l => { + l.list { b => + nodeMapping.extend.foreach { e => + b.+=(YNode(e.asInstanceOf[Linkable].linkLabel.value())) } - ) - case _ => // ignore - } - nodeMapping.extend.headOption match { - case Some(link: Linkable) => - b.entry("extends", link.linkLabel.value()) - case _ => // ignore - } - nodeMapping.idTemplate.option().foreach { idTemplate => - b.entry("idTemplate", idTemplate) - } - nodeMapping.mergePolicy.option().foreach { policy => - b.entry("patch", policy) + } + } + ) } } + + nodeMapping.closed.option().foreach { additionalProps => + b.entry("additionalProperties", !additionalProps) + } + nodeMapping.idTemplate.option().foreach { idTemplate => + b.entry("idTemplate", idTemplate) + } + nodeMapping.mergePolicy.option().foreach { policy => + b.entry("patch", policy) + } + } ) } - protected def emitUnioNode(b: EntryBuilder, unionNodeMapping: UnionNodeMapping): Unit = { + protected def emitUnionNode(b: EntryBuilder, unionNodeMapping: UnionNodeMapping): Unit = { b.entry( - unionNodeMapping.name.value(), - _.obj { b => - var emitters: Seq[EntryEmitter] = Seq() - val nodes = unionNodeMapping.objectRange() - if (nodes.nonEmpty) { - val pos = fieldPos(unionNodeMapping, UnionNodeMappingModel.ObjectRange) - val targets = nodes - .map { nodeId => - aliasFor(nodeId.value()) match { - case Some(nodeMappingAlias) => Some(nodeMappingAlias) - case _ => None - } + unionNodeMapping.name.value(), + _.obj { b => + emitAnyNode(b, unionNodeMapping) + var emitters: Seq[EntryEmitter] = Seq() + val nodes = unionNodeMapping.objectRange() + if (nodes.nonEmpty) { + val pos = fieldPos(unionNodeMapping, UnionNodeMappingModel.ObjectRange) + val targets = nodes + .map { nodeId => + aliasFor(nodeId.value()) match { + case Some(nodeMappingAlias) => Some(nodeMappingAlias) + case _ => None } - .collect { case Some(alias) => alias } + } + .collect { case Some(alias) => alias } - emitters ++= Seq(new EntryEmitter { - override def emit(b: EntryBuilder): Unit = - b.entry("union", _.list { b => + emitters ++= Seq(new EntryEmitter { + override def emit(b: EntryBuilder): Unit = + b.entry( + "union", + _.list { b => targets.foreach(target => ScalarEmitter(AmfScalar(target)).emit(b)) - }) - override def position(): Position = pos - }) + } + ) + override def position(): Position = pos + }) - emitters ++= emitDiscriminator(unionNodeMapping) + emitters ++= emitDiscriminator(unionNodeMapping) - ordering.sorted(emitters).foreach(_.emit(b)) - } + ordering.sorted(emitters).foreach(_.emit(b)) } + } ) } + def emitAnyNode(b: EntryBuilder, anyMapping: AnyMapping): Unit = { + if (anyMapping.and.nonEmpty) { + val members = anyMapping.and.flatMap(member => aliasFor(member.value())) + b.entry( + "allOf", + _.list(b => members.foreach(member => ScalarEmitter(AmfScalar(member)).emit(b))) + ) + } + if (anyMapping.or.nonEmpty) { + val members = anyMapping.or.flatMap(member => aliasFor(member.value())) + b.entry( + "oneOf", + _.list(b => members.foreach(member => ScalarEmitter(AmfScalar(member)).emit(b))) + ) + } + if (anyMapping.components.nonEmpty) { + val members = anyMapping.components.flatMap(component => aliasFor(component.value())) + b.entry( + "components", + _.list(b => members.foreach(component => ScalarEmitter(AmfScalar(component)).emit(b))) + ) + } + if (anyMapping.ifMapping.nonEmpty) { + b.entry( + "conditional", + _.obj { b => + if (anyMapping.ifMapping.nonEmpty) + b.entry("if", aliasFor(anyMapping.ifMapping.value()).getOrElse("")) + if (anyMapping.thenMapping.nonEmpty) + b.entry("then", aliasFor(anyMapping.thenMapping.value()).getOrElse("")) + if (anyMapping.elseMapping.nonEmpty) + b.entry("else", aliasFor(anyMapping.elseMapping.value()).getOrElse("")) + } + ) + } + } + def isFragment(elem: DomainElement, dialect: Dialect): Boolean = { dialect.references.exists { case ref: DialectFragment => ref.encodes.id == elem.id diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/NodeMappingsEntryEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/NodeMappingsEntryEmitter.scala index 91cf17df..b2920f6d 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/NodeMappingsEntryEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/NodeMappingsEntryEmitter.scala @@ -1,33 +1,32 @@ package amf.aml.internal.render.emitters.dialects -import amf.core.internal.annotations.LexicalInformation +import amf.aml.client.scala.model.document.Dialect +import amf.aml.client.scala.model.domain.NodeMappable +import amf.aml.internal.render.emitters.instances.NodeMappableFinder import amf.core.internal.render.BaseEmitters.traverse -import amf.core.internal.render.emitters.EntryEmitter -import amf.core.client.scala.model.domain.DomainElement -import amf.core.client.common.position.Position -import amf.core.client.common.position.Position.ZERO import amf.core.internal.render.SpecOrdering -import amf.aml.internal.render.emitters.instances.NodeMappableFinder -import amf.aml.client.scala.model.document.Dialect -import amf.aml.client.scala.model.domain.{DialectDomainElement, NodeMappable} +import amf.core.internal.render.emitters.EntryEmitter +import org.mulesoft.common.client.lexical.Position import org.yaml.model.YDocument.EntryBuilder -case class NodeMappingsEntryEmitter(dialect: Dialect, - nodeMappingDeclarations: Seq[NodeMappable.AnyNodeMappable], - aliases: Map[String, (String, String)], - ordering: SpecOrdering)(implicit val nodeMappableFinder: NodeMappableFinder) +case class NodeMappingsEntryEmitter( + dialect: Dialect, + nodeMappingDeclarations: Seq[NodeMappable.AnyNodeMappable], + aliases: Map[String, (String, String)], + ordering: SpecOrdering +)(implicit val nodeMappableFinder: NodeMappableFinder) extends EntryEmitter with GroupPosition { override def emit(b: EntryBuilder): Unit = { b.entry( - "nodeMappings", - _.obj { b => - val nodeMappingEmitters = nodeMappingDeclarations.map { n => - NodeMappingEmitter(dialect, n, ordering, aliases) - } - traverse(ordering.sorted(nodeMappingEmitters), b) + "nodeMappings", + _.obj { b => + val nodeMappingEmitters = nodeMappingDeclarations.map { n => + NodeMappingEmitter(dialect, n, ordering, aliases) } + traverse(ordering.sorted(nodeMappingEmitters), b) + } ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/PosExtractor.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/PosExtractor.scala index d2518f9d..655c1053 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/PosExtractor.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/PosExtractor.scala @@ -2,9 +2,9 @@ package amf.aml.internal.render.emitters.dialects import amf.core.internal.metamodel.Field import amf.core.client.scala.model.domain.DomainElement -import amf.core.client.common.position.Position -import amf.core.client.common.position.Position.ZERO import amf.aml.internal.render.emitters.dialects.FieldEntryImplicit._ +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO trait PosExtractor { def fieldPos(element: DomainElement, field: Field): Position = { diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/PropertyMappingEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/PropertyMappingEmitter.scala index b14d42af..96cc2137 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/PropertyMappingEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/PropertyMappingEmitter.scala @@ -1,17 +1,19 @@ package amf.aml.internal.render.emitters.dialects -import amf.core.client.common.position.Position -import amf.core.client.common.position.Position.ZERO +import amf.aml.client.scala.model.document.Dialect +import amf.aml.client.scala.model.domain.{PropertyLikeMapping, PropertyMapping} +import amf.aml.internal.metamodel.domain.{PropertyLikeMappingModel, PropertyMappingModel} +import amf.aml.internal.render.emitters.instances.NodeMappableFinder import amf.core.client.scala.model.domain.AmfScalar import amf.core.client.scala.vocabulary.Namespace import amf.core.internal.annotations.LexicalInformation -import amf.core.internal.render.BaseEmitters.{ArrayEmitter, MapEntryEmitter, ScalarEmitter} +import amf.core.internal.parser.domain.{Annotations, FieldEntry} +import amf.core.internal.render.BaseEmitters.{MapEntryEmitter, ScalarEmitter, pos, traverse} import amf.core.internal.render.SpecOrdering import amf.core.internal.render.emitters.EntryEmitter -import amf.aml.internal.render.emitters.instances.NodeMappableFinder -import amf.aml.internal.metamodel.domain.{PropertyLikeMappingModel, PropertyMappingModel} -import amf.aml.client.scala.model.document.Dialect -import amf.aml.client.scala.model.domain.{PropertyLikeMapping, PropertyMapping} +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO +import org.mulesoft.common.collections.FilterType import org.yaml.model.YDocument.EntryBuilder import org.yaml.model.YType @@ -19,7 +21,8 @@ case class PropertyRangeEmitters[T <: PropertyLikeMappingModel]( dialect: Dialect, propertyMapping: PropertyLikeMapping[T], ordering: SpecOrdering, - aliases: Map[String, (String, String)])(implicit val nodeMappableFinder: NodeMappableFinder) + aliases: Map[String, (String, String)] +)(implicit val nodeMappableFinder: NodeMappableFinder) extends AliasesConsumer with PosExtractor { @@ -72,9 +75,12 @@ case class PropertyRangeEmitters[T <: PropertyLikeMappingModel]( else if (targets.size > 1) emitters ++= Seq(new EntryEmitter { override def emit(b: EntryBuilder): Unit = - b.entry("range", _.list { b => - targets.foreach(target => ScalarEmitter(AmfScalar(target)).emit(b)) - }) + b.entry( + "range", + _.list { b => + targets.foreach(target => ScalarEmitter(AmfScalar(target)).emit(b)) + } + ) override def position(): Position = pos }) } @@ -87,7 +93,8 @@ case class PropertyLikeMappingEmitter[T <: PropertyLikeMappingModel]( dialect: Dialect, propertyLikeMapping: PropertyLikeMapping[T], ordering: SpecOrdering, - aliases: Map[String, (String, String)])(implicit val nodeMappableFinder: NodeMappableFinder) + aliases: Map[String, (String, String)] +)(implicit val nodeMappableFinder: NodeMappableFinder) extends AliasesConsumer with PosExtractor with DiscriminatorEmitter { @@ -107,15 +114,6 @@ case class PropertyLikeMappingEmitter[T <: PropertyLikeMappingModel]( result ++= Seq(MapEntryEmitter("unique", value.toString, YType.Bool, pos)) } - propertyLikeMapping.fields.entry(PropertyMappingModel.MinCount) foreach { entry => - val value = entry.value.value.asInstanceOf[AmfScalar].value - val pos = fieldPos(propertyLikeMapping, entry.field) - value match { - case 0 => result ++= Seq(MapEntryEmitter("mandatory", "false", YType.Bool, pos)) - case 1 => result ++= Seq(MapEntryEmitter("mandatory", "true", YType.Bool, pos)) - } - } - propertyLikeMapping.fields.entry(PropertyMappingModel.Pattern) foreach { entry => val value = entry.value.value.asInstanceOf[AmfScalar].value.toString val pos = fieldPos(propertyLikeMapping, entry.field) @@ -147,7 +145,7 @@ case class PropertyLikeMappingEmitter[T <: PropertyLikeMappingModel]( } propertyLikeMapping.fields.entry(PropertyMappingModel.Enum) foreach { entry => - result ++= Seq(ArrayEmitter("enum", entry, ordering)) + result ++= Seq(EnumEmitter(entry, ordering)) } propertyLikeMapping.fields.entry(PropertyMappingModel.ExternallyLinkable) foreach { entry => @@ -159,72 +157,138 @@ case class PropertyLikeMappingEmitter[T <: PropertyLikeMappingModel]( } } + result ++= MandatoryEmitter(propertyLikeMapping).emitters() result ++= emitDiscriminator(propertyLikeMapping) result } } +case class EnumEmitter(entry: FieldEntry, ordering: SpecOrdering) extends EntryEmitter { + override def emit(b: EntryBuilder): Unit = { + b.entry( + "enum", + _.list { b => + val scalars = emitters(entry.arrayValues) + traverse(ordering.sorted(scalars), b) + } + ) + } + + private def emitters(values: Seq[Any]): Seq[ScalarEmitter] = + values + .filterType[AmfScalar] + .map { scalar => + val tagType = scalar.value match { + case _: Double => YType.Float + case _: Integer => YType.Int + case _: Boolean => YType.Bool + case _ => YType.Str + } + ScalarEmitter(scalar, tagType) + } + + override def position(): Position = pos(entry.value.annotations) +} + +case class MandatoryEmitter[T <: PropertyLikeMappingModel](propertyMapping: PropertyLikeMapping[T]) + extends PosExtractor { + + def emitters(): Seq[EntryEmitter] = { + + var emitters: Seq[EntryEmitter] = Seq() + + propertyMapping.mandatory().option() match { + case Some(mandatory) => + val mandatoryPos = fieldPos(propertyMapping, PropertyMappingModel.Mandatory) + propertyMapping.minCount().option() match { + case Some(minCount) => + val minCountPos = fieldPos(propertyMapping, PropertyMappingModel.MinCount) + emitters ++= Seq( + MapEntryEmitter("minItems", minCount.toString, YType.Int, minCountPos), + MapEntryEmitter("mandatory", mandatory.toString, YType.Bool, mandatoryPos) + ) + case None => Seq(MapEntryEmitter("mandatory", mandatory.toString, YType.Bool, mandatoryPos)) + } + case None => + propertyMapping.minCount().option() match { + case Some(minCount) => + val minCountPos = fieldPos(propertyMapping, PropertyMappingModel.MinCount) + emitters ++= Seq(MapEntryEmitter("mandatory", (minCount == 1).toString, YType.Bool, minCountPos)) + case None => // Nothing to do + } + } + + emitters + } +} + case class PropertyMappingEmitter( dialect: Dialect, propertyMapping: PropertyMapping, ordering: SpecOrdering, - aliases: Map[String, (String, String)])(implicit val nodeMappableFinder: NodeMappableFinder) + aliases: Map[String, (String, String)] +)(implicit val nodeMappableFinder: NodeMappableFinder) extends EntryEmitter with DiscriminatorEmitter with AliasesConsumer - with PosExtractor { + with PosExtractor + with DefaultFacetEmission { override def emit(b: EntryBuilder): Unit = { b.entry( - propertyMapping.name().value(), - _.obj { b => - var emitters: Seq[EntryEmitter] = - PropertyLikeMappingEmitter(dialect, propertyMapping, ordering, aliases).emitters + propertyMapping.name().value(), + _.obj { b => + var emitters: Seq[EntryEmitter] = + PropertyLikeMappingEmitter(dialect, propertyMapping, ordering, aliases).emitters - propertyMapping.mergePolicy.option().foreach { policy => - val pos = fieldPos(propertyMapping, PropertyMappingModel.MergePolicy) - emitters ++= Seq( - new MapEntryEmitter("patch", policy, YType.Str, pos) - ) - } + propertyMapping.mergePolicy.option().foreach { policy => + val pos = fieldPos(propertyMapping, PropertyMappingModel.MergePolicy) + emitters ++= Seq( + new MapEntryEmitter("patch", policy, YType.Str, pos) + ) + } - propertyMapping - .mapKeyProperty() - .option() - .fold({ - propertyMapping.mapTermKeyProperty().option().foreach { term => - val pos = fieldPos(propertyMapping, PropertyMappingModel.MapTermKeyProperty) - aliasFor(term) match { - case Some(propertyId) => emitters ++= Seq(MapEntryEmitter("mapTermKey", propertyId, YType.Str, pos)) - case _ => - } + propertyMapping + .mapKeyProperty() + .option() + .fold({ + propertyMapping.mapTermKeyProperty().option().foreach { term => + val pos = fieldPos(propertyMapping, PropertyMappingModel.MapTermKeyProperty) + aliasFor(term) match { + case Some(propertyId) => emitters ++= Seq(MapEntryEmitter("mapTermKey", propertyId, YType.Str, pos)) + case _ => } - })({ value => - val pos = fieldPos(propertyMapping, PropertyMappingModel.MapKeyProperty) - emitters ++= Seq(MapEntryEmitter("mapKey", value, YType.Str, pos)) - }) - - propertyMapping - .mapValueProperty() - .option() - .fold({ - propertyMapping.mapTermValueProperty().option().foreach { term => - val pos = fieldPos(propertyMapping, PropertyMappingModel.MapTermValueProperty) - aliasFor(term) match { - case Some(propertyId) => - emitters ++= Seq(MapEntryEmitter("mapTermValue", propertyId, YType.Str, pos)) - case _ => - } + } + })({ value => + val pos = fieldPos(propertyMapping, PropertyMappingModel.MapKeyProperty) + emitters ++= Seq(MapEntryEmitter("mapKey", value, YType.Str, pos)) + }) + + propertyMapping + .mapValueProperty() + .option() + .fold({ + propertyMapping.mapTermValueProperty().option().foreach { term => + val pos = fieldPos(propertyMapping, PropertyMappingModel.MapTermValueProperty) + aliasFor(term) match { + case Some(propertyId) => + emitters ++= Seq(MapEntryEmitter("mapTermValue", propertyId, YType.Str, pos)) + case _ => } - })({ value => - val pos = fieldPos(propertyMapping, PropertyMappingModel.MapValueProperty) - emitters ++= Seq(MapEntryEmitter("mapValue", value, YType.Str, pos)) - }) + } + })({ value => + val pos = fieldPos(propertyMapping, PropertyMappingModel.MapValueProperty) + emitters ++= Seq(MapEntryEmitter("mapValue", value, YType.Str, pos)) + }) - ordering.sorted(emitters).foreach(_.emit(b)) - } + emitters ++= emitDefault(propertyMapping) + + ordering.sorted(emitters).foreach(_.emit(b)) + } ) } - override def position(): Position = - propertyMapping.annotations.find(classOf[LexicalInformation]).map(_.range.start).getOrElse(ZERO) + private def position(annotations: Annotations): Position = + annotations.find(classOf[LexicalInformation]).map(_.range.start).getOrElse(ZERO) + + override def position(): Position = position(propertyMapping.annotations) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/RamlDialectLibraryEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/RamlDialectLibraryEmitter.scala index cc879500..6578aaf9 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/RamlDialectLibraryEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/RamlDialectLibraryEmitter.scala @@ -1,37 +1,31 @@ package amf.aml.internal.render.emitters.dialects -import amf.core.internal.annotations.Aliases.{Alias, FullUrl, ImportLocation} -import amf.core.internal.render.BaseEmitters.{MapEntryEmitter, traverse} -import amf.core.internal.render.SpecOrdering.Lexical +import amf.aml.client.scala.model.document.{Dialect, DialectLibrary} +import amf.aml.internal.metamodel.document.DialectModel +import amf.aml.internal.render.emitters.dialects.FieldEntryImplicit.FieldEntryWithPosition +import amf.aml.internal.render.emitters.instances.NodeMappableFinder +import amf.core.internal.annotations.Aliases.{Alias, ImportLocation} +import amf.core.internal.render.BaseEmitters.MapEntryEmitter import amf.core.internal.render.SpecOrdering +import amf.core.internal.render.SpecOrdering.Lexical import amf.core.internal.render.emitters.EntryEmitter -import amf.core.client.common.position.Position -import amf.core.client.common.position.Position.ZERO -import amf.aml.internal.metamodel.document.DialectModel -import amf.aml.client.scala.model.document.{Dialect, DialectLibrary} +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO import org.yaml.model.YDocument import org.yaml.model.YDocument.EntryBuilder -import amf.aml.internal.render.emitters.dialects.FieldEntryImplicit.FieldEntryWithPosition -import amf.aml.internal.render.emitters.instances.NodeMappableFinder -case class RamlDialectLibraryEmitter(library: DialectLibrary)(implicit val nodeMappableFinder: NodeMappableFinder) - extends DialectDocumentsEmitters { +case class RamlDialectLibraryEmitter(library: DialectLibrary, document: DocumentCreator)(implicit + val nodeMappableFinder: NodeMappableFinder +) extends DialectDocumentsEmitters { val ordering: SpecOrdering = Lexical override val dialect: Dialect = toDialect(library) - val aliases - : Map[RefKey, (Alias, ImportLocation)] = buildReferenceAliasIndexFrom(dialect) ++ buildExternalsAliasIndexFrom( - dialect) + val aliases: Map[RefKey, (Alias, ImportLocation)] = + buildReferenceAliasIndexFrom(dialect) ++ buildExternalsAliasIndexFrom(dialect) def emitDialectLibrary(): YDocument = { val content: Seq[EntryEmitter] = rootLevelEmitters(ordering) ++ dialectEmitters(ordering) - - YDocument(b => { - b.comment("%Library / Dialect 1.0") - b.obj { b => - traverse(ordering.sorted(content), b) - } - }) + document(ordering.sorted(content)) } protected def toDialect(library: DialectLibrary): Dialect = { diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/ReferenceEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/ReferenceEmitter.scala index b0e6ea70..9b11d7f9 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/ReferenceEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/ReferenceEmitter.scala @@ -1,12 +1,12 @@ package amf.aml.internal.render.emitters.dialects -import amf.core.client.common.position.Position -import amf.core.client.common.position.Position.ZERO +import amf.aml.client.scala.model.document.Vocabulary import amf.core.client.scala.model.document.DeclaresModel import amf.core.internal.render.BaseEmitters.MapEntryEmitter import amf.core.internal.render.SpecOrdering import amf.core.internal.render.emitters.EntryEmitter -import amf.aml.client.scala.model.document.Vocabulary +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO import org.yaml.model.YDocument.EntryBuilder case class ReferenceEmitter(reference: DeclaresModel, ordering: SpecOrdering, aliases: Map[String, (String, String)]) diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/ReferencesEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/ReferencesEmitter.scala index 3029d213..57e55565 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/ReferencesEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/ReferencesEmitter.scala @@ -1,12 +1,12 @@ package amf.aml.internal.render.emitters.dialects -import amf.core.client.common.position.Position -import amf.core.client.common.position.Position.ZERO +import amf.aml.internal.annotations.AliasesLocation import amf.core.client.scala.model.document.{BaseUnit, DeclaresModel} import amf.core.internal.render.BaseEmitters.traverse import amf.core.internal.render.SpecOrdering import amf.core.internal.render.emitters.EntryEmitter -import amf.aml.internal.annotations.AliasesLocation +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO import org.yaml.model.YDocument.EntryBuilder case class ReferencesEmitter(baseUnit: BaseUnit, ordering: SpecOrdering, aliases: Map[String, (String, String)]) @@ -14,9 +14,12 @@ case class ReferencesEmitter(baseUnit: BaseUnit, ordering: SpecOrdering, aliases val modules: Seq[BaseUnit with DeclaresModel] = baseUnit.references.collect({ case m: DeclaresModel => m }) override def emit(b: EntryBuilder): Unit = { if (modules.nonEmpty) { - b.entry("uses", _.obj { b => - traverse(ordering.sorted(modules.map(r => ReferenceEmitter(r, ordering, aliases))), b) - }) + b.entry( + "uses", + _.obj { b => + traverse(ordering.sorted(modules.map(r => ReferenceEmitter(r, ordering, aliases))), b) + } + ) } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/RootDocumentModelEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/RootDocumentModelEmitter.scala index 9083e4ef..eaf8a2ba 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/RootDocumentModelEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/dialects/RootDocumentModelEmitter.scala @@ -1,19 +1,19 @@ package amf.aml.internal.render.emitters.dialects -import amf.core.client.common.position.Position -import amf.core.client.common.position.Position.ZERO +import amf.aml.client.scala.model.document.Dialect +import amf.aml.client.scala.model.domain.DocumentMapping +import amf.aml.internal.render.emitters.instances.NodeMappableFinder import amf.core.internal.annotations.LexicalInformation import amf.core.internal.render.BaseEmitters.{MapEntryEmitter, traverse} import amf.core.internal.render.SpecOrdering import amf.core.internal.render.emitters.EntryEmitter -import amf.aml.internal.render.emitters.instances.NodeMappableFinder -import amf.aml.client.scala.model.document.Dialect -import amf.aml.client.scala.model.domain.DocumentMapping +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO import org.yaml.model.YDocument.EntryBuilder case class RootDocumentModelEmitter(dialect: Dialect, ordering: SpecOrdering, aliases: Map[String, (String, String)])( - implicit val nodeMappableFinder: NodeMappableFinder) - extends EntryEmitter + implicit val nodeMappableFinder: NodeMappableFinder +) extends EntryEmitter with AliasesConsumer { val mapping: DocumentMapping = dialect.documents().root() var emitters: Seq[EntryEmitter] = Seq() @@ -38,9 +38,12 @@ case class RootDocumentModelEmitter(dialect: Dialect, ordering: SpecOrdering, al emitters ++= Seq(new EntryEmitter { override def emit(b: EntryBuilder): Unit = { - b.entry("declares", _.obj { b => - traverse(sortedNodes, b) - }) + b.entry( + "declares", + _.obj { b => + traverse(sortedNodes, b) + } + ) } override def position(): Position = { @@ -48,9 +51,12 @@ case class RootDocumentModelEmitter(dialect: Dialect, ordering: SpecOrdering, al } }) } - b.entry("root", _.obj { b => - traverse(ordering.sorted(emitters), b) - }) + b.entry( + "root", + _.obj { b => + traverse(ordering.sorted(emitters), b) + } + ) } override def position(): Position = diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/AmlEmittersHelper.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/AmlEmittersHelper.scala index d36cb1f2..de1951af 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/AmlEmittersHelper.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/AmlEmittersHelper.scala @@ -1,24 +1,25 @@ package amf.aml.internal.render.emitters.instances import amf.aml.client.scala.AMLConfiguration +import amf.aml.client.scala.model.document.{Dialect, ExternalContext} +import amf.aml.client.scala.model.domain.NodeMappable.AnyNodeMappable +import amf.aml.client.scala.model.domain.NodeMapping import amf.aml.internal.parse.plugin.AMLDialectInstanceParsingPlugin -import amf.core.client.common.position.Position -import amf.core.internal.annotations.Aliases.{Alias, FullUrl, ImportLocation, RefId} -import amf.core.internal.annotations.{Aliases, LexicalInformation, ReferencedInfo} -import amf.core.internal.render.BaseEmitters.traverse -import amf.core.internal.render.SpecOrdering +import amf.aml.internal.render.emitters.common.{ExternalEmitter, IdCounter} import amf.core.client.scala.model.document.{BaseUnit, DeclaresModel} import amf.core.client.scala.model.domain.AmfObject -import amf.core.client.common.position.Position.ZERO import amf.core.client.scala.parse.document.ParserContext +import amf.core.internal.annotations.Aliases.{Alias, FullUrl, ImportLocation} +import amf.core.internal.annotations.{Aliases, LexicalInformation, ReferencedInfo} +import amf.core.internal.render.BaseEmitters.traverse +import amf.core.internal.render.SpecOrdering import amf.core.internal.render.emitters.EntryEmitter -import amf.aml.internal.render.emitters.common.{ExternalEmitter, IdCounter} -import amf.aml.client.scala.model.document.{Dialect, DialectLibrary, ExternalContext} -import amf.aml.client.scala.model.domain.{NodeMappable, NodeMapping, UnionNodeMapping} -import org.yaml.model.YDocument.EntryBuilder import amf.core.internal.utils.Regexes.Path -import amf.aml.client.scala.model.domain.NodeMappable.AnyNodeMappable +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO +import org.mulesoft.common.collections.FilterType import org.mulesoft.common.core.CachedFunction import org.mulesoft.common.functional.MonadInstances.identityMonad +import org.yaml.model.YDocument.EntryBuilder import scala.collection.mutable @@ -27,18 +28,35 @@ trait NodeMappableFinder { } object DefaultNodeMappableFinder { + def apply(dialect: Dialect) = new DefaultNodeMappableFinder(computeReferencesTree(dialect)) def apply(dialects: Seq[Dialect]) = new DefaultNodeMappableFinder(dialects) def apply(ctx: ParserContext) = { - val knownDialects = ctx.config.sortedParsePlugins.collect { - case plugin: AMLDialectInstanceParsingPlugin => plugin.dialect + val knownDialects = ctx.config.sortedRootParsePlugins.collect { case plugin: AMLDialectInstanceParsingPlugin => + plugin.dialect } new DefaultNodeMappableFinder(knownDialects) } + def apply(config: AMLConfiguration) = { val knownDialects = config.configurationState().getDialects() new DefaultNodeMappableFinder(knownDialects) } + def empty() = new DefaultNodeMappableFinder(Seq.empty) + + private def computeReferencesTree(from: Dialect): List[Dialect] = { + val collector = mutable.Map[String, Dialect]() + computeReferencesTree(from, collector) + collector.values.toList + } + + private def computeReferencesTree(from: Dialect, acc: mutable.Map[String, Dialect]): Unit = { + acc.put(from.id, from) + from.references + .filterType[Dialect] + .filter(dialect => !acc.contains(dialect.id)) + .foreach(dialect => computeReferencesTree(dialect, acc)) + } } case class DefaultNodeMappableFinder(dialects: Seq[Dialect]) extends NodeMappableFinder { @@ -49,8 +67,8 @@ case class DefaultNodeMappableFinder(dialects: Seq[Dialect]) extends NodeMappabl .map { dialect => (dialect, dialect.declares.find(_.id == nodeMappableId)) } - .collectFirst { - case (dialect, Some(nodeMapping: NodeMapping)) => (dialect, nodeMapping) + .collectFirst { case (dialect, Some(nodeMapping: NodeMapping)) => + (dialect, nodeMapping) } } @@ -69,17 +87,16 @@ trait DialectEmitterHelper { val idCounter = new IdCounter() unit.references.toStream .filter(_.isInstanceOf[DeclaresModel]) - .map { - case m: DeclaresModel => - val key = referenceIndexKeyFor(m) - val importLocation = getImportLocation(unit, m) - aliases.get(key) match { - case Some(alias) => - key -> (alias, importLocation) - case None => - val generatedAlias = idCounter.genId("uses") - key -> (generatedAlias, importLocation) - } + .map { case m: DeclaresModel => + val key = referenceIndexKeyFor(m) + val importLocation = getImportLocation(unit, m) + aliases.get(key) match { + case Some(alias) => + key -> (alias, importLocation) + case None => + val generatedAlias = idCounter.genId("uses") + key -> (generatedAlias, importLocation) + } } .toMap } @@ -88,9 +105,8 @@ trait DialectEmitterHelper { unit.annotations .find(classOf[Aliases]) .map { aliasesAnnotation => - aliasesAnnotation.aliases.map { - case (alias, ReferencedInfo(_, fullUrl, _)) => - fullUrl -> alias + aliasesAnnotation.aliases.map { case (alias, ReferencedInfo(_, fullUrl, _)) => + fullUrl -> alias }.toMap } .getOrElse(Map.empty) @@ -128,18 +144,21 @@ trait AmlEmittersHelper extends DialectEmitterHelper { if (model.externals.nonEmpty) { Seq(new EntryEmitter { override def emit(b: EntryBuilder): Unit = { - b.entry("$external", _.obj({ b => - traverse(ordering.sorted(model.externals.map(external => ExternalEmitter(external, ordering))), b) - })) + b.entry( + "$external", + _.obj({ b => + traverse(ordering.sorted(model.externals.map(external => ExternalEmitter(external, ordering))), b) + }) + ) } override def position(): Position = { model.externals - .map( - e => - e.annotations - .find(classOf[LexicalInformation]) - .map(_.range.start)) + .map(e => + e.annotations + .find(classOf[LexicalInformation]) + .map(_.range.start) + ) .filter(_.nonEmpty) .map(_.get) .sortBy(_.line) @@ -153,57 +172,11 @@ trait AmlEmittersHelper extends DialectEmitterHelper { } type NodeMappingId = String - val nodeMappingCache: mutable.HashMap[NodeMappingId, (Dialect, NodeMappable)] = mutable.HashMap.empty - - def findNodeMappingById(nodeMappingId: NodeMappingId): (Dialect, NodeMappable) = { - nodeMappingCache - .get(nodeMappingId) - .orElse(maybeFindNodeMappingById(nodeMappingId)) match { - case Some(result) => - nodeMappingCache(nodeMappingId) = result - result - case None => - throw new Exception(s"Cannot find node mapping $nodeMappingId") - } - } - - protected def findAllNodeMappings(mappableId: String): Seq[NodeMapping] = { - findNodeMappingById(mappableId) match { - case (_, nodeMapping: NodeMapping) => Seq(nodeMapping) - case (_, unionMapping: UnionNodeMapping) => - val mappables = unionMapping.objectRange() map { rangeId => - findNodeMappingById(rangeId.value())._2 - } - mappables.collect { case nodeMapping: NodeMapping => nodeMapping } - case _ => Nil - } - } - - def maybeFindNodeMappingById(nodeMappingId: NodeMappingId): Option[(Dialect, NodeMappable)] = { - val inDialectMapping = dialect.declares - .find { element => - element.id == nodeMappingId - } - .map { nodeMapping => - (dialect, nodeMapping) - } - .asInstanceOf[Option[(Dialect, NodeMappable)]] - .orElse { - dialect.references - .collect { - case lib: DialectLibrary => - lib.declares.find(_.id == nodeMappingId) - } - .collectFirst { - case Some(mapping: NodeMappable) => - (dialect, mapping) - } - } - inDialectMapping orElse { - findNodeInRegistry(nodeMappingId) - } - } + protected val index = DialectIndex(dialect, nodeMappableFinder) - def findNodeInRegistry(nodeMappingId: String): Option[(Dialect, NodeMappable)] = - nodeMappableFinder.findNode(nodeMappingId) + def findAllNodeMappings(mappableId: String): Seq[NodeMapping] = index.findAllNodeMappings(mappableId) + def findNodeMappingById(nodeMappingId: NodeMappingId): (Dialect, AnyNodeMappable) = + index.findNodeMappingById(nodeMappingId) + def maybeFindNodeMappingById(nodeMappingId: NodeMappingId): Option[(Dialect, AnyNodeMappable)] = + index.maybeFindNodeMappingById(nodeMappingId) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/CustomDomainPropertiesEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/CustomDomainPropertiesEmitter.scala new file mode 100644 index 00000000..23e450ae --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/CustomDomainPropertiesEmitter.scala @@ -0,0 +1,58 @@ +package amf.aml.internal.render.emitters.instances + +import amf.aml.client.scala.model.domain.DialectDomainElement +import amf.aml.internal.registries.AMLRegistry +import amf.aml.internal.semantic.SemanticExtensionsFacade +import amf.core.client.scala.config.RenderOptions +import amf.core.client.scala.model.DataType +import amf.core.client.scala.model.domain.extensions.DomainExtension +import amf.core.client.scala.model.domain.{AmfArray, ScalarNode} +import amf.core.internal.metamodel.domain.DomainElementModel +import amf.core.internal.render.BaseEmitters.{MapEntryEmitter, pos} +import amf.core.internal.render.SpecOrdering +import amf.core.internal.render.emitters.EntryEmitter +import org.yaml.model.YDocument.EntryBuilder +import org.yaml.model.{YDocument, YType} + +object CustomDomainPropertiesEmitter { + + def apply(node: DialectDomainElement, registry: AMLRegistry, ordering: SpecOrdering, renderOptions: RenderOptions)( + implicit nodeMappableFinder: NodeMappableFinder + ): Seq[EntryEmitter] = { + node.fields.get(DomainElementModel.CustomDomainProperties) match { + case AmfArray(customDomainProperties, _) => + customDomainProperties.flatMap { + case extension: DomainExtension if Option(extension.extension).isEmpty => + val name = extensionSyntax(extension.name.value()) + SemanticExtensionsFacade(name, registry).render(extension, node.meta.typeIri, ordering, renderOptions) + case domainExtension: DomainExtension => emitScalarExtension(domainExtension) + } + case _ => Nil + } + } + + private def extensionSyntax(name: String): String = s"($name)" + + private def emitScalarExtension(extension: DomainExtension): Seq[EntryEmitter] = { + val extensionName = extension.name.value() + extension.`extension` match { + case s: ScalarNode => + val extensionValue = s.value.value() + val tagType = dataTypeToYamlType(s) + val position = pos(extension.annotations) + Seq(MapEntryEmitter(extensionName, extensionValue, tag = tagType, position = position)) + case _ => Nil + } + } + + private def dataTypeToYamlType(s: ScalarNode) = { + s.dataType.value() match { + case DataType.Integer => YType.Int + case DataType.Float => YType.Float + case DataType.Boolean => YType.Bool + case DataType.Nil => YType.Null + case DataType.DateTime => YType.Timestamp + case _ => YType.Str + } + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DeclarationsGroupEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DeclarationsGroupEmitter.scala index 843eedf1..8180dcf0 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DeclarationsGroupEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DeclarationsGroupEmitter.scala @@ -1,32 +1,31 @@ package amf.aml.internal.render.emitters.instances -import amf.core.internal.annotations.LexicalInformation -import amf.core.internal.render.emitters.EntryEmitter +import amf.aml.client.scala.model.document.{Dialect, DialectInstanceUnit} +import amf.aml.client.scala.model.domain.{DialectDomainElement, NodeMappable, PublicNodeMapping, UnionNodeMapping} +import amf.aml.internal.metamodel.domain.NodeMappableModel +import amf.aml.internal.registries.AMLRegistry import amf.core.client.scala.config.RenderOptions -import amf.core.client.common.position.Position -import amf.core.client.common.position.Position.ZERO +import amf.core.internal.annotations.LexicalInformation import amf.core.internal.render.SpecOrdering -import amf.aml.client.scala.model.document.{Dialect, DialectInstanceUnit} -import amf.aml.client.scala.model.domain.{ - DialectDomainElement, - NodeMappable, - PublicNodeMapping, - UnionNodeMapping -} +import amf.core.internal.render.emitters.EntryEmitter +import amf.core.internal.utils.AmfStrings +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO import org.yaml.model.YDocument.EntryBuilder import org.yaml.model.YNode -import amf.core.internal.utils.AmfStrings -import amf.aml.internal.metamodel.domain.NodeMappableModel -case class DeclarationsGroupEmitter(declared: Seq[DialectDomainElement], - publicNodeMapping: PublicNodeMapping, - nodeMappable: NodeMappable[_ <: NodeMappableModel], - instance: DialectInstanceUnit, - dialect: Dialect, - ordering: SpecOrdering, - declarationsPath: Seq[String], - aliases: Map[String, (String, String)], - keyPropertyId: Option[String] = None, - renderOptions: RenderOptions)(implicit val nodeMappableFinder: NodeMappableFinder) +case class DeclarationsGroupEmitter( + declared: Seq[DialectDomainElement], + publicNodeMapping: PublicNodeMapping, + nodeMappable: NodeMappable[_ <: NodeMappableModel], + instance: DialectInstanceUnit, + dialect: Dialect, + ordering: SpecOrdering, + declarationsPath: Seq[String], + aliases: Map[String, (String, String)], + keyPropertyId: Option[String] = None, + renderOptions: RenderOptions, + registry: AMLRegistry +)(implicit val nodeMappableFinder: NodeMappableFinder) extends EntryEmitter with AmlEmittersHelper { @@ -53,42 +52,48 @@ case class DeclarationsGroupEmitter(declared: Seq[DialectDomainElement], if (declarationsPath.isEmpty) { val declarationKey = publicNodeMapping.name().value() b.entry( - declarationKey, - _.obj { b => - sortedDeclarations().foreach { decl => - val identifier = computeIdentifier(decl) - b.entry( - YNode(identifier), - b => { - val discriminatorProperty = - discriminator.flatMap(_.compute(decl)) - DialectNodeEmitter(decl, - nodeMappable, - instance.references, - dialect, - ordering, - discriminator = discriminatorProperty, - renderOptions = renderOptions).emit(b) - } - ) - } + declarationKey, + _.obj { b => + sortedDeclarations().foreach { decl => + val identifier = computeIdentifier(decl) + b.entry( + YNode(identifier), + b => { + val discriminatorProperty = + discriminator.flatMap(_.compute(decl)) + DialectNodeEmitter( + decl, + nodeMappable, + instance.references, + dialect, + ordering, + discriminator = discriminatorProperty, + renderOptions = renderOptions, + registry = registry + ).emit(b) + } + ) } + } ) } else { b.entry( - declarationsPath.head, - _.obj { b => - DeclarationsGroupEmitter(declared, - publicNodeMapping, - nodeMappable, - instance, - dialect, - ordering, - declarationsPath.tail, - aliases, - keyPropertyId, - renderOptions).emit(b) - } + declarationsPath.head, + _.obj { b => + DeclarationsGroupEmitter( + declared, + publicNodeMapping, + nodeMappable, + instance, + dialect, + ordering, + declarationsPath.tail, + aliases, + keyPropertyId, + renderOptions, + registry + ).emit(b) + } ) } } @@ -104,11 +109,12 @@ case class DeclarationsGroupEmitter(declared: Seq[DialectDomainElement], def sortedDeclarations(): Seq[DialectDomainElement] = { declared.sortBy( - _.annotations - .find(classOf[LexicalInformation]) - .map { lexInfo => - lexInfo.range.start - } - .getOrElse(ZERO)) + _.annotations + .find(classOf[LexicalInformation]) + .map { lexInfo => + lexInfo.range.start + } + .getOrElse(ZERO) + ) } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DialectDomainElementLinkEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DialectDomainElementLinkEmitter.scala new file mode 100644 index 00000000..560ad7ad --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DialectDomainElementLinkEmitter.scala @@ -0,0 +1,56 @@ +package amf.aml.internal.render.emitters.instances + +import amf.aml.client.scala.model.document.DialectInstanceFragment +import amf.aml.client.scala.model.domain.DialectDomainElement +import amf.aml.internal.annotations.{JsonPointerRef, RefInclude} +import amf.core.client.scala.model.document.BaseUnit +import amf.core.internal.annotations.{LexicalInformation, SourceNode} +import amf.core.internal.render.BaseEmitters.TextScalarEmitter +import amf.core.internal.render.emitters.PartEmitter +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO +import org.yaml.model.YDocument.PartBuilder +import org.yaml.model.{YNode, YType} + +case class DialectDomainElementLinkEmitter(node: DialectDomainElement, references: Seq[BaseUnit]) extends PartEmitter { + override def emit(b: PartBuilder): Unit = { + if (node.annotations.contains(classOf[RefInclude])) { + b.obj { m => + m.entry("$include", node.includeName) + } + } else if (node.annotations.contains(classOf[JsonPointerRef])) { + b.obj { m => + m.entry("$ref", node.linkLabel.option().getOrElse(node.linkTarget.get.id)) + } + } else if (isFragmentRef(node, references)) { + b += YNode.include(node.includeName) + } else { + // case of library and declaration references + TextScalarEmitter(node.linkLabel.value(), node.annotations).emit(b) + } + } + + def isFragmentRef(elem: DialectDomainElement, references: Seq[BaseUnit]): Boolean = { + elem.annotations.find(classOf[SourceNode]) match { + case Some(SourceNode(node)) => node.tagType == YType.Include + case None if references.nonEmpty => + elem.linkTarget match { + case Some(domainElement) => + references.exists { + case ref: DialectInstanceFragment => + ref.encodes.id == domainElement.id + case _ => false + } + case _ => + throw new Exception(s"Cannot check fragment for an element without target for element ${elem.id}") + } + case _ => false + } + } + + override def position(): Position = + node.annotations + .find(classOf[LexicalInformation]) + .map(_.range.start) + .getOrElse(ZERO) +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DialectIndex.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DialectIndex.scala new file mode 100644 index 00000000..b16e3c6f --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DialectIndex.scala @@ -0,0 +1,81 @@ +package amf.aml.internal.render.emitters.instances + +import amf.aml.client.scala.model.document.{Dialect, DialectLibrary} +import amf.aml.client.scala.model.domain.NodeMappable.AnyNodeMappable +import amf.aml.client.scala.model.domain.{AnyMapping, NodeMapping, UnionNodeMapping} +import amf.aml.internal.render.emitters.instances.DialectIndex.NodeMappingId + +import scala.collection.mutable + +object DialectIndex { + type NodeMappingId = String + def apply(dialect: Dialect, finder: NodeMappableFinder): DialectIndex = new DialectIndex(dialect, finder) +} + +class DialectIndex(private val dialect: Dialect, private val finder: NodeMappableFinder) { + val cache: mutable.HashMap[NodeMappingId, (Dialect, AnyNodeMappable)] = mutable.HashMap.empty + val compositeCache: mutable.HashMap[Set[String], AnyMapping] = mutable.HashMap.empty + + def findCompositeMapping(components: Set[String]): Option[AnyMapping] = { + compositeCache.get(components) match { + case Some(mapping) => Some(mapping) + case _ => + dialect.declares + .collect { case mapping: AnyMapping if mapping.components.nonEmpty => mapping } + .find(mapping => mapping.components.flatMap(_.option()).toSet.equals(components)) + } + } + + def findNodeMappingById(nodeMappingId: NodeMappingId): (Dialect, AnyNodeMappable) = { + cache + .get(nodeMappingId) + .orElse(maybeFindNodeMappingById(nodeMappingId)) match { + case Some(result) => + cache(nodeMappingId) = result + result + case None => + throw new Exception(s"Cannot find node mapping $nodeMappingId") + } + } + + def findAllNodeMappings(mappableId: String): Seq[NodeMapping] = { + findNodeMappingById(mappableId) match { + case (_, nodeMapping: NodeMapping) => Seq(nodeMapping) ++ anyMappingNodeMappings(nodeMapping) + case (_, unionMapping: UnionNodeMapping) => + val mappables = unionMapping.objectRange() map { rangeId => + findNodeMappingById(rangeId.value())._2 + } + mappables.collect { case nodeMapping: NodeMapping => nodeMapping } ++ anyMappingNodeMappings(unionMapping) + case _ => Nil + } + } + + private def anyMappingNodeMappings(anyMapping: AnyMapping): Seq[NodeMapping] = { + val conditionalFields = + Seq(anyMapping.ifMapping.option(), anyMapping.thenMapping.option(), anyMapping.elseMapping.option()).flatten + val combiningFields = (anyMapping.and ++ anyMapping.or).map(_.value()) + val mappables = (conditionalFields ++ combiningFields).map(id => findNodeMappingById(id)._2) + mappables.collect { case nodeMapping: NodeMapping => nodeMapping } + } + + def maybeFindNodeMappingById(nodeMappingId: NodeMappingId): Option[(Dialect, AnyNodeMappable)] = { + dialect.declares + .find { element => + element.id == nodeMappingId + } + .collect { case mappable: AnyNodeMappable => + (dialect, mappable) + } orElse { + dialect.references + .collect { case lib: DialectLibrary => + lib.declares.find(_.id == nodeMappingId) + } + .collectFirst { case Some(mapping: AnyNodeMappable) => + (dialect, mapping) + } + } orElse findNodeInRegistry(nodeMappingId) + } + + private def findNodeInRegistry(nodeMappingId: String): Option[(Dialect, AnyNodeMappable)] = + finder.findNode(nodeMappingId) +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DialectInstancesEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DialectInstancesEmitter.scala index 4b22f088..1291077d 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DialectInstancesEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DialectInstancesEmitter.scala @@ -1,19 +1,25 @@ package amf.aml.internal.render.emitters.instances -import amf.core.client.common.position.Position -import amf.core.internal.annotations.Aliases.{Alias, ImportLocation, RefId} -import amf.core.internal.render.BaseEmitters._ +import amf.aml.client.scala.model.document._ +import amf.aml.client.scala.model.domain.NodeMappable.AnyNodeMappable +import amf.aml.client.scala.model.domain._ +import amf.aml.internal.registries.AMLRegistry import amf.core.client.scala.config.RenderOptions import amf.core.client.scala.model.document.EncodesModel +import amf.core.internal.annotations.Aliases.{Alias, ImportLocation} +import amf.core.internal.render.BaseEmitters._ import amf.core.internal.render.SpecOrdering import amf.core.internal.render.SpecOrdering.Lexical -import amf.aml.client.scala.model.document._ -import amf.aml.client.scala.model.domain._ +import org.mulesoft.common.client.lexical.Position import org.yaml.model.YDocument import org.yaml.model.YDocument.PartBuilder -case class DialectInstancesEmitter(instance: DialectInstanceUnit, dialect: Dialect, renderOptions: RenderOptions)( - implicit val nodeMappableFinder: NodeMappableFinder) +case class DialectInstancesEmitter( + instance: DialectInstanceUnit, + dialect: Dialect, + renderOptions: RenderOptions, + registry: AMLRegistry +)(implicit val nodeMappableFinder: NodeMappableFinder) extends AmlEmittersHelper { val ordering: SpecOrdering = Lexical @@ -31,6 +37,19 @@ case class DialectInstancesEmitter(instance: DialectInstanceUnit, dialect: Diale }) } + private def findRootNodeMapping(encodesModel: EncodesModel, dialectRoot: String): AnyNodeMappable = { + index.findNodeMappingById(dialectRoot)._2 match { + case union: UnionNodeMapping => index.findNodeMappingById(union.id)._2 + case _ => + val typesToLookup = encodesModel.encodes.meta.typeIris + typesToLookup + .foldLeft[Option[AnyNodeMappable]](None) { (result, typeIri) => + result.orElse(index.maybeFindNodeMappingById(typeIri).map(_._2)) + } + .getOrElse(index.findNodeMappingById(dialectRoot)._2) + } + } + private def emitEncoded(b: PartBuilder, encoded: EncodesModel): Unit = { val schema = s"${dialect.name().value()} ${dialect.version().value()}" @@ -45,11 +64,13 @@ case class DialectInstancesEmitter(instance: DialectInstanceUnit, dialect: Diale } case f: DialectInstanceFragment => b.comment(s"%${f.fragment()} / $schema") - (Nil, - dialect.documents().fragments().find(_.documentName().is(f.fragment().value())).map(_.encoded().value()).get) + ( + Nil, + dialect.documents().fragments().find(_.documentName().is(f.fragment().value())).map(_.encoded().value()).get + ) } - val (_, rootNodeMapping) = findNodeMappingById(root) + val rootNodeMapping = findRootNodeMapping(encoded, root) val discriminator = rootNodeMapping match { case mapping: UnionNodeMapping => Some(DiscriminatorHelper(mapping, this)) @@ -59,15 +80,16 @@ case class DialectInstancesEmitter(instance: DialectInstanceUnit, dialect: Diale val element = encoded.encodes.asInstanceOf[DialectDomainElement] new RootDialectNodeEmitter( - element, - rootNodeMapping, - instance, - dialect, - ordering, - None, - topLevelEmitters = externalEmitters(instance, ordering) ++ entry, - discriminator = discriminator.flatMap(_.compute(element)), - renderOptions = renderOptions + element, + rootNodeMapping, + instance, + dialect, + ordering, + None, + topLevelEmitters = externalEmitters(instance, ordering) ++ entry, + discriminator = discriminator.flatMap(_.compute(element)), + renderOptions = renderOptions, + registry = registry ).emit(b) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DialectNodeEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DialectNodeEmitter.scala index a4a0f34a..e78d3592 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DialectNodeEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DialectNodeEmitter.scala @@ -1,49 +1,50 @@ package amf.aml.internal.render.emitters.instances -import amf.core.client.common.position.Position +import amf.aml.client.scala.model.document.{Dialect, DialectInstanceUnit} +import amf.aml.client.scala.model.domain._ +import amf.aml.internal.annotations.{CustomBase, CustomId} +import amf.aml.internal.metamodel.domain.{DialectDomainElementModel, NodeMappableModel} +import amf.aml.internal.registries.AMLRegistry import amf.core.client.scala.config.RenderOptions +import amf.core.client.scala.model.document.{BaseUnit, DeclaresModel} import amf.core.internal.annotations.Aliases.{Alias, ImportLocation, RefId} -import amf.core.internal.annotations.{LexicalInformation, SourceNode} -import amf.core.internal.render.BaseEmitters._ -import amf.core.internal.render.emitters.{EntryEmitter, PartEmitter} +import amf.core.internal.annotations.LexicalInformation import amf.core.internal.metamodel.Field import amf.core.internal.metamodel.domain.DomainElementModel -import amf.core.client.scala.model.domain.extensions.DomainExtension -import amf.core.client.scala.model.domain.{AmfArray, AmfElement, AmfScalar, ScalarNode} -import amf.core.client.common.position.Position.ZERO -import amf.core.client.scala.model.DataType -import amf.core.client.scala.model.document.{BaseUnit, DeclaresModel} -import amf.core.internal.parser.domain.{Annotations, FieldEntry, Value} +import amf.core.internal.render.BaseEmitters._ import amf.core.internal.render.SpecOrdering -import amf.aml.internal.annotations.{CustomBase, CustomId, JsonPointerRef, RefInclude} -import amf.aml.internal.metamodel.domain.{DialectDomainElementModel, NodeMappableModel} -import amf.aml.client.scala.model.document.{Dialect, DialectInstanceFragment, DialectInstanceUnit} -import amf.aml.client.scala.model.domain._ -import org.mulesoft.common.time.SimpleDateTime -import org.yaml.model.YDocument.{EntryBuilder, PartBuilder} -import org.yaml.model.{YNode, YType} +import amf.core.internal.render.emitters.{EntryEmitter, PartEmitter} +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO +import org.yaml.model.YDocument.PartBuilder import scala.language.existentials -class RootDialectNodeEmitter(node: DialectDomainElement, - nodeMappable: NodeMappable[_ <: NodeMappableModel], - instance: DialectInstanceUnit, - dialect: Dialect, - ordering: SpecOrdering, - keyPropertyId: Option[String] = None, - discriminator: Option[(String, String)] = None, - emitDialect: Boolean = false, - topLevelEmitters: Seq[EntryEmitter] = Nil, - renderOptions: RenderOptions)(implicit nodeMappableFinder: NodeMappableFinder) - extends DialectNodeEmitter(node, - nodeMappable, - instance.references, - dialect, - ordering, - keyPropertyId, - discriminator, - emitDialect, - topLevelEmitters, - renderOptions) { +class RootDialectNodeEmitter( + node: DialectDomainElement, + nodeMappable: NodeMappable[_ <: NodeMappableModel], + instance: DialectInstanceUnit, + dialect: Dialect, + ordering: SpecOrdering, + keyPropertyId: Option[String] = None, + discriminator: Option[(String, String)] = None, + emitDialect: Boolean = false, + topLevelEmitters: Seq[EntryEmitter] = Nil, + renderOptions: RenderOptions, + registry: AMLRegistry +)(implicit nodeMappableFinder: NodeMappableFinder) + extends DialectNodeEmitter( + node, + nodeMappable, + instance.references, + dialect, + ordering, + keyPropertyId, + discriminator, + emitDialect, + topLevelEmitters, + renderOptions, + registry + ) { lazy val referencesAliasIndex: Map[RefId, (Alias, ImportLocation)] = buildReferenceAliasIndexFrom(instance) @@ -71,33 +72,34 @@ class RootDialectNodeEmitter(node: DialectDomainElement, if (root.encoded().value() == node.id) { Nil } else { - root.declaredNodes().foldLeft(Seq[EntryEmitter]()) { - case (acc, publicNodeMapping) => - val publicMappings = findAllNodeMappings(publicNodeMapping.mappedNode().value()).map(_.id).toSet - val declared = model.declares.collect { - case elem: DialectDomainElement if publicMappings.contains(elem.definedBy.id) => elem + root.declaredNodes().foldLeft(Seq[EntryEmitter]()) { case (acc, publicNodeMapping) => + val publicMappings = findAllNodeMappings(publicNodeMapping.mappedNode().value()).map(_.id).toSet + val declared = model.declares.collect { + case elem: DialectDomainElement if publicMappings.contains(elem.definedBy.id) => elem + } + if (declared.nonEmpty) { + findNodeMappingById(publicNodeMapping.mappedNode().value()) match { + case (_, nodeMappable: NodeMappable) => + acc ++ Seq( + DeclarationsGroupEmitter( + declared, + publicNodeMapping, + nodeMappable, + instance, + dialect, + ordering, + docs + .declarationsPath() + .option() + .getOrElse("/") + .split("/"), + referencesAliasIndex, + renderOptions = renderOptions, + registry = registry + ) + ) } - if (declared.nonEmpty) { - findNodeMappingById(publicNodeMapping.mappedNode().value()) match { - case (_, nodeMappable: NodeMappable) => - acc ++ Seq( - DeclarationsGroupEmitter( - declared, - publicNodeMapping, - nodeMappable, - instance, - dialect, - ordering, - docs - .declarationsPath() - .option() - .getOrElse("/") - .split("/"), - referencesAliasIndex, - renderOptions = renderOptions - )) - } - } else acc + } else acc } } } @@ -105,16 +107,19 @@ class RootDialectNodeEmitter(node: DialectDomainElement, } } -case class DialectNodeEmitter(node: DialectDomainElement, - nodeMappable: NodeMappable[_ <: NodeMappableModel], - references: Seq[BaseUnit], - dialect: Dialect, - ordering: SpecOrdering, - keyPropertyId: Option[String] = None, - discriminator: Option[(String, String)] = None, - emitDialect: Boolean = false, - topLevelEmitters: Seq[EntryEmitter] = Nil, - renderOptions: RenderOptions)(implicit val nodeMappableFinder: NodeMappableFinder) +case class DialectNodeEmitter( + node: DialectDomainElement, + nodeMappable: NodeMappable[_ <: NodeMappableModel], + references: Seq[BaseUnit], + dialect: Dialect, + ordering: SpecOrdering, + keyPropertyId: Option[String] = None, + discriminator: Option[(String, String)] = None, + emitDialect: Boolean = false, + topLevelEmitters: Seq[EntryEmitter] = Nil, + renderOptions: RenderOptions, + registry: AMLRegistry +)(implicit val nodeMappableFinder: NodeMappableFinder) extends PartEmitter with AmlEmittersHelper { @@ -129,248 +134,38 @@ case class DialectNodeEmitter(node: DialectDomainElement, def emitters: Seq[EntryEmitter] = { var emitters: Seq[EntryEmitter] = topLevelEmitters - if (emitDialect) { - emitters ++= Seq(MapEntryEmitter("$dialect", nodeMappable.id)) - } - - if (discriminator.isDefined) { - val (discriminatorName, discriminatorValue) = discriminator.get - emitters ++= Seq(MapEntryEmitter(discriminatorName, discriminatorValue)) - } - if (node.annotations.find(classOf[CustomId]).isDefined || renderOptions.isEmitNodeIds) { - val baseId = node.annotations.find(classOf[CustomId]) match { - case Some(customId) if customId.value != "true" => customId.value - case _ => node.id - } - val customId = if (baseId.contains(dialect.location().getOrElse(""))) { - baseId.replace(dialect.id, "") - } else { - baseId - } - emitters ++= Seq(MapEntryEmitter("$id", customId)) - } - - if (node.annotations.find(classOf[CustomBase]).isDefined) { - node.annotations.find(classOf[CustomBase]) match { - case Some(customBase) if customBase.value != "true" => - emitters ++= Seq(MapEntryEmitter("$base", customBase.value)) - case _ => // Nothing - } - } - + if (emitDialect) emitters ++= Seq(MapEntryEmitter("$dialect", nodeMappable.id)) + emitters ++= emitDiscriminator() + emitters ++= emitId() + emitters ++= emitCustomBase() emitters ++= fieldAndExtensionEmitters emitters } private def fieldAndExtensionEmitters: Seq[EntryEmitter] = { - var emitters: Seq[EntryEmitter] = Nil - uniqueFields(node.meta).foreach { - case DomainElementModel.CustomDomainProperties => - node.fields.get(DomainElementModel.CustomDomainProperties) match { - case AmfArray(customDomainProperties, _) => - customDomainProperties.foreach { - case domainExtension: DomainExtension => - val extensionName = domainExtension.name.value() - domainExtension.`extension` match { - case s: ScalarNode => - val extensionValue = s.value.value() - val tagType = s.dataType.value() match { - case DataType.Integer => YType.Int - case DataType.Float => YType.Float - case DataType.Boolean => YType.Bool - case DataType.Nil => YType.Null - case DataType.DateTime => YType.Timestamp - case _ => YType.Str - } - val position = domainExtension.annotations - .find(classOf[LexicalInformation]) - .map(_.range.start) - .getOrElse(Position.ZERO) - emitters ++= Seq( - MapEntryEmitter(extensionName, extensionValue, tag = tagType, position = position)) - case _ => // Ignore - } - - } - case _ => // Ignore - } - - case field => - findPropertyMapping(node, field) foreach { propertyMapping => - if (keyPropertyId.isEmpty || propertyMapping - .nodePropertyMapping() - .value() != keyPropertyId.get) { - - val key = propertyMapping.name().value() - val propertyClassification = propertyMapping.classification() - - val nextEmitter: Seq[EntryEmitter] = - node.fields.getValueAsOption(field) match { - case Some(entry) if entry.value.isInstanceOf[AmfScalar] => - val scalar = entry.value.asInstanceOf[AmfScalar] - emitScalar(key, field, scalar, Some(entry.annotations)) - - case Some(entry) - if entry.value - .isInstanceOf[AmfArray] && propertyClassification == LiteralPropertyCollection => - val array = entry.value.asInstanceOf[AmfArray] - emitScalarArray(key, field, array, Some(entry.annotations)) - - case Some(entry) - if entry.value - .isInstanceOf[DialectDomainElement] && propertyClassification == ExtensionPointProperty => - val element = entry.value.asInstanceOf[DialectDomainElement] - emitExternalObject(key, element, propertyMapping) - - case Some(entry) - if entry.value - .isInstanceOf[DialectDomainElement] && propertyClassification == ExternalLinkProperty => - val element = entry.value.asInstanceOf[DialectDomainElement] - emitExternalLink(key, element, propertyMapping) - - case Some(entry) - if entry.value - .isInstanceOf[DialectDomainElement] && propertyClassification == ObjectProperty && !propertyMapping.isUnion => - val element = entry.value.asInstanceOf[DialectDomainElement] - val result = emitObjectEntry(key, element, propertyMapping, Some(entry.annotations)) - result - - case Some(entry) - if entry.value - .isInstanceOf[AmfArray] && propertyClassification == ExternalLinkProperty => - val array = entry.value.asInstanceOf[AmfArray] - emitExternalLink(key, array, propertyMapping, Some(entry.annotations)) - - case Some(entry) - if entry.value - .isInstanceOf[AmfArray] && propertyClassification == ObjectPropertyCollection && !propertyMapping.isUnion => - val array = entry.value.asInstanceOf[AmfArray] - emitObjectEntry(key, array, propertyMapping, Some(entry.annotations)) - - case Some(entry) - if entry.value - .isInstanceOf[AmfArray] && propertyClassification == ObjectMapProperty => - val array = entry.value.asInstanceOf[AmfArray] - emitObjectEntry(key, array, propertyMapping, Some(entry.annotations)) - - case Some(entry) - if entry.value - .isInstanceOf[DialectDomainElement] && propertyClassification == ObjectProperty && propertyMapping.isUnion => - val element = entry.value.asInstanceOf[DialectDomainElement] - emitObjectEntry(key, element, propertyMapping) - - case Some(entry) - if entry.value - .isInstanceOf[AmfArray] && propertyClassification == ObjectPropertyCollection && propertyMapping.isUnion => - val array = entry.value.asInstanceOf[AmfArray] - emitObjectEntry(key, array, propertyMapping, Some(entry.annotations)) - - case Some(entry) - if entry.value - .isInstanceOf[AmfArray] && propertyClassification == ObjectPairProperty => - val array = entry.value.asInstanceOf[AmfArray] - emitObjectPairs(key, array, propertyMapping, Some(entry.annotations)) - case None => Nil // ignore - } - emitters ++= nextEmitter - } - } - } - emitters - } - - protected def emitExternalLink(key: String, - target: AmfElement, - propertyMapping: PropertyMapping, - annotations: Option[Annotations] = None): Seq[EntryEmitter] = { - Seq(new EntryEmitter { - override def emit(b: EntryBuilder): Unit = { - b.entry( - key, - (e) => { - target match { - case array: AmfArray => - e.list(l => { - array.values.asInstanceOf[Seq[DialectDomainElement]].foreach { - elem => - if (elem.fields.nonEmpty) { // map reference - nodeMappingForObjectProperty(propertyMapping, elem) match { - case Some(rangeMapping) => - DialectNodeEmitter( - elem, - rangeMapping, - references, - dialect, - ordering, - discriminator = None, - keyPropertyId = keyPropertyId, - renderOptions = renderOptions - ).emit(l) - case _ => // ignore, error - } - } else { // just link - emitCustomId(elem, l) - emitCustomBase(elem, l) - } - } - }) - case element: DialectDomainElement => - emitCustomId(element, e) - emitCustomBase(element, e) - } - } - ) - } - - override def position(): Position = { - annotations - .flatMap(_.find(classOf[LexicalInformation])) - .orElse(target.annotations.find(classOf[LexicalInformation])) - .map(_.range.start) - .getOrElse(ZERO) - } - }) - } - - def emitCustomId(elem: DialectDomainElement, b: PartBuilder): Unit = { - elem.annotations.find(classOf[CustomId]) match { - case Some(customId) if customId.value != "true" => - b.obj { m => - m.entry("$id", customId.value) - } - case Some(_) => - b.obj { m => - m.entry("$id", elem.id) - } - case _ => b += elem.id - } - } - - def emitCustomBase(elem: DialectDomainElement, b: PartBuilder): Unit = { - elem.annotations.find(classOf[CustomBase]) match { - case Some(customBase) if customBase.value != "true" => - b.obj { m => - m.entry("$base", customBase.value) - } - case _ => // Nothing - } - } - - protected def nodeMappingForObjectProperty(propertyMapping: PropertyMapping, - dialectDomainElement: DialectDomainElement): Option[NodeMappable] = { - // this can be multiple mappings if we have a union in the range or a range pointing to a union mapping - val nodeMappings: Seq[NodeMapping] = - propertyMapping.objectRange().flatMap { rangeNodeMapping => - findAllNodeMappings(rangeNodeMapping.value()) + val fieldEmitter = NodeFieldEmitters( + node, + nodeMappable, + references, + dialect, + ordering, + keyPropertyId, + discriminator, + emitDialect, + topLevelEmitters, + renderOptions, + registry + ) + uniqueFields(node.meta).flatMap { field => + field match { + case DomainElementModel.CustomDomainProperties => + CustomDomainPropertiesEmitter(node, registry, ordering, renderOptions) + case field => fieldEmitter.emitField(field) } - nodeMappings.find( - nodeMapping => - dialectDomainElement.meta.`type` - .map(_.iri()) - .exists(i => i == nodeMapping.nodetypeMapping.value() || i == nodeMapping.id)) + }.toSeq } - protected def uniqueFields(meta: DialectDomainElementModel): Iterable[Field] = { + private def uniqueFields(meta: DialectDomainElementModel): Iterable[Field] = { val allFields = meta.fields :+ DomainElementModel.CustomDomainProperties var acc = Map[String, Field]() allFields.foreach { f => @@ -382,174 +177,37 @@ case class DialectNodeEmitter(node: DialectDomainElement, } acc.values } - override def position(): Position = - node.annotations - .find(classOf[LexicalInformation]) - .map(_.range.start) - .getOrElse(ZERO) - - protected def emitScalar(key: String, - field: Field, - scalar: AmfScalar, - annotations: Option[Annotations] = None): Seq[EntryEmitter] = { - val formatted = scalar.value match { - case date: SimpleDateTime => date.toString - case other => other - } - - Seq(ValueEmitter(key, FieldEntry(field, Value(AmfScalar(formatted), annotations.getOrElse(scalar.annotations))))) - } - - protected def emitScalarArray(key: String, - field: Field, - array: AmfArray, - annotations: Option[Annotations]): Seq[EntryEmitter] = - Seq(ArrayEmitter(key, FieldEntry(field, Value(array, annotations.getOrElse(array.annotations))), ordering)) - - protected def emitObjectEntry(key: String, - target: AmfElement, - propertyMapping: PropertyMapping, - annotations: Option[Annotations] = None): Seq[EntryEmitter] = { - - Seq( - DialectObjectEntryEmitter(key, - target, - propertyMapping, - references, - dialect, - ordering, - renderOptions, - annotations)) - } - protected def emitExternalObject(key: String, - element: DialectDomainElement, - propertyMapping: PropertyMapping): Seq[EntryEmitter] = { - val (externalDialect, nextNodeMapping) = findNodeMappingById(element.definedBy.id) - Seq( - EntryPartEmitter(key, - DialectNodeEmitter(element, - nextNodeMapping, - references, - externalDialect, - ordering, - emitDialect = true, - renderOptions = renderOptions))) + private def emitCustomBase(): Seq[EntryEmitter] = { + customBaseOf(node) + .filter(_.value != "true") + .map(base => Seq(MapEntryEmitter("$base", base.value))) + .getOrElse(Nil) } - protected def emitObjectPairs(key: String, - array: AmfArray, - propertyMapping: PropertyMapping, - annotations: Option[Annotations] = None): Seq[EntryEmitter] = { - val keyProperty = propertyMapping.mapTermKeyProperty().value() - val valueProperty = propertyMapping.mapTermValueProperty().value() + private def customBaseOf(node: DialectDomainElement) = node.annotations.find(classOf[CustomBase]) - Seq(new EntryEmitter() { - override def emit(b: EntryBuilder): Unit = { - b.entry( - key, - _.obj { - b => - val sortedElements = array.values.sortBy { elem => - elem.annotations - .find(classOf[LexicalInformation]) - .map(_.range.start) - .getOrElse(ZERO) - } - sortedElements.foreach { - case element: DialectDomainElement => - val keyField = - element.meta.fields.find(_.value.iri() == keyProperty) - val valueField = - element.meta.fields.find(_.value.iri() == valueProperty) - if (keyField.isDefined && valueField.isDefined) { - val keyLiteral = - element.fields.getValueAsOption(keyField.get).map(_.value) - val valueLiteral = element.fields - .getValueAsOption(valueField.get) - .map(_.value) - (keyLiteral, valueLiteral) match { - case (Some(keyScalar: AmfScalar), Some(valueScalar: AmfScalar)) => - MapEntryEmitter(keyScalar.value.toString, valueScalar.value.toString).emit(b) - case _ => - throw new Exception("Cannot generate object pair without scalar values for key and value") - } - } else { - throw new Exception("Cannot generate object pair with undefined key or value") - } - case _ => // ignore - } - } - ) + private def emitId(): Seq[EntryEmitter] = { + if (hasCustomId(node) || renderOptions.isEmitNodeIds) { + val baseId = customIdOf(node) match { + case Some(customId) if customId.value != "true" => customId.value + case _ => node.id } - - override def position(): Position = - annotations - .flatMap(_.find(classOf[LexicalInformation])) - .orElse(array.annotations.find(classOf[LexicalInformation])) - .map(_.range.start) - .getOrElse(ZERO) - }) + val customId = if (baseId.contains(dialect.location().getOrElse(""))) { + baseId.replace(dialect.id, "") + } else { + baseId + } + Seq(MapEntryEmitter("$id", customId)) + } else Nil } - protected def findPropertyMapping(node: DialectDomainElement, field: Field): Option[PropertyMapping] = { - val iri = field.value.iri() - nodeMappable match { - case nodeMapping: NodeMapping => - nodeMapping - .propertiesMapping() - .find(_.nodePropertyMapping().value() == iri) - case unionMapping: UnionNodeMapping => - val rangeIds: Seq[String] = unionMapping.objectRange().map(_.value()) - var nodeMappingsInRange = rangeIds.map { id: String => - findNodeMappingById(id) match { - case (_, nodeMapping: NodeMapping) => Some(nodeMapping) - case _ => None - } - } collect { case Some(nodeMapping: NodeMapping) => nodeMapping } - // we need to do this because the same property (with different ranges) might be defined in multiple node mappings -// val nodeMetaTypes = node.meta.typeIri.map(_ -> true).toMap -// nodeMappingsInRange = nodeMappingsInRange.filter { nodeMapping => nodeMetaTypes.contains(nodeMapping.id) } - nodeMappingsInRange.flatMap(_.propertiesMapping()).find(_.nodePropertyMapping().value() == iri) - } - } + private def customIdOf(node: DialectDomainElement) = node.annotations.find(classOf[CustomId]) -} + private def hasCustomId(node: DialectDomainElement) = customIdOf(node).isDefined -case class DialectDomainElementLinkEmitter(node: DialectDomainElement, references: Seq[BaseUnit]) extends PartEmitter { - override def emit(b: PartBuilder): Unit = { - if (node.annotations.contains(classOf[RefInclude])) { - b.obj { m => - m.entry("$include", node.includeName) - } - } else if (node.annotations.contains(classOf[JsonPointerRef])) { - b.obj { m => - m.entry("$ref", node.linkLabel.option().getOrElse(node.linkTarget.get.id)) - } - } else if (isFragmentRef(node, references)) { - b += YNode.include(node.includeName) - } else { - // case of library and declaration references - TextScalarEmitter(node.linkLabel.value(), node.annotations).emit(b) - } - } - - def isFragmentRef(elem: DialectDomainElement, references: Seq[BaseUnit]): Boolean = { - elem.annotations.find(classOf[SourceNode]) match { - case Some(SourceNode(node)) => node.tagType == YType.Include - case None if references.nonEmpty => - elem.linkTarget match { - case Some(domainElement) => - references.exists { - case ref: DialectInstanceFragment => - ref.encodes.id == domainElement.id - case _ => false - } - case _ => - throw new Exception(s"Cannot check fragment for an element without target for element ${elem.id}") - } - case _ => false - } + private def emitDiscriminator(): Seq[EntryEmitter] = { + discriminator.map { case (name, value) => Seq(MapEntryEmitter(name, value)) }.getOrElse(Seq.empty) } override def position(): Position = @@ -558,117 +216,3 @@ case class DialectDomainElementLinkEmitter(node: DialectDomainElement, reference .map(_.range.start) .getOrElse(ZERO) } - -private case class DialectObjectEntryEmitter( - key: String, - target: AmfElement, - propertyMapping: PropertyMapping, - references: Seq[BaseUnit], - dialect: Dialect, - ordering: SpecOrdering, - renderOptions: RenderOptions, - annotations: Option[Annotations] = None)(implicit val nodeMappableFinder: NodeMappableFinder) - extends EntryEmitter - with AmlEmittersHelper { - // this can be multiple mappings if we have a union in the range or a range pointing to a union mapping - val nodeMappings: Seq[NodeMapping] = - propertyMapping.objectRange().flatMap { rangeNodeMapping => - findAllNodeMappings(rangeNodeMapping.value()) - } - - // val key property id, so we can pass it to the nested emitter and it is not emitted - val keyPropertyId: Option[String] = propertyMapping.mapTermKeyProperty().option() - - // lets first extract the target values to emit, always as an array - val elements: Seq[DialectDomainElement] = target match { - case array: AmfArray => - array.values.asInstanceOf[Seq[DialectDomainElement]] - case element: DialectDomainElement => Seq(element) - } - - val isArray: Boolean = target.isInstanceOf[AmfArray] - val discriminator: DiscriminatorHelper = - DiscriminatorHelper(propertyMapping, this) - - override def emit(b: EntryBuilder): Unit = { - // collect the emitters for each element, based on the available mappings - val mappedElements: Map[DialectNodeEmitter, DialectDomainElement] = - elements.foldLeft(Map[DialectNodeEmitter, DialectDomainElement]()) { - case (acc, dialectDomainElement: DialectDomainElement) => - // Let's see if this element has a discriminator to add - nodeMappings.find( - nodeMapping => - dialectDomainElement.meta.`type` - .map(_.iri()) - .contains(nodeMapping.nodetypeMapping.value())) match { - case Some(nextNodeMapping) => - val nodeEmitter = DialectNodeEmitter( - dialectDomainElement, - nextNodeMapping, - references, - dialect, - ordering, - discriminator = discriminator.compute(dialectDomainElement), - keyPropertyId = keyPropertyId, - renderOptions = renderOptions - ) - acc + (nodeEmitter -> dialectDomainElement) - case _ => - acc // TODO: raise violation - } - case (acc, _) => acc - } - - if (keyPropertyId.isDefined) { - // emit map of nested objects by property - emitMap(b, mappedElements) - } else if (isArray) { - // arrays of objects - emitArray(b, mappedElements) - } else { - // single object - emitSingleElement(b, mappedElements) - } - } - - def emitMap(b: EntryBuilder, mapElements: Map[DialectNodeEmitter, DialectDomainElement]): Unit = { - b.entry( - key, - _.obj { b => - ordering.sorted(mapElements.keys.toSeq).foreach { emitter => - val dialectDomainElement = mapElements(emitter) - val mapKeyField = - dialectDomainElement.meta.fields - .find(_.value - .iri() == propertyMapping.mapTermKeyProperty().value()) - .get - val mapKeyValue = - dialectDomainElement.fields.getValue(mapKeyField).toString - EntryPartEmitter(mapKeyValue, emitter).emit(b) - } - } - ) - } - - def emitArray(b: EntryBuilder, mappedElements: Map[DialectNodeEmitter, DialectDomainElement]): Unit = { - b.entry(key, _.list { b => - ordering.sorted(mappedElements.keys.toSeq).foreach(_.emit(b)) - }) - } - - def emitSingleElement(b: EntryBuilder, mappedElements: Map[DialectNodeEmitter, DialectDomainElement]): Unit = { - mappedElements.keys.headOption.foreach { emitter => - EntryPartEmitter(key, emitter).emit(b) - } - } - - override def position(): Position = { - - annotations - .flatMap(_.find(classOf[LexicalInformation])) - .orElse(target.annotations.find(classOf[LexicalInformation])) - .map(_.range.start) - .getOrElse(ZERO) - } - -} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DialectObjectEntryEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DialectObjectEntryEmitter.scala new file mode 100644 index 00000000..bf58c8d2 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DialectObjectEntryEmitter.scala @@ -0,0 +1,143 @@ +package amf.aml.internal.render.emitters.instances + +import amf.aml.client.scala.model.document.Dialect +import amf.aml.client.scala.model.domain.{DialectDomainElement, NodeMapping, PropertyLikeMapping, PropertyMapping} +import amf.aml.internal.metamodel.domain.PropertyLikeMappingModel +import amf.aml.internal.registries.AMLRegistry +import amf.core.client.scala.config.RenderOptions +import amf.core.client.scala.model.document.BaseUnit +import amf.core.client.scala.model.domain.{AmfArray, AmfElement} +import amf.core.internal.annotations.LexicalInformation +import amf.core.internal.parser.domain.Annotations +import amf.core.internal.render.BaseEmitters.EntryPartEmitter +import amf.core.internal.render.SpecOrdering +import amf.core.internal.render.emitters.EntryEmitter +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO +import org.yaml.model.YDocument.EntryBuilder + +private case class DialectObjectEntryEmitter[M <: PropertyLikeMappingModel]( + key: String, + target: AmfElement, + propertyMapping: PropertyLikeMapping[M], + references: Seq[BaseUnit], + dialect: Dialect, + ordering: SpecOrdering, + renderOptions: RenderOptions, + annotations: Option[Annotations] = None, + registry: AMLRegistry +)(implicit val nodeMappableFinder: NodeMappableFinder) + extends EntryEmitter + with AmlEmittersHelper { + + // this can be multiple mappings if we have a union in the range or a range pointing to a union mapping + val nodeMappings: Seq[NodeMapping] = propertyMapping.objectRange().flatMap { rangeNodeMapping => + findAllNodeMappings(rangeNodeMapping.value()) + } + + // val key property id, so we can pass it to the nested emitter and it is not emitted + val keyPropertyId: Option[String] = propertyMapping match { + case mapping: PropertyMapping => mapping.mapTermKeyProperty().option() + case _ => None + } + + // lets first extract the target values to emit, always as an array + val elements: Seq[DialectDomainElement] = target match { + case array: AmfArray => + array.values.asInstanceOf[Seq[DialectDomainElement]] + case element: DialectDomainElement => Seq(element) + } + + val isArray: Boolean = target.isInstanceOf[AmfArray] + val discriminator: DiscriminatorHelper = + DiscriminatorHelper(propertyMapping, this) + + override def emit(b: EntryBuilder): Unit = { + // collect the emitters for each element, based on the available mappings + val mappedElements: Map[DialectNodeEmitter, DialectDomainElement] = + elements.foldLeft(Map[DialectNodeEmitter, DialectDomainElement]()) { + case (acc, dialectDomainElement: DialectDomainElement) => + // Let's see if this element has a discriminator to add + nodeMappings.find(nodeMapping => + dialectDomainElement.meta.`type` + .map(_.iri()) + .exists(i => i == nodeMapping.nodetypeMapping.value() || i == nodeMapping.id) + ) match { + case Some(nextNodeMapping) => + val nodeEmitter = DialectNodeEmitter( + dialectDomainElement, + nextNodeMapping, + references, + dialect, + ordering, + discriminator = discriminator.compute(dialectDomainElement), + keyPropertyId = keyPropertyId, + renderOptions = renderOptions, + registry = registry + ) + acc + (nodeEmitter -> dialectDomainElement) + case _ => + acc // TODO: raise violation + } + case (acc, _) => acc + } + + if (keyPropertyId.isDefined) { + // emit map of nested objects by property + emitMap(b, mappedElements, keyPropertyId.get) + } else if (isArray) { + // arrays of objects + emitArray(b, mappedElements) + } else { + // single object + emitSingleElement(b, mappedElements) + } + } + + private def emitMap( + b: EntryBuilder, + mapElements: Map[DialectNodeEmitter, DialectDomainElement], + keyPropertyIdValue: String + ): Unit = { + b.entry( + key, + _.obj { b => + ordering.sorted(mapElements.keys.toSeq).foreach { emitter => + val dialectDomainElement = mapElements(emitter) + val mapKeyField = + dialectDomainElement.meta.fields + .find(_.value.iri() == keyPropertyIdValue) + .get + val mapKeyValue = + dialectDomainElement.fields.getValue(mapKeyField).toString + EntryPartEmitter(mapKeyValue, emitter).emit(b) + } + } + ) + } + + def emitArray(b: EntryBuilder, mappedElements: Map[DialectNodeEmitter, DialectDomainElement]): Unit = { + b.entry( + key, + _.list { b => + ordering.sorted(mappedElements.keys.toSeq).foreach(_.emit(b)) + } + ) + } + + def emitSingleElement(b: EntryBuilder, mappedElements: Map[DialectNodeEmitter, DialectDomainElement]): Unit = { + mappedElements.keys.headOption.foreach { emitter => + EntryPartEmitter(key, emitter).emit(b) + } + } + + override def position(): Position = { + + annotations + .flatMap(_.find(classOf[LexicalInformation])) + .orElse(target.annotations.find(classOf[LexicalInformation])) + .map(_.range.start) + .getOrElse(ZERO) + } + +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DiscriminatorHelper.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DiscriminatorHelper.scala index 34eaa96d..116be167 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DiscriminatorHelper.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/DiscriminatorHelper.scala @@ -1,14 +1,11 @@ package amf.aml.internal.render.emitters.instances import amf.aml.internal.metamodel.domain.NodeWithDiscriminatorModel -import amf.aml.client.scala.model.domain.{ - DialectDomainElement, - NodeMapping, - NodeWithDiscriminator, - UnionNodeMapping -} +import amf.aml.client.scala.model.domain.{DialectDomainElement, NodeMapping, NodeWithDiscriminator, UnionNodeMapping} -case class DiscriminatorHelper(mapping: NodeWithDiscriminator[_ <: NodeWithDiscriminatorModel], - dialectEmitter: AmlEmittersHelper) { +case class DiscriminatorHelper( + mapping: NodeWithDiscriminator[_ <: NodeWithDiscriminatorModel], + dialectEmitter: AmlEmittersHelper +) { // maybe we have a discriminator val discriminator: Option[Map[String, String]] = Option(mapping.typeDiscriminator()).orElse { @@ -33,19 +30,17 @@ case class DiscriminatorHelper(mapping: NodeWithDiscriminator[_ <: NodeWithDiscr // we build the discriminator mapping if we have a discriminator val discriminatorMappings: Map[String, NodeMapping] = - discriminator.getOrElse(Map()).foldLeft(Map[String, NodeMapping]()) { - case (acc, (alias, mappingId)) => - dialectEmitter.findNodeMappingById(mappingId) match { - case (_, nodeMapping: NodeMapping) => acc + (alias -> nodeMapping) - case _ => acc // TODO: violation here - } + discriminator.getOrElse(Map()).foldLeft(Map[String, NodeMapping]()) { case (acc, (alias, mappingId)) => + dialectEmitter.findNodeMappingById(mappingId) match { + case (_, nodeMapping: NodeMapping) => acc + (alias -> nodeMapping) + case _ => acc // TODO: violation here + } } def compute(dialectDomainElement: DialectDomainElement): Option[(String, String)] = { val elementTypes = dialectDomainElement.meta.`type`.map(_.iri()) - discriminatorMappings.find { - case (_, discriminatorMapping) => - elementTypes.contains(discriminatorMapping.nodetypeMapping.value()) + discriminatorMappings.find { case (_, discriminatorMapping) => + elementTypes.contains(discriminatorMapping.nodetypeMapping.value()) } match { case Some((alias, _)) => Some((discriminatorName.getOrElse("type"), alias)) diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/ExternalLinkEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/ExternalLinkEmitter.scala new file mode 100644 index 00000000..c37ac420 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/ExternalLinkEmitter.scala @@ -0,0 +1,119 @@ +package amf.aml.internal.render.emitters.instances + +import amf.aml.client.scala.model.document.Dialect +import amf.aml.client.scala.model.domain.{DialectDomainElement, NodeMapping, PropertyLikeMapping} +import amf.aml.internal.annotations.{CustomBase, CustomId} +import amf.aml.internal.metamodel.domain.PropertyLikeMappingModel +import amf.aml.internal.registries.AMLRegistry +import amf.core.client.scala.config.RenderOptions +import amf.core.client.scala.model.document.BaseUnit +import amf.core.client.scala.model.domain.{AmfArray, AmfElement} +import amf.core.internal.annotations.LexicalInformation +import amf.core.internal.parser.domain.Annotations +import amf.core.internal.render.SpecOrdering +import amf.core.internal.render.emitters.EntryEmitter +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO +import org.yaml.model.YDocument +import org.yaml.model.YDocument.PartBuilder + +case class ExternalLinkEmitter[M <: PropertyLikeMappingModel]( + key: String, + dialect: Dialect, + target: AmfElement, + propertyMapping: PropertyLikeMapping[M], + annotations: Option[Annotations] = None, + keyPropertyId: Option[String] = None, + references: Seq[BaseUnit], + ordering: SpecOrdering, + renderOptions: RenderOptions, + registry: AMLRegistry +)(implicit val nodeMappableFinder: NodeMappableFinder) + extends EntryEmitter + with AmlEmittersHelper { + override def emit(b: YDocument.EntryBuilder): Unit = { + b.entry( + key, + (e) => { + target match { + case array: AmfArray => + e.list(l => { + array.values.asInstanceOf[Seq[DialectDomainElement]].foreach { elem => + if (elem.fields.nonEmpty) { // map reference + nodeMappingForObjectProperty(propertyMapping, elem) match { + case Some(rangeMapping) => + DialectNodeEmitter( + elem, + rangeMapping, + references, + dialect, + ordering, + discriminator = None, + keyPropertyId = keyPropertyId, + renderOptions = renderOptions, + registry = registry + ).emit(l) + case _ => // ignore, error + } + } else { // just link + emitCustomId(elem, l) + emitCustomBase(elem, l) + } + } + }) + case element: DialectDomainElement => + emitCustomId(element, e) + emitCustomBase(element, e) + } + } + ) + } + + protected def nodeMappingForObjectProperty( + propertyMapping: PropertyLikeMapping[_], + dialectDomainElement: DialectDomainElement + ): Option[NodeMappable] = { + // this can be multiple mappings if we have a union in the range or a range pointing to a union mapping + val nodeMappings: Seq[NodeMapping] = + propertyMapping.objectRange().flatMap { rangeNodeMapping => + findAllNodeMappings(rangeNodeMapping.value()) + } + nodeMappings.find(nodeMapping => + dialectDomainElement.meta.`type` + .map(_.iri()) + .exists(i => i == nodeMapping.nodetypeMapping.value() || i == nodeMapping.id) + ) + } + + private def emitCustomId(elem: DialectDomainElement, b: PartBuilder): Unit = { + elem.annotations.find(classOf[CustomId]) match { + case Some(customId) if customId.value != "true" => + b.obj { m => + m.entry("$id", customId.value) + } + case Some(_) => + b.obj { m => + m.entry("$id", elem.id) + } + case _ => b += elem.id + } + } + + private def emitCustomBase(elem: DialectDomainElement, b: PartBuilder): Unit = { + elem.annotations.find(classOf[CustomBase]) match { + case Some(customBase) if customBase.value != "true" => + b.obj { m => + m.entry("$base", customBase.value) + } + case _ => // Nothing + } + } + + override def position(): Position = { + annotations + .flatMap(_.find(classOf[LexicalInformation])) + .orElse(target.annotations.find(classOf[LexicalInformation])) + .map(_.range.start) + .getOrElse(ZERO) + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/NodeFieldEmitters.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/NodeFieldEmitters.scala new file mode 100644 index 00000000..f656d8bb --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/NodeFieldEmitters.scala @@ -0,0 +1,243 @@ +package amf.aml.internal.render.emitters.instances + +import amf.aml.client.scala.model.document.Dialect +import amf.aml.client.scala.model.domain._ +import amf.aml.internal.metamodel.domain.{NodeMappableModel, PropertyLikeMappingModel} +import amf.aml.internal.registries.AMLRegistry +import amf.core.client.scala.config.RenderOptions +import amf.core.client.scala.model.document.BaseUnit +import amf.core.client.scala.model.domain.{AmfArray, AmfElement, AmfScalar, DomainElement} +import amf.core.internal.metamodel.Field +import amf.core.internal.parser.domain.{Annotations, FieldEntry, Value} +import amf.core.internal.render.BaseEmitters.{ArrayEmitter, EntryPartEmitter, ValueEmitter} +import amf.core.internal.render.SpecOrdering +import amf.core.internal.render.emitters.EntryEmitter +import org.mulesoft.common.time.SimpleDateTime + +object SemanticExtensionNodeEmitter { + def apply( + node: DomainElement, + nodeMappable: NodeMappable[_ <: NodeMappableModel], + dialect: Dialect, + ordering: SpecOrdering, + renderOptions: RenderOptions, + registry: AMLRegistry, + keyOverride: String + )(implicit finder: NodeMappableFinder): NodeFieldEmitters = { + NodeFieldEmitters( + node, + nodeMappable, + dialect.references, + dialect, + ordering, + None, + None, + emitDialect = false, + topLevelEmitters = Nil, + renderOptions, + registry, + Some(keyOverride) + ) + } +} + +case class NodeFieldEmitters( + node: DomainElement, + nodeMappable: NodeMappable[_ <: NodeMappableModel], + references: Seq[BaseUnit], + dialect: Dialect, + ordering: SpecOrdering, + keyPropertyId: Option[String] = None, + discriminator: Option[(String, String)] = None, + emitDialect: Boolean = false, + topLevelEmitters: Seq[EntryEmitter] = Nil, + renderOptions: RenderOptions, + registry: AMLRegistry, + keyOverride: Option[String] = None +)(implicit val nodeMappableFinder: NodeMappableFinder) + extends AmlEmittersHelper { + + def emitField(field: Field): Option[EntryEmitter] = { + findPropertyMapping(field).filter { mapping => + keyPropertyId.isEmpty || mapping.nodePropertyMapping().value() != keyPropertyId.get + } flatMap { propertyMapping => + val key = keyOverride.getOrElse(propertyMapping.name().value()) + val propertyClassification = propertyMapping.classification() + node.fields + .getValueAsOption(field) + .map { value => + emitterFor(field, propertyMapping, key, propertyClassification, value) + } + } + } + + private def emitterFor( + field: Field, + propertyMapping: PropertyLikeMapping[_ <: PropertyLikeMappingModel], + key: String, + propertyClassification: PropertyClassification, + value: Value + ) = { + (value.value, propertyClassification) match { + case (scalar: AmfScalar, _) => emitScalar(key, field, scalar, Some(value.annotations)) + + case (array: AmfArray, LiteralPropertyCollection) => + emitScalarArray(key, field, array, Some(value.annotations)) + + case (element: DialectDomainElement, ExtensionPointProperty) => emitExternalObject(key, element) + + case (element: DialectDomainElement, ExternalLinkProperty) => + emitExternalLink(key, element, propertyMapping) + + case (element: DialectDomainElement, ObjectProperty) if !propertyMapping.isUnion => + emitObjectEntry(key, element, propertyMapping, Some(value.annotations)) + + case (array: AmfArray, ExternalLinkProperty) => + emitExternalLink(key, array, propertyMapping, Some(value.annotations)) + + case (array: AmfArray, ObjectPropertyCollection) if !propertyMapping.isUnion => + emitObjectEntry(key, array, propertyMapping, Some(value.annotations)) + + case (array: AmfArray, ObjectMapProperty) => + emitObjectEntry(key, array, propertyMapping, Some(value.annotations)) + + case (element: DialectDomainElement, ObjectProperty) if propertyMapping.isUnion => + emitObjectEntry(key, element, propertyMapping) + + case (array: AmfArray, ObjectPropertyCollection) if propertyMapping.isUnion => + emitObjectEntry(key, array, propertyMapping, Some(value.annotations)) + + case (array: AmfArray, ObjectPairProperty) if propertyMapping.isInstanceOf[PropertyMapping] => + emitObjectPairs(key, array, propertyMapping.asInstanceOf[PropertyMapping], Some(value.annotations)) + } + } + + protected def emitExternalLink( + key: String, + target: AmfElement, + propertyMapping: PropertyLikeMapping[_ <: PropertyLikeMappingModel], + annotations: Option[Annotations] = None + ): EntryEmitter = { + + ExternalLinkEmitter( + key, + dialect, + target, + propertyMapping, + annotations, + keyPropertyId, + references, + ordering, + renderOptions, + registry + ) + } + + private def emitScalar( + key: String, + field: Field, + scalar: AmfScalar, + annotations: Option[Annotations] = None + ): EntryEmitter = { + val formatted = scalar.value match { + case date: SimpleDateTime => date.toString + case double: Double => removeMaybeExponential(double) + case other => other + } + + ValueEmitter(key, FieldEntry(field, Value(AmfScalar(formatted), annotations.getOrElse(scalar.annotations)))) + } + + private def emitScalarArray( + key: String, + field: Field, + array: AmfArray, + annotations: Option[Annotations] + ): EntryEmitter = + ArrayEmitter(key, FieldEntry(field, Value(array, annotations.getOrElse(array.annotations))), ordering) + + protected def emitObjectEntry( + key: String, + target: AmfElement, + propertyMapping: PropertyLikeMapping[_ <: PropertyLikeMappingModel], + annotations: Option[Annotations] = None + ): EntryEmitter = { + + DialectObjectEntryEmitter( + key, + target, + propertyMapping, + references, + dialect, + ordering, + renderOptions, + annotations, + registry + ) + } + + protected def emitExternalObject(key: String, element: DialectDomainElement): EntryEmitter = { + val (externalDialect, nextNodeMapping) = findNodeMappingById(element.definedBy.id) + + EntryPartEmitter( + key, + DialectNodeEmitter( + element, + nextNodeMapping, + references, + externalDialect, + ordering, + emitDialect = true, + renderOptions = renderOptions, + registry = registry + ) + ) + } + + private def emitObjectPairs( + key: String, + array: AmfArray, + propertyMapping: PropertyMapping, + annotations: Option[Annotations] = None + ): EntryEmitter = { + ObjectPairEmitter(key, array, propertyMapping, annotations) + } + + private def findPropertyMapping(field: Field): Option[PropertyLikeMapping[_ <: PropertyLikeMappingModel]] = { + val iri = field.value.iri() + nodeMappable match { + case mapping: AnnotationMapping => Some(mapping) + case nodeMapping: NodeMapping => + nodeMapping + .propertiesMapping() + .find(_.nodePropertyMapping().value() == iri) + .orElse(checkRangeIds(anyMappingIds(nodeMapping), iri)) + case unionMapping: UnionNodeMapping => + checkRangeIds(unionMapping.objectRange().map(_.value()) ++ anyMappingIds(unionMapping), iri) + } + } + + private def anyMappingIds(anyMapping: AnyMapping): Seq[String] = { + (Seq(anyMapping.ifMapping.option(), anyMapping.thenMapping.option(), anyMapping.elseMapping.option()).flatten ++ + anyMapping.and ++ anyMapping.or).map(_.toString) + } + + private def checkRangeIds(rangeIds: Seq[String], iri: String): Option[PropertyMapping] = { + val nodeMappingsInRange = rangeIds.map { id: String => + findNodeMappingById(id) match { + case (_, nodeMapping: NodeMapping) => Some(nodeMapping) + case _ => None + } + } collect { case Some(nodeMapping: NodeMapping) => nodeMapping } + // we need to do this because the same property (with different ranges) might be defined in multiple node mappings + // val nodeMetaTypes = node.meta.typeIri.map(_ -> true).toMap + // nodeMappingsInRange = nodeMappingsInRange.filter { nodeMapping => nodeMetaTypes.contains(nodeMapping.id) } + nodeMappingsInRange.flatMap(_.propertiesMapping()).find(_.nodePropertyMapping().value() == iri) + } + + // If the value of a Double is minor to the max value of a Long I will emit it without scientific notation + private def removeMaybeExponential(input: Double): Any = input.toString match { + case exponential if exponential.contains("E") && (input < Long.MaxValue) => input.toLong + case _ => input + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/ObjectPairEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/ObjectPairEmitter.scala new file mode 100644 index 00000000..a886e71a --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/ObjectPairEmitter.scala @@ -0,0 +1,69 @@ +package amf.aml.internal.render.emitters.instances + +import amf.aml.client.scala.model.domain.{DialectDomainElement, PropertyMapping} +import amf.core.client.scala.model.domain.{AmfArray, AmfElement, AmfScalar} +import amf.core.internal.annotations.LexicalInformation +import amf.core.internal.parser.domain.Annotations +import amf.core.internal.render.BaseEmitters.MapEntryEmitter +import amf.core.internal.render.emitters.EntryEmitter +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO +import org.yaml.model.YDocument + +case class ObjectPairEmitter( + key: String, + array: AmfArray, + propertyMapping: PropertyMapping, + annotations: Option[Annotations] = None +) extends EntryEmitter { + override def emit(b: YDocument.EntryBuilder): Unit = { + val keyProperty = propertyMapping.mapTermKeyProperty().value() + val valueProperty = propertyMapping.mapTermValueProperty().value() + b.entry( + key, + _.obj { b => + val sortedElements = array.values.sortBy(elementPosition) + sortedElements.foreach { + case element: DialectDomainElement => + val keyField = findFieldWithIri(keyProperty, element) + val valueField = findFieldWithIri(valueProperty, element) + if (keyField.isDefined && valueField.isDefined) { + val keyLiteral = + element.fields.getValueAsOption(keyField.get).map(_.value) + val valueLiteral = element.fields + .getValueAsOption(valueField.get) + .map(_.value) + (keyLiteral, valueLiteral) match { + case (Some(keyScalar: AmfScalar), Some(valueScalar: AmfScalar)) => + MapEntryEmitter(keyScalar.value.toString, valueScalar.value.toString).emit(b) + case _ => + throw new Exception("Cannot generate object pair without scalar values for key and value") + } + } else { + throw new Exception("Cannot generate object pair with undefined key or value") + } + case _ => // ignore + } + } + ) + } + + private def findFieldWithIri(keyProperty: String, element: DialectDomainElement) = { + element.meta.fields.find(_.value.iri() == keyProperty) + } + + private def elementPosition(elem: AmfElement) = { + elem.annotations + .find(classOf[LexicalInformation]) + .map(_.range.start) + .getOrElse(ZERO) + } + + override def position(): Position = { + annotations + .flatMap(_.find(classOf[LexicalInformation])) + .orElse(array.annotations.find(classOf[LexicalInformation])) + .map(_.range.start) + .getOrElse(ZERO) + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/ReferenceEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/ReferenceEmitter.scala index 0d1739bf..6bcfbf26 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/ReferenceEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/ReferenceEmitter.scala @@ -1,10 +1,10 @@ package amf.aml.internal.render.emitters.instances -import amf.core.internal.render.BaseEmitters.MapEntryEmitter -import amf.core.internal.render.emitters.EntryEmitter import amf.core.client.scala.model.document.BaseUnit -import amf.core.client.common.position.Position -import amf.core.client.common.position.Position.ZERO +import amf.core.internal.render.BaseEmitters.MapEntryEmitter import amf.core.internal.render.SpecOrdering +import amf.core.internal.render.emitters.EntryEmitter +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO import org.yaml.model.YDocument.EntryBuilder case class ReferenceEmitter(reference: BaseUnit, ordering: SpecOrdering, aliases: Map[String, (String, String)]) diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/ReferencesEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/ReferencesEmitter.scala index c4a46e8e..71c33292 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/ReferencesEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/instances/ReferencesEmitter.scala @@ -1,12 +1,12 @@ package amf.aml.internal.render.emitters.instances -import amf.core.client.common.position.Position -import amf.core.client.common.position.Position.ZERO +import amf.aml.internal.annotations.AliasesLocation import amf.core.client.scala.model.document.{BaseUnit, DeclaresModel} import amf.core.internal.render.BaseEmitters.traverse import amf.core.internal.render.SpecOrdering import amf.core.internal.render.emitters.EntryEmitter -import amf.aml.internal.annotations.AliasesLocation +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO import org.yaml.model.YDocument.EntryBuilder case class ReferencesEmitter(baseUnit: BaseUnit, ordering: SpecOrdering, aliases: Map[String, (String, String)]) @@ -15,9 +15,12 @@ case class ReferencesEmitter(baseUnit: BaseUnit, ordering: SpecOrdering, aliases val modules = baseUnit.references.collect({ case m: DeclaresModel => m }) if (modules.nonEmpty) { - b.entry("uses", _.obj { b => - traverse(ordering.sorted(modules.map(r => ReferenceEmitter(r, ordering, aliases))), b) - }) + b.entry( + "uses", + _.obj { b => + traverse(ordering.sorted(modules.map(r => ReferenceEmitter(r, ordering, aliases))), b) + } + ) } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/vocabularies/VocabularyEmitter.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/vocabularies/VocabularyEmitter.scala index 8826b8bb..8d63709f 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/vocabularies/VocabularyEmitter.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/emitters/vocabularies/VocabularyEmitter.scala @@ -1,19 +1,20 @@ package amf.aml.internal.render.emitters.vocabularies -import amf.core.internal.annotations.LexicalInformation -import amf.core.internal.render.BaseEmitters._ -import amf.core.internal.render.emitters.EntryEmitter +import amf.aml.client.scala.model.document.Vocabulary +import amf.aml.client.scala.model.domain.{ClassTerm, PropertyTerm, VocabularyReference} +import amf.aml.internal.metamodel.document.VocabularyModel +import amf.aml.internal.metamodel.domain.{ClassTermModel, ObjectPropertyTermModel} +import amf.aml.internal.render.emitters.common.ExternalEmitter +import amf.aml.internal.render.emitters.dialects.DocumentCreator import amf.core.client.scala.model.document.BaseUnit -import amf.core.client.common.position.Position -import amf.core.client.common.position.Position.ZERO import amf.core.client.scala.vocabulary.Namespace +import amf.core.internal.annotations.LexicalInformation import amf.core.internal.remote.Raml10 +import amf.core.internal.render.BaseEmitters._ import amf.core.internal.render.SpecOrdering -import amf.aml.internal.render.emitters.common.ExternalEmitter -import amf.aml.internal.metamodel.document.VocabularyModel -import amf.aml.internal.metamodel.domain.{ClassTermModel, ObjectPropertyTermModel} -import amf.aml.client.scala.model.document.Vocabulary -import amf.aml.client.scala.model.domain.{ClassTerm, PropertyTerm, VocabularyReference} +import amf.core.internal.render.emitters.EntryEmitter +import org.mulesoft.common.client.lexical.Position +import org.mulesoft.common.client.lexical.Position.ZERO import org.yaml.model.YDocument.EntryBuilder import org.yaml.model.{YDocument, YType} @@ -71,11 +72,14 @@ private case class ClassTermEmitter(classTerm: ClassTerm, ordering: SpecOrdering if (classTerm.subClassOf.length == 1) { b.entry("extends", aliasFor(classTerm.subClassOf.head.value(), aliasMapping)) } else { - b.entry("extends", _.list({ l => - classTerm.subClassOf.foreach { extended => - l += aliasFor(extended.value(), aliasMapping) - } - })) + b.entry( + "extends", + _.list({ l => + classTerm.subClassOf.foreach { extended => + l += aliasFor(extended.value(), aliasMapping) + } + }) + ) } } override def position(): Position = @@ -91,11 +95,14 @@ private case class ClassTermEmitter(classTerm: ClassTerm, ordering: SpecOrdering if (classTerm.properties.nonEmpty) { ctEmitters ++= Seq(new EntryEmitter { override def emit(b: EntryBuilder): Unit = { - b.entry("properties", _.list({ l => - classTerm.properties.foreach { prop => - l += aliasFor(prop.value(), aliasMapping) - } - })) + b.entry( + "properties", + _.list({ l => + classTerm.properties.foreach { prop => + l += aliasFor(prop.value(), aliasMapping) + } + }) + ) } override def position(): Position = classTerm.fields @@ -109,9 +116,12 @@ private case class ClassTermEmitter(classTerm: ClassTerm, ordering: SpecOrdering if (ctEmitters.isEmpty) { MapEntryEmitter(classAlias, "", YType.Null).emit(b) } else { - b.entry(classAlias, _.obj({ ct => - traverse(ordering.sorted(ctEmitters), ct) - })) + b.entry( + classAlias, + _.obj({ ct => + traverse(ordering.sorted(ctEmitters), ct) + }) + ) } } @@ -119,10 +129,11 @@ private case class ClassTermEmitter(classTerm: ClassTerm, ordering: SpecOrdering classTerm.annotations.find(classOf[LexicalInformation]).map(_.range.start).getOrElse(ZERO) } -private case class PropertyTermEmitter(propertyTerm: PropertyTerm, - ordering: SpecOrdering, - aliasMapping: Map[String, String]) - extends EntryEmitter +private case class PropertyTermEmitter( + propertyTerm: PropertyTerm, + ordering: SpecOrdering, + aliasMapping: Map[String, String] +) extends EntryEmitter with AliasMapper { override def emit(b: EntryBuilder): Unit = { val propertyAlias = aliasFor(propertyTerm.id, aliasMapping) @@ -142,11 +153,14 @@ private case class PropertyTermEmitter(propertyTerm: PropertyTerm, if (propertyTerm.subPropertyOf.size == 1) { b.entry("extends", aliasFor(propertyTerm.subPropertyOf.head.value(), aliasMapping)) } else { - b.entry("extends", _.list({ l => - propertyTerm.subPropertyOf.foreach { extended => - l += aliasFor(extended.value(), aliasMapping) - } - })) + b.entry( + "extends", + _.list({ l => + propertyTerm.subPropertyOf.foreach { extended => + l += aliasFor(extended.value(), aliasMapping) + } + }) + ) } } override def position(): Position = @@ -176,9 +190,12 @@ private case class PropertyTermEmitter(propertyTerm: PropertyTerm, if (ptEmitters.isEmpty) { MapEntryEmitter(propertyAlias, "", YType.Null).emit(b) } else { - b.entry(propertyAlias, _.obj({ ct => - traverse(ordering.sorted(ptEmitters), ct) - })) + b.entry( + propertyAlias, + _.obj({ ct => + traverse(ordering.sorted(ptEmitters), ct) + }) + ) } } @@ -186,10 +203,11 @@ private case class PropertyTermEmitter(propertyTerm: PropertyTerm, propertyTerm.annotations.find(classOf[LexicalInformation]).map(_.range.start).getOrElse(ZERO) } -private case class ImportEmitter(vocabularyReference: VocabularyReference, - vocabulary: Vocabulary, - ordering: SpecOrdering) - extends EntryEmitter { +private case class ImportEmitter( + vocabularyReference: VocabularyReference, + vocabulary: Vocabulary, + ordering: SpecOrdering +) extends EntryEmitter { override def emit(b: EntryBuilder): Unit = { val vocabFile = vocabulary.location().getOrElse(vocabulary.id).split("/").last val vocabFilePrefix = vocabulary.location().getOrElse(vocabulary.id).replace(vocabFile, "") @@ -212,21 +230,14 @@ private case class ImportEmitter(vocabularyReference: VocabularyReference, vocabularyReference.annotations.find(classOf[LexicalInformation]).map(_.range.start).getOrElse(ZERO) } -case class VocabularyEmitter(vocabulary: Vocabulary) extends AliasMapper { +case class VocabularyEmitter(vocabulary: Vocabulary, document: DocumentCreator) extends AliasMapper { val aliasMapping: Map[String, String] = buildAliasMapping(vocabulary) def emitVocabulary(): YDocument = { - val ordering: SpecOrdering = SpecOrdering.ordering(Raml10, vocabulary.sourceSpec) - + val ordering: SpecOrdering = SpecOrdering.ordering(Raml10, vocabulary.sourceSpec) val content: Seq[EntryEmitter] = rootLevelEmitters(ordering) ++ vocabularyEmitters(ordering) - - YDocument(b => { - b.comment("%Vocabulary 1.0") - b.obj { b => - traverse(ordering.sorted(content), b) - } - }) + document(ordering.sorted(content)) } def rootLevelEmitters(ordering: SpecOrdering): Seq[EntryEmitter] = @@ -236,9 +247,12 @@ case class VocabularyEmitter(vocabulary: Vocabulary) extends AliasMapper { if (vocabulary.externals.nonEmpty) { Seq(new EntryEmitter { override def emit(b: EntryBuilder): Unit = { - b.entry("external", _.obj({ b => - traverse(ordering.sorted(vocabulary.externals.map(external => ExternalEmitter(external, ordering))), b) - })) + b.entry( + "external", + _.obj({ b => + traverse(ordering.sorted(vocabulary.externals.map(external => ExternalEmitter(external, ordering))), b) + }) + ) } override def position(): Position = { @@ -260,11 +274,17 @@ case class VocabularyEmitter(vocabulary: Vocabulary) extends AliasMapper { if (vocabulary.imports.nonEmpty) { Seq(new EntryEmitter { override def emit(b: EntryBuilder): Unit = { - b.entry("uses", _.obj({ b => - traverse(ordering.sorted( - vocabulary.imports.map(vocabularyRef => ImportEmitter(vocabularyRef, vocabulary, ordering))), - b) - })) + b.entry( + "uses", + _.obj({ b => + traverse( + ordering.sorted( + vocabulary.imports.map(vocabularyRef => ImportEmitter(vocabularyRef, vocabulary, ordering)) + ), + b + ) + }) + ) } override def position(): Position = { @@ -327,19 +347,22 @@ case class VocabularyEmitter(vocabulary: Vocabulary) extends AliasMapper { val classTerms = vocabulary.declares.filter(_.isInstanceOf[ClassTerm]).asInstanceOf[Seq[ClassTerm]] if (classTerms.nonEmpty) { Seq( - new EntryEmitter { - override def emit(b: EntryBuilder): Unit = - b.entry("classTerms", _.obj({ b => + new EntryEmitter { + override def emit(b: EntryBuilder): Unit = + b.entry( + "classTerms", + _.obj({ b => traverse(ordering.sorted(classTerms.map(ct => ClassTermEmitter(ct, ordering, aliasMapping))), b) - })) - - override def position(): Position = - classTerms - .map(_.annotations.find(classOf[LexicalInformation]).map(_.range.start)) - .find(_.isDefined) - .flatten - .getOrElse(ZERO) - } + }) + ) + + override def position(): Position = + classTerms + .map(_.annotations.find(classOf[LexicalInformation]).map(_.range.start)) + .find(_.isDefined) + .flatten + .getOrElse(ZERO) + } ) } else { Nil @@ -350,19 +373,25 @@ case class VocabularyEmitter(vocabulary: Vocabulary) extends AliasMapper { val propertyTerms = vocabulary.declares.filter(_.isInstanceOf[PropertyTerm]).asInstanceOf[Seq[PropertyTerm]] if (propertyTerms.nonEmpty) { Seq( - new EntryEmitter { - override def emit(b: EntryBuilder): Unit = - b.entry("propertyTerms", _.obj({ b => - traverse(ordering.sorted(propertyTerms.map(pt => PropertyTermEmitter(pt, ordering, aliasMapping))), b) - })) - - override def position(): Position = - propertyTerms - .map(_.annotations.find(classOf[LexicalInformation]).map(_.range.start)) - .find(_.isDefined) - .flatten - .getOrElse(ZERO) - } + new EntryEmitter { + override def emit(b: EntryBuilder): Unit = + b.entry( + "propertyTerms", + _.obj({ b => + traverse( + ordering.sorted(propertyTerms.map(pt => PropertyTermEmitter(pt, ordering, aliasMapping))), + b + ) + }) + ) + + override def position(): Position = + propertyTerms + .map(_.annotations.find(classOf[LexicalInformation]).map(_.range.start)) + .find(_.isDefined) + .flatten + .getOrElse(ZERO) + } ) } else { Nil diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/plugin/AMLDialectInstanceRenderingPlugin.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/plugin/AMLDialectInstanceRenderingPlugin.scala index 3b492749..dd472fc7 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/plugin/AMLDialectInstanceRenderingPlugin.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/plugin/AMLDialectInstanceRenderingPlugin.scala @@ -2,6 +2,7 @@ package amf.aml.internal.render.plugin import amf.aml.client.scala.model.document.{Dialect, DialectInstanceUnit} import amf.aml.internal.AMLDialectInstancePlugin +import amf.aml.internal.registries.AMLRegistry import amf.aml.internal.render.emitters.instances.{DefaultNodeMappableFinder, DialectInstancesEmitter} import amf.core.client.common.{NormalPriority, PluginPriority} import amf.core.client.scala.config.RenderOptions @@ -14,9 +15,9 @@ import com.github.ghik.silencer.silent import org.yaml.builder.{DocBuilder, YDocumentBuilder} import org.yaml.model.YDocument -/** - * Parsing plugin for dialect instance like units derived from a resolved dialect - * @param dialect resolved dialect +/** Parsing plugin for dialect instance like units derived from a resolved dialect + * @param dialect + * resolved dialect */ class AMLDialectInstanceRenderingPlugin(val dialect: Dialect) extends SYAMLBasedRenderPlugin @@ -25,7 +26,12 @@ class AMLDialectInstanceRenderingPlugin(val dialect: Dialect) override def priority: PluginPriority = NormalPriority - override def emit[T](unit: BaseUnit, builder: ASTBuilder[T], config: RenderConfiguration): Boolean = { + override def emit[T]( + unit: BaseUnit, + builder: ASTBuilder[T], + config: RenderConfiguration, + mediaType: String + ): Boolean = { builder match { case sb: SYAMLASTBuilder => unparse(unit, config) exists { doc => @@ -37,13 +43,17 @@ class AMLDialectInstanceRenderingPlugin(val dialect: Dialect) } private def unparse(unit: BaseUnit, config: RenderConfiguration) = { - val dialects = config.renderPlugins.collect { - case plugin: AMLDialectInstanceRenderingPlugin => plugin.dialect + val dialects = config.renderPlugins.collect { case plugin: AMLDialectInstanceRenderingPlugin => + plugin.dialect } val finder = DefaultNodeMappableFinder(dialects) unit match { case instance: DialectInstanceUnit => - Some(DialectInstancesEmitter(instance, dialect, config.renderOptions)(finder).emitInstance()) + Some( + DialectInstancesEmitter(instance, dialect, config.renderOptions, AMLRegistry(config.registry, dialects))( + finder + ).emitInstance() + ) case _ => None } } @@ -61,8 +71,10 @@ class AMLDialectInstanceRenderingPlugin(val dialect: Dialect) override def mediaTypes: Seq[String] = Seq(`application/yaml`, `application/json`) - override protected def unparseAsYDocument(unit: BaseUnit, - renderOptions: RenderOptions, - errorHandler: AMFErrorHandler): Option[YDocument] = + override protected def unparseAsYDocument( + unit: BaseUnit, + renderConfig: RenderConfiguration, + errorHandler: AMFErrorHandler + ): Option[YDocument] = throw new UnsupportedOperationException("Unreachable code") } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/plugin/AMLDialectRenderingPlugin.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/plugin/AMLDialectRenderingPlugin.scala index 9d788891..4560961f 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/plugin/AMLDialectRenderingPlugin.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/plugin/AMLDialectRenderingPlugin.scala @@ -1,30 +1,26 @@ package amf.aml.internal.render.plugin -import amf.aml.client.scala.model.document.{Dialect, DialectFragment, DialectLibrary} +import amf.aml.client.scala.model.document.{Dialect, DialectFragment, DialectLibrary, kind} import amf.aml.internal.render.emitters.dialects.{DialectEmitter, RamlDialectLibraryEmitter} import amf.aml.internal.render.emitters.instances.DefaultNodeMappableFinder import amf.core.client.common.{NormalPriority, PluginPriority} -import amf.core.client.scala.config.RenderOptions import amf.core.client.scala.errorhandling.AMFErrorHandler import amf.core.client.scala.model.document.BaseUnit -import amf.core.internal.plugins.render.{ - AMFRenderPlugin, - RenderConfiguration, - RenderInfo, - SYAMLASTBuilder, - SYAMLBasedRenderPlugin -} +import amf.core.internal.plugins.render.{RenderConfiguration, RenderInfo, SYAMLASTBuilder, SYAMLBasedRenderPlugin} import amf.core.internal.plugins.syntax.ASTBuilder -import amf.core.internal.remote.Mimes import amf.core.internal.remote.Mimes._ -import org.yaml.builder.{DocBuilder, YDocumentBuilder} import org.yaml.model.YDocument class AMLDialectRenderingPlugin extends SYAMLBasedRenderPlugin { - override def emit[T](unit: BaseUnit, builder: ASTBuilder[T], renderConfiguration: RenderConfiguration): Boolean = { + override def emit[T]( + unit: BaseUnit, + builder: ASTBuilder[T], + renderConfiguration: RenderConfiguration, + mediaType: String + ): Boolean = { builder match { case sb: SYAMLASTBuilder => - val maybeDocument: Option[YDocument] = emitDoc(unit, renderConfiguration) + val maybeDocument: Option[YDocument] = emitDoc(unit, renderConfiguration, mediaType) maybeDocument.exists { doc => sb.document = doc true @@ -33,16 +29,24 @@ class AMLDialectRenderingPlugin extends SYAMLBasedRenderPlugin { } } - private def emitDoc(unit: BaseUnit, renderConfiguration: RenderConfiguration) = { + private def emitDoc(unit: BaseUnit, renderConfiguration: RenderConfiguration, mediaType: String) = { // TODO: Fragment???? - val dialects = renderConfiguration.renderPlugins.collect { - case plugin: AMLDialectInstanceRenderingPlugin => plugin.dialect - } - val finder = DefaultNodeMappableFinder(dialects) + val dialects = getDialects(renderConfiguration) + val finder = DefaultNodeMappableFinder(dialects) unit match { - case dialect: Dialect => Some(DialectEmitter(dialect)(finder).emitDialect()) - case library: DialectLibrary => Some(RamlDialectLibraryEmitter(library)(finder).emitDialectLibrary()) - case _ => None + case dialect: Dialect => + val doc = SyntaxDocument.getFor(mediaType, kind.Dialect) + Some(DialectEmitter(dialect, doc)(finder).emitDialect()) + case library: DialectLibrary => + val doc = SyntaxDocument.getFor(mediaType, kind.DialectLibrary) + Some(RamlDialectLibraryEmitter(library, doc)(finder).emitDialectLibrary()) + case _ => None + } + } + + private def getDialects(renderConfiguration: RenderConfiguration) = { + renderConfiguration.renderPlugins.collect { case plugin: AMLDialectInstanceRenderingPlugin => + plugin.dialect } } @@ -58,10 +62,12 @@ class AMLDialectRenderingPlugin extends SYAMLBasedRenderPlugin { override def defaultSyntax(): String = `application/yaml` - override def mediaTypes: Seq[String] = Seq(`application/yaml`) + override def mediaTypes: Seq[String] = Seq(`application/yaml`, `application/json`) - override protected def unparseAsYDocument(unit: BaseUnit, - renderOptions: RenderOptions, - errorHandler: AMFErrorHandler): Option[YDocument] = + override protected def unparseAsYDocument( + unit: BaseUnit, + renderConfig: RenderConfiguration, + errorHandler: AMFErrorHandler + ): Option[YDocument] = throw new UnsupportedOperationException("Unreachable code") } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/plugin/AMLVocabularyRenderingPlugin.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/plugin/AMLVocabularyRenderingPlugin.scala index 03a4e562..018c1e7c 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/render/plugin/AMLVocabularyRenderingPlugin.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/plugin/AMLVocabularyRenderingPlugin.scala @@ -1,12 +1,13 @@ package amf.aml.internal.render.plugin -import amf.aml.client.scala.model.document.Vocabulary +import amf.aml.client.scala.model.document.{Vocabulary, kind} import amf.aml.internal.render.emitters.vocabularies.VocabularyEmitter import amf.core.client.common.{NormalPriority, PluginPriority} import amf.core.client.scala.config.RenderOptions import amf.core.client.scala.errorhandling.AMFErrorHandler import amf.core.client.scala.model.document.BaseUnit -import amf.core.internal.plugins.render.{RenderInfo, SYAMLBasedRenderPlugin} +import amf.core.internal.plugins.render.{RenderConfiguration, RenderInfo, SYAMLASTBuilder, SYAMLBasedRenderPlugin} +import amf.core.internal.plugins.syntax.ASTBuilder import amf.core.internal.remote.Mimes._ import org.yaml.model.YDocument @@ -20,14 +21,38 @@ class AMLVocabularyRenderingPlugin extends SYAMLBasedRenderPlugin { override def defaultSyntax(): String = `application/yaml` - override def mediaTypes: Seq[String] = Seq(`application/yaml`) + override def mediaTypes: Seq[String] = Seq(`application/yaml`, `application/json`) + + override def emit[T]( + unit: BaseUnit, + builder: ASTBuilder[T], + renderConfiguration: RenderConfiguration, + mediaType: String + ): Boolean = { + builder match { + case sb: SYAMLASTBuilder => + val maybeDocument: Option[YDocument] = emitDoc(unit, renderConfiguration, mediaType) + maybeDocument.exists { doc => + sb.document = doc + true + } + case _ => false + } + } - override protected def unparseAsYDocument(unit: BaseUnit, - renderOptions: RenderOptions, - errorHandler: AMFErrorHandler): Option[YDocument] = { + private def emitDoc(unit: BaseUnit, renderConfig: RenderConfiguration, mediaType: String): Option[YDocument] = { + val doc = SyntaxDocument.getFor(mediaType, kind.Vocabulary) unit match { - case vocabulary: Vocabulary => Some(VocabularyEmitter(vocabulary).emitVocabulary()) + case vocabulary: Vocabulary => Some(VocabularyEmitter(vocabulary, doc).emitVocabulary()) case _ => None } } + + protected def unparseAsYDocument( + unit: BaseUnit, + renderConfig: RenderConfiguration, + errorHandler: AMFErrorHandler + ): Option[YDocument] = { + throw new UnsupportedOperationException("Unreachable code") + } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/render/plugin/SyntaxDocument.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/render/plugin/SyntaxDocument.scala new file mode 100644 index 00000000..5edb7e83 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/render/plugin/SyntaxDocument.scala @@ -0,0 +1,58 @@ +package amf.aml.internal.render.plugin + +import amf.aml.client.scala.model.document.kind.{AMLDocumentKind, Dialect, DialectLibrary, Vocabulary} +import amf.aml.internal.parse.hints.AmlHeaders.{DIALECT, DIALECT_LIBRARY, VOCABULARY} +import amf.aml.internal.render.emitters.dialects.DocumentCreator +import amf.core.internal.remote.Mimes.`application/json` +import amf.core.internal.render.BaseEmitters.traverse +import amf.core.internal.render.emitters.EntryEmitter +import org.yaml.model.YDocument + +object SyntaxDocument { + def getFor(syntax: String, `type`: AMLDocumentKind): DocumentCreator = { + val header = HeaderForAMLKind(`type`, syntax) + syntax match { + case `application/json` => JsonAmlDocument(header) + case _ => YamlAmlDocument(header) + } + } +} + +object JsonAmlDocument { + def apply(header: String): DocumentCreator = (entries: Seq[EntryEmitter]) => { + YDocument(b => { + b.obj { b => + b.entry("$type", header) + traverse(entries, b) + } + }) + } +} + +object YamlAmlDocument { + def apply(header: String): DocumentCreator = (entries: Seq[EntryEmitter]) => { + YDocument(b => { + b.comment(header) + b.obj { b => + traverse(entries, b) + } + }) + } +} + +object HeaderForAMLKind { + def apply(kind: AMLDocumentKind, mediaType: String): String = (kind, mediaType) match { + case (Dialect, `application/json`) => dropPercent(DIALECT) + case (Dialect, _) => DIALECT + case (DialectLibrary, `application/json`) => dropPercent(DIALECT_LIBRARY) + case (DialectLibrary, _) => DIALECT_LIBRARY + case (Vocabulary, `application/json`) => dropPercent(VOCABULARY) + case (Vocabulary, _) => VOCABULARY + case _ => "" + } + + private def dropPercent(header: String): String = header.toList match { + case '%' :: other => other.mkString + case other => other.mkString + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/AnnotationSchemaValidator.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/AnnotationSchemaValidator.scala new file mode 100644 index 00000000..6f1ffe0e --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/AnnotationSchemaValidator.scala @@ -0,0 +1,18 @@ +package amf.aml.internal.semantic + +import amf.core.client.scala.errorhandling.AMFErrorHandler +import amf.core.client.scala.model.domain.extensions.CustomDomainProperty +import amf.core.internal.annotations.SourceAST +import org.mulesoft.common.client.lexical.SourceLocation +import org.yaml.model.YNode + +trait AnnotationSchemaValidator { + val annotationIndex: Map[String, CustomDomainProperty] + def validate(name: String, key: YNode, eh: AMFErrorHandler): Unit +} + +object IgnoreAnnotationSchemaValidator extends AnnotationSchemaValidator { + override def validate(name: String, key: YNode, eh: AMFErrorHandler): Unit = {} + + override val annotationIndex: Map[String, CustomDomainProperty] = Map.empty +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/ExtensionDialectFinder.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/ExtensionDialectFinder.scala new file mode 100644 index 00000000..aed2c615 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/ExtensionDialectFinder.scala @@ -0,0 +1,18 @@ +package amf.aml.internal.semantic + +import amf.aml.client.scala.model.document.Dialect +import amf.aml.internal.registries.AMLRegistry +import org.mulesoft.common.core.CachedFunction +import org.mulesoft.common.functional.MonadInstances.optionMonad + +trait ExtensionDialectFinder { + def find(name: String): Option[Dialect] +} + +case class CachedExtensionDialectFinder(registry: AMLRegistry) extends ExtensionDialectFinder { + + private val findExtensionDialect = CachedFunction.fromMonadic { name => + registry.findExtension(name) + } + override def find(name: String): Option[Dialect] = findExtensionDialect.runCached(name) +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/SearchFieldExtractor.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/SearchFieldExtractor.scala index 5f7d477f..69bb67e6 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/SearchFieldExtractor.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/SearchFieldExtractor.scala @@ -4,11 +4,11 @@ import amf.aml.client.scala.model.document.Dialect import amf.aml.client.scala.model.domain.{AnnotationMapping, SemanticExtension} trait SearchFieldExtractor { - def extractSearchField(extension: SemanticExtension): Option[String] + def extractSearchField(extension: SemanticExtension): Seq[String] } object NameFieldExtractor extends SearchFieldExtractor { - override def extractSearchField(extension: SemanticExtension): Option[String] = extension.extensionName().option() + override def extractSearchField(extension: SemanticExtension): Seq[String] = extension.extensionName().option().toSeq } object TargetFieldExtractor { @@ -27,12 +27,13 @@ object TargetFieldExtractor { case class TargetFieldExtractor(private val annotationMappings: Map[String, AnnotationMapping]) extends SearchFieldExtractor { - override def extractSearchField(extension: SemanticExtension): Option[String] = + override def extractSearchField(extension: SemanticExtension): Seq[String] = extension .extensionMappingDefinition() .option() + .toSeq .flatMap(mappingId => annotationMappings.get(mappingId)) - .flatMap(mapping => mapping.domain().option()) + .flatMap(mapping => mapping.domain().flatMap(_.option())) } object PropertyTermFieldExtractor { @@ -51,10 +52,11 @@ object PropertyTermFieldExtractor { case class PropertyTermFieldExtractor(private val annotationMappings: Map[String, AnnotationMapping]) extends SearchFieldExtractor { - override def extractSearchField(extension: SemanticExtension): Option[String] = + override def extractSearchField(extension: SemanticExtension): Seq[String] = extension .extensionMappingDefinition() .option() .flatMap(mappingId => annotationMappings.get(mappingId)) .flatMap(mapping => mapping.nodePropertyMapping().option()) + .toSeq } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/SemanticExtensionFinder.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/SemanticExtensionFinder.scala index 7e4ea6b6..16f9a105 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/SemanticExtensionFinder.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/SemanticExtensionFinder.scala @@ -16,9 +16,8 @@ class SemanticExtensionFinder(val extensions: Map[String, Dialect], val extracto private val cache: CachedFunction[String, (SemanticExtension, Dialect), Seq] = CachedFunction.fromMonadic { uriOrString => extensions - .map { - case (extensionName, dialect) => - (dialect.extensions().find(p => p.extensionName().value() == extensionName), dialect) + .map { case (extensionName, dialect) => + (dialect.extensions().find(p => p.extensionName().value() == extensionName), dialect) } .collect { case (Some(extension), dialect) => (extension, dialect) } .filter { case (extension, _) => extractor.extractSearchField(extension).contains(uriOrString) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/SemanticExtensionOps.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/SemanticExtensionOps.scala new file mode 100644 index 00000000..b12e409f --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/SemanticExtensionOps.scala @@ -0,0 +1,23 @@ +package amf.aml.internal.semantic + +import amf.aml.client.scala.model.document.Dialect +import amf.aml.client.scala.model.domain.AnnotationMapping +import amf.aml.internal.semantic.SemanticExtensionHelper.{findAnnotationMapping, findSemanticExtension} + +object SemanticExtensionOps { + + def findExtensionMapping( + name: String, + parentTypes: Seq[String], + finder: ExtensionDialectFinder + ): Option[(AnnotationMapping, Dialect)] = { + findExtensionDialect(name, finder).flatMap { dialect => + findSemanticExtension(dialect, name) + .map(findAnnotationMapping(dialect, _)) + .filter(_.appliesTo(parentTypes)) + .map(mapping => (mapping, dialect)) + } + } + + private def findExtensionDialect(name: String, finder: ExtensionDialectFinder): Option[Dialect] = finder.find(name) +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/SemanticExtensionParser.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/SemanticExtensionParser.scala new file mode 100644 index 00000000..18241cff --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/SemanticExtensionParser.scala @@ -0,0 +1,91 @@ +package amf.aml.internal.semantic + +import amf.aml.client.scala.model.document.Dialect +import amf.aml.client.scala.model.domain.{AnnotationMapping, DialectDomainElement} +import amf.aml.internal.parse.instances.DialectInstanceContext +import amf.aml.internal.parse.instances.parser.{ElementPropertyParser, InstanceElementParser} +import amf.aml.internal.render.emitters.instances.DefaultNodeMappableFinder +import amf.aml.internal.semantic.SemanticExtensionOps.findExtensionMapping +import amf.aml.internal.semantic.SemanticExtensionParser.{createCustomDomainProperty, createDomainExtension, mergeAnnotationIntoExtension} +import amf.core.client.scala.model.domain.extensions.{CustomDomainProperty, DomainExtension} +import amf.core.client.scala.parse.document.{EmptyFutureDeclarations, ParserContext, SyamlParsedDocument, UnspecifiedReference} +import amf.core.internal.parser.Root +import amf.core.internal.parser.domain.Annotations +import org.yaml.model.{YDocument, YMap, YMapEntry} + +class SemanticExtensionParser(finder: ExtensionDialectFinder, specAnnotationValidator: AnnotationSchemaValidator) { + + def parse( + extensionName: String, + parentTypes: Seq[String], + ast: YMapEntry, + ctx: ParserContext, + extensionId: String + ): Option[DomainExtension] = { + findExtensionMapping(extensionName, parentTypes, finder).map { case (mapping, dialect) => + specAnnotationValidator.validate(extensionName, ast.key, ctx.eh) + parseSemanticExtension(dialect, mapping, ast, ctx, extensionId, extensionName) + } + } + + private def parseSemanticExtension( + dialect: Dialect, + mapping: AnnotationMapping, + ast: YMapEntry, + ctx: ParserContext, + extensionId: String, + extensionName: String + ): DomainExtension = { + + implicit val instanceCtx: DialectInstanceContext = instanceContext(dialect, ctx) + + val value = ast.value + + val instanceElement: DialectDomainElement = parseAnnotation(mapping, ast, extensionId) + + val property = createCustomDomainProperty(instanceElement, extensionName, ast) + val extension: DomainExtension = createDomainExtension(extensionName, ast, extensionId, property) + mergeAnnotationIntoExtension(instanceElement, extension) + } + + private def instanceContext(dialect: Dialect, ctx: ParserContext) = { + val nextCtx = ctx.copy(futureDeclarations = EmptyFutureDeclarations()) + new DialectInstanceContext(dialect, DefaultNodeMappableFinder(Seq(dialect)), nextCtx) + } + + private def parseAnnotation(mapping: AnnotationMapping, ast: YMapEntry, extensionId: String)(implicit + ctx: DialectInstanceContext + ) = { + // TODO: improve, shouldn't have to create fake root node + val fakeRoot = Root(SyamlParsedDocument(YDocument(YMap.empty)), "", "", Seq.empty, UnspecifiedReference, "{}") + val instanceElement = DialectDomainElement().withId("someId") + val nodeParser = InstanceElementParser(fakeRoot) + val propertyParser = new ElementPropertyParser(fakeRoot, YMap.empty, nodeParser.parse) + propertyParser.parse(extensionId, ast, mapping, instanceElement) + ctx.futureDeclarations.resolve() + instanceElement + } +} + +object SemanticExtensionParser { + private[amf] def mergeAnnotationIntoExtension(instanceElement: DialectDomainElement, extension: DomainExtension) = { + val fields = instanceElement.fields.fields() + fields.foldLeft(extension) { (acc, curr) => + acc.set(curr.field, curr.element, curr.value.annotations) + } + } + + private[amf] def createDomainExtension(key: String, value: YMapEntry, id: String, property: CustomDomainProperty) = { + val extension = DomainExtension() + .withId(id) + .withDefinedBy(property) + .withName(key) + .add(Annotations(value)) + extension + } + + private[amf] def createCustomDomainProperty(instanceElement: DialectDomainElement, key: String, ast: YMapEntry) = { + CustomDomainProperty(Annotations(ast)).withId(instanceElement.id).withName(key, Annotations()) + } + +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/SemanticExtensionRenderer.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/SemanticExtensionRenderer.scala new file mode 100644 index 00000000..20df4ed7 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/SemanticExtensionRenderer.scala @@ -0,0 +1,42 @@ +package amf.aml.internal.semantic + +import amf.aml.client.scala.model.document.Dialect +import amf.aml.client.scala.model.domain.AnnotationMapping +import amf.aml.internal.registries.AMLRegistry +import amf.aml.internal.render.emitters.instances.{ + DefaultNodeMappableFinder, + NodeMappableFinder, + SemanticExtensionNodeEmitter +} +import amf.aml.internal.semantic.SemanticExtensionOps.findExtensionMapping +import amf.core.client.scala.config.RenderOptions +import amf.core.client.scala.model.domain.extensions.DomainExtension +import amf.core.internal.render.SpecOrdering +import amf.core.internal.render.emitters.EntryEmitter + +class SemanticExtensionRenderer(finder: ExtensionDialectFinder, registry: AMLRegistry) { + + def render( + key: String, + extension: DomainExtension, + parentTypes: Seq[String], + ordering: SpecOrdering, + renderOptions: RenderOptions + ): Option[EntryEmitter] = { + findMappingThatDefinesExtension(extension, parentTypes) + .flatMap { case (mapping, dialect) => + val finder = DefaultNodeMappableFinder(dialect) + SemanticExtensionNodeEmitter(extension, mapping, dialect, ordering, renderOptions, registry, key)(finder) + .emitField(mapping.toField()) + } + } + + private def findMappingThatDefinesExtension( + extension: DomainExtension, + parentTypes: Seq[String] + ): Option[(AnnotationMapping, Dialect)] = { + val maybeName = Option(extension.definedBy).flatMap(_.name.option()) + maybeName + .flatMap(name => findExtensionMapping(name, parentTypes, finder)) + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/SemanticExtensionsFacade.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/SemanticExtensionsFacade.scala index 2305e204..9ad2e108 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/SemanticExtensionsFacade.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/semantic/SemanticExtensionsFacade.scala @@ -1,111 +1,81 @@ package amf.aml.internal.semantic import amf.aml.client.scala.model.document.Dialect -import amf.aml.client.scala.model.domain.{AnnotationMapping, DialectDomainElement} -import amf.aml.internal.parse.instances.DialectInstanceContext -import amf.aml.internal.parse.instances.parser.{ElementPropertyParser, InstanceNodeParser} import amf.aml.internal.registries.AMLRegistry -import amf.aml.internal.render.emitters.instances.DefaultNodeMappableFinder -import amf.aml.internal.semantic.SemanticExtensionHelper.{findAnnotationMapping, findSemanticExtension} -import amf.core.client.scala.model.domain.extensions.{CustomDomainProperty, DomainExtension} -import amf.core.client.scala.parse.document.{ParserContext, SyamlParsedDocument, UnspecifiedReference} -import amf.core.internal.parser.domain.Annotations -import amf.core.internal.parser.{ParseConfiguration, Root} -import org.mulesoft.common.core.CachedFunction -import org.mulesoft.common.functional.MonadInstances._ -import org.yaml.model.{YDocument, YMap, YMapEntry, YNode} - -class SemanticExtensionsFacade private (val registry: AMLRegistry) { - - def parse(extensionName: String, - parentTypes: Seq[String], - ast: YMapEntry, - ctx: ParserContext, - extensionId: String): Option[DomainExtension] = { - findExtensionDialect(extensionName).flatMap { dialect => - findSemanticExtension(dialect, extensionName) - .map(findAnnotationMapping(dialect, _)) match { - case Some(mapping) if mapping.appliesTo(parentTypes) => - Some(parseSemanticExtension(dialect, mapping, ast, ctx, extensionId, extensionName)) - case _ => None // TODO: throw warning? - } - } +import amf.aml.internal.render.emitters.instances.{NodeFieldEmitters, NodeMappableFinder} +import amf.core.client.scala.config.RenderOptions +import amf.core.client.scala.model.domain.extensions.DomainExtension +import amf.core.client.scala.parse.document.ParserContext +import amf.core.internal.annotations.{LexicalInformation, SourceAST} +import amf.core.internal.parser.ParseConfiguration +import amf.core.internal.plugins.render.RenderConfiguration +import amf.core.internal.render.SpecOrdering +import org.yaml.model.YMapEntry + +class SemanticExtensionsFacade private ( + annotation: String, + val registry: AMLRegistry, + specAnnotationValidator: AnnotationSchemaValidator +) { + + private val finder = CachedExtensionDialectFinder(registry) + private val parser = new SemanticExtensionParser(finder, specAnnotationValidator) + private val renderer = new SemanticExtensionRenderer(finder, registry) + + def parse( + parentTypes: Seq[String], + ast: YMapEntry, + ctx: ParserContext, + extensionId: String + ): Option[DomainExtension] = { + parser.parse(annotation, parentTypes, ast, ctx, extensionId) } - def findAnnotation(extensionName: String): Option[AnnotationMapping] = { - findExtensionDialect(extensionName).flatMap { dialect => - findSemanticExtension(dialect, extensionName).map(findAnnotationMapping(dialect, _)) - } + def render( + extension: DomainExtension, + parentTypes: Seq[String], + ordering: SpecOrdering, + renderOptions: RenderOptions + ) = { + renderer.render(annotation, extension, parentTypes, ordering, renderOptions) } +} - def findAnnotationMappingByExtension(extensionName: String, dialect: Dialect): Option[AnnotationMapping] = - findSemanticExtension(dialect, extensionName).map { extension => - findAnnotationMapping(dialect, extension) - } - - def findExtensionDialect(name: String): Option[Dialect] = findExtensionDialect.runCached(name) - - def parseSemanticExtension(dialect: Dialect, - mapping: AnnotationMapping, - ast: YMapEntry, - ctx: ParserContext, - extensionId: String, - extensionName: String): DomainExtension = { - - implicit val instanceCtx: DialectInstanceContext = instanceContext(dialect, ctx) - - val value = ast.value - - val instanceElement: DialectDomainElement = parseAnnotation(mapping, ast, extensionId) - - val property = createCustomDomainProperty(instanceElement, extensionName, value) - val extension: DomainExtension = createDomainExtension(extensionName, value, extensionId, property) - mergeAnnotationIntoExtension(instanceElement, extension) - } +trait SemanticExtensionsFacadeBuilder { - private def instanceContext(dialect: Dialect, ctx: ParserContext) = { - new DialectInstanceContext(dialect, DefaultNodeMappableFinder(Seq(dialect)), ctx) - } + def extensionName(name: String): SemanticExtensionsFacade // todo: replace for generic ast interface at graphql branch +} - private def mergeAnnotationIntoExtension(instanceElement: DialectDomainElement, extension: DomainExtension) = { - val fields = instanceElement.fields.fields() - fields.foldLeft(extension) { (acc, curr) => - acc.set(curr.field, curr.element, curr.value.annotations) +object SemanticExtensionsFacade { + def apply(extensionName: String, registry: AMLRegistry): SemanticExtensionsFacade = + new SemanticExtensionsFacade(extensionName, registry, IgnoreAnnotationSchemaValidator) + + def apply( + extensionName: String, + dialect: Dialect, + annotationSchemaValidator: AnnotationSchemaValidator + ): SemanticExtensionsFacade = + new SemanticExtensionsFacade( + extensionName, + AMLRegistry.apply(AMLRegistry.empty, Seq(dialect)), + annotationSchemaValidator + ) + + def apply( + extensionName: String, + config: ParseConfiguration, + annotationSchemaValidator: AnnotationSchemaValidator + ): SemanticExtensionsFacade = + config.registryContext.getRegistry match { + case registry: AMLRegistry => new SemanticExtensionsFacade(extensionName, registry, annotationSchemaValidator) + case other => new SemanticExtensionsFacade(extensionName, AMLRegistry(other), annotationSchemaValidator) } - } - - private def createDomainExtension(key: String, value: YNode, id: String, property: CustomDomainProperty) = { - val extension = DomainExtension() - .withId(id) - .withDefinedBy(property) - .withName(key) - .add(Annotations(value)) - extension - } - private def createCustomDomainProperty(instanceElement: DialectDomainElement, key: String, value: YNode) = { - CustomDomainProperty(Annotations(value)).withId(instanceElement.id).withName(key, Annotations()) - } - - private def parseAnnotation(mapping: AnnotationMapping, ast: YMapEntry, extensionId: String)( - implicit ctx: DialectInstanceContext) = { - // TODO: improve, shouldn't have to create fake root node - val fakeRoot = Root(SyamlParsedDocument(YDocument(YMap.empty)), "", "", Seq.empty, UnspecifiedReference, "{}") - val instanceElement = DialectDomainElement().withId("someId") - val nodeParser = InstanceNodeParser(fakeRoot) - val propertyParser = new ElementPropertyParser(fakeRoot, YMap.empty, nodeParser.parse) - propertyParser.parse(extensionId, ast, mapping, instanceElement) - instanceElement - } + def apply(extensionName: String, config: ParseConfiguration): SemanticExtensionsFacade = + SemanticExtensionsFacade.apply(extensionName, config, IgnoreAnnotationSchemaValidator) - private val findExtensionDialect = CachedFunction.fromMonadic { name => - registry.findExtension(name) + def apply(extensionName: String, config: RenderConfiguration): SemanticExtensionsFacade = config.registry match { + case registry: AMLRegistry => SemanticExtensionsFacade(extensionName, registry) + case other => SemanticExtensionsFacade(extensionName, AMLRegistry(other)) } } - -object SemanticExtensionsFacade { - def apply(registry: AMLRegistry): SemanticExtensionsFacade = new SemanticExtensionsFacade(registry) - // This method will assume that the parse configuration contains an AMLRegistry - def apply(config: ParseConfiguration): SemanticExtensionsFacade = - apply(config.registryContext.getRegistry.asInstanceOf[AMLRegistry]) -} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/transform/domain/NodeMappingResolver.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/transform/domain/NodeMappingResolver.scala index 6f05d218..f4243698 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/transform/domain/NodeMappingResolver.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/transform/domain/NodeMappingResolver.scala @@ -1,25 +1,20 @@ package amf.aml.internal.transform.domain -import amf.aml.internal.metamodel.domain.NodeMappingModel import amf.aml.client.scala.model.domain.{NodeMapping, PropertyMapping} - -import scala.collection.mutable +import amf.aml.internal.metamodel.domain.NodeMappingModel class NodeMappingResolver(val child: NodeMapping) { def resolveExtension: NodeMapping = { - child.extend match { - case (parent: NodeMapping) :: _ => - val resolvedParent = new NodeMappingResolver(parent).resolveExtension - - resolveIdTemplate(child, resolvedParent) - resolvePropertyMappings(child, resolvedParent) - - // we store the extended reference and remove the extends property - child.withResolvedExtends(Seq(parent.id)) - child.fields.removeField(NodeMappingModel.Extends) - case _ => // Ignore + val resolvedExtends = child.extend.map { case parent: NodeMapping => + val resolvedParent = new NodeMappingResolver(parent).resolveExtension + resolveIdTemplate(child, resolvedParent) + resolvePropertyMappings(child, resolvedParent) + parent.id } + // we store the extended reference and remove the extends property + if (resolvedExtends.nonEmpty) child.withResolvedExtends(resolvedExtends) + child.fields.removeField(NodeMappingModel.Extends) child } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/transform/pipelines/DefaultAMLTransformationPipeline.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/transform/pipelines/DefaultAMLTransformationPipeline.scala index f17d1e97..b0b110c3 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/transform/pipelines/DefaultAMLTransformationPipeline.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/transform/pipelines/DefaultAMLTransformationPipeline.scala @@ -12,9 +12,11 @@ class DefaultAMLTransformationPipeline(override val name: String) extends Transf } private object RedirectResolutionByModel extends TransformationStep { - override def transform(model: BaseUnit, - errorHandler: AMFErrorHandler, - configuration: AMFGraphConfiguration): BaseUnit = { + override def transform( + model: BaseUnit, + errorHandler: AMFErrorHandler, + configuration: AMFGraphConfiguration + ): BaseUnit = { val runner = TransformationPipelineRunner(errorHandler, configuration) model match { case _: DialectInstancePatch => runner.run(model, DialectInstancePatchTransformationPipeline()) diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/transform/pipelines/DialectInstancePatchTransformationPipeline.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/transform/pipelines/DialectInstancePatchTransformationPipeline.scala index eb02b40d..863ef3ab 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/transform/pipelines/DialectInstancePatchTransformationPipeline.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/transform/pipelines/DialectInstancePatchTransformationPipeline.scala @@ -8,10 +8,10 @@ class DialectInstancePatchTransformationPipeline private (override val name: Str override def steps: Seq[TransformationStep] = Seq( - new DialectInstanceReferencesResolutionStage(), - new DialectPatchApplicationStage(), - new CleanReferencesStage(), - new DeclarationsRemovalStage() + new DialectInstanceReferencesResolutionStage(), + new DialectPatchApplicationStage(), + new CleanReferencesStage(), + new DeclarationsRemovalStage() ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/transform/pipelines/DialectInstanceTransformationPipeline.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/transform/pipelines/DialectInstanceTransformationPipeline.scala index 2a1572a5..1e3b3170 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/transform/pipelines/DialectInstanceTransformationPipeline.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/transform/pipelines/DialectInstanceTransformationPipeline.scala @@ -1,6 +1,6 @@ package amf.aml.internal.transform.pipelines -import amf.core.internal.transform.stages.{CleanReferencesStage, DeclarationsRemovalStage} +import amf.core.internal.transform.stages.{CleanReferencesStage, DeclarationsRemovalStage, SourceInformationStage} import amf.aml.internal.transform.steps.{DialectInstanceReferencesResolutionStage, SemanticExtensionFlatteningStage} import amf.core.client.scala.transform.{TransformationPipeline, TransformationStep} @@ -8,10 +8,11 @@ class DialectInstanceTransformationPipeline private (override val name: String) override def steps: Seq[TransformationStep] = Seq( - new DialectInstanceReferencesResolutionStage(), - new CleanReferencesStage(), - new DeclarationsRemovalStage(), - SemanticExtensionFlatteningStage + new DialectInstanceReferencesResolutionStage(), + new CleanReferencesStage(), + new DeclarationsRemovalStage(), + new SemanticExtensionFlatteningStage, + SourceInformationStage ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/transform/pipelines/DialectTransformationPipeline.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/transform/pipelines/DialectTransformationPipeline.scala index a3b1f8e2..b7056f2c 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/transform/pipelines/DialectTransformationPipeline.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/transform/pipelines/DialectTransformationPipeline.scala @@ -1,13 +1,22 @@ package amf.aml.internal.transform.pipelines -import amf.core.client.scala.errorhandling.AMFErrorHandler -import amf.aml.internal.transform.steps.{DialectNodeExtensionStage, DialectReferencesResolutionStage} +import amf.aml.internal.transform.steps.{ + DialectCombiningMappingStage, + DialectNodeExtensionStage, + DialectReferencesResolutionStage +} import amf.core.client.scala.transform.{TransformationPipeline, TransformationStep} +import amf.core.internal.transform.stages.SourceInformationStage class DialectTransformationPipeline private (override val name: String) extends TransformationPipeline() { override def steps: Seq[TransformationStep] = - Seq(new DialectReferencesResolutionStage(), new DialectNodeExtensionStage()) + Seq( + new DialectCombiningMappingStage(), + new DialectReferencesResolutionStage(), + new DialectNodeExtensionStage(), + SourceInformationStage + ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/DialectCombiningMappingStage.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/DialectCombiningMappingStage.scala new file mode 100644 index 00000000..111b901c --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/DialectCombiningMappingStage.scala @@ -0,0 +1,212 @@ +package amf.aml.internal.transform.steps + +import amf.aml.client.scala.model.document.Dialect +import amf.aml.client.scala.model.domain.NodeMappable.AnyNodeMappable +import amf.aml.client.scala.model.domain.{AnyMapping, NodeMapping, UnionNodeMapping} +import amf.aml.internal.metamodel.domain.{AnyMappingModel, NodeMappingModel} +import amf.aml.internal.render.emitters.common.IdCounter +import amf.aml.internal.render.emitters.instances.{DefaultNodeMappableFinder, DialectIndex} +import amf.core.client.scala.AMFGraphConfiguration +import amf.core.client.scala.errorhandling.AMFErrorHandler +import amf.core.client.scala.model.StrField +import amf.core.client.scala.model.document.BaseUnit +import amf.core.client.scala.model.domain.AmfScalar +import amf.core.client.scala.transform.TransformationStep +import amf.core.internal.annotations.VirtualElement +import amf.core.internal.parser.domain.Annotations + +import scala.annotation.tailrec +import scala.collection.mutable + +// This stage generates all the combining mappings of an allOf field. +// This is needed to have an indexed list of the mappings to link from a parsed DialectDomainElement +// Currently supported allOf, allOf with properties, oneOf with properties and conditional with properties. +// Not supported allOf, oneOf and conditional mixed between them. +class DialectCombiningMappingStage extends TransformationStep() { + + var dialect: Option[Dialect] = None + var index: Option[DialectIndex] = None + var visitedCombinations: mutable.Set[String] = mutable.Set() + val counter: IdCounter = new IdCounter + + override def transform( + model: BaseUnit, + errorHandler: AMFErrorHandler, + configuration: AMFGraphConfiguration + ): BaseUnit = { + + model match { + case dialect: Dialect => + this.index = Some(DialectIndex(dialect, new DefaultNodeMappableFinder(Seq(dialect)))) + this.dialect = Some(dialect) + dialect.declares.foreach { + case anyMapping: AnyMapping if isCombinationGroup(anyMapping) && !alreadyProcessed(anyMapping) => + processCombinationGroup(getCombinationGroup(anyMapping)) + case _ => // ignore + } + case _ => // ignore + } + + model + } + + private def processCombinationGroup(combinators: Seq[AnyNodeMappable]): Unit = { + val combinationsRaw = combinators.map(processCombinationElement).toList + val combinationsIDs = generateCombinations(combinationsRaw) + combinationsIDs.foreach(generateCombinationMapping) + } + + private def processCombinationElement(element: AnyNodeMappable): List[String] = element match { + // If the element is an and it should be processed in a different way + // The and should be evaluated as an all, so we will return his ID and not the one of the components + case combination: AnyMapping if isCombinationGroup(combination) => + if (!alreadyProcessed(combination)) processCombinationGroup(getCombinationGroup(combination)) + List(combination.id) + case otherMapping: AnyMapping => + collectComponents(otherMapping) match { + // The cut condition is that the leaf is a NodeMapping + case uniqueComponent :: Nil if uniqueComponent.isInstanceOf[NodeMapping] => + List(uniqueComponent.id) + // I can flatmap here, the only cases where is not an or of all the element is the and + case otherComponents => + otherComponents.flatMap(processCombinationElement).toList + } + } + + // This method combines the different mappings exclusions + private def generateCombinations(combinationsRaw: List[List[String]]): List[List[String]] = + cartesianProduct(combinationsRaw) + + // This method generates a mapping based on the combination components + // It also register the mapping as a declaration in the Dialect + private def generateCombinationMapping(components: Seq[String]): Unit = { + val mapping = NodeMapping(Annotations(VirtualElement())) + setMappingName(mapping) + registerMappingDeclaration(mapping) + mapping.setArrayWithoutId(AnyMappingModel.Components, components.map(c => AmfScalar(c))) + val componentMappings = + components.map(findMapping).map(component => component.link(component.name.toString).asInstanceOf[NodeMapping]) + mapping.withExtends(componentMappings) + mapping.extend.zipWithIndex.foreach { case (e, i) => + e.withId(s"${e.id}-link-extends-$i") + } + // TODO: We will set here an 'additionalProperties: true' for all combination mappings. Maybe this should be inherit from the extends in a future + mapping.withClosed(false) + } + + // This method collect the schema defined at the same level + private def collectComponents(mapping: AnyMapping): Seq[AnyNodeMappable] = mapping match { + // The and is an special case, it will be processed in the next cycle + case combination: AnyMapping if isCombinationGroup(combination) => Seq(combination.asInstanceOf[AnyNodeMappable]) + case other: AnyNodeMappable => getComponents(other) + } + + private def getComponents(mapping: AnyMapping): Seq[AnyNodeMappable] = mapping match { + case and: AnyMapping if and.hasAny => findAllMappings(and.and) + case or: AnyMapping if or.hasOr => findAllMappings(or.or) + case conditional: AnyMapping if conditional.hasConditional => + findAllMappings(Seq(conditional.thenMapping, conditional.elseMapping)) + case union: UnionNodeMapping => findAllMappings(union.objectRange()) + case other: AnyNodeMappable => Seq(other) + } + + // Evaluates if the mapping is a combination group (an allOf or an oneOf/conditional with extended mapping) + private def isCombinationGroup(anyMapping: AnyMapping) = anyMapping match { + case any: AnyMapping if any.hasAny => true + case node: NodeMapping if node.hasProperties && (node.hasOr || node.hasConditional) => true + case _ => false + } + + // This method returns the components + the extended schema + // It assumes that you already evaluated that it is an combination group + private def getCombinationGroup(anyMapping: AnyMapping): Seq[AnyNodeMappable] = { + val extendedMapping = getExtendedMapping(anyMapping) + anyMapping match { + case any if any.hasAny => getComponents(anyMapping) ++ extendedMapping + case other: NodeMapping => + // In this flow I already know that there is an extended mapping, because I know that it is an combination group and it is not an any + // Here I will generate an oneOf/conditional + props in a allOf like structure + // (I will return the oneOf/conditional in one mapping and the properties in other, like they are elements of a parent allOf) + generateAllOfLikeElements(other) + } + } + + // If there is an extended mapping I will return the same mapping. + // It is already collected so it will be ignored in the next cycle. + private def getExtendedMapping(anyMapping: AnyMapping): Option[NodeMapping] = anyMapping match { + case nodeMapping: NodeMapping if nodeMapping.propertiesMapping().nonEmpty => Some(nodeMapping) + case _ => None + } + + // This method generates a mapping copy removing certain fields. + // This is necessary because a extended oneOf/conditional is basically 2 different mappings. + // So I need to generate a combination with both of them + private def generateAllOfLikeElements(baseMapping: NodeMapping): Seq[NodeMapping] = { + val temporalBase = generateClone(baseMapping) + removeNodeMappingFields(temporalBase) + val temporalExtension = generateClone(baseMapping) + removeCombiningFields(temporalExtension) + Seq(temporalBase, temporalExtension) + } + + private def generateClone(original: NodeMapping): NodeMapping = { + val copy = original.copyElement().asInstanceOf[NodeMapping] + copy.withName(original.name.value()) + copy.withId(original.id) + copy + } + + private def removeCombiningFields(mapping: NodeMapping): Unit = { + mapping.fields.removeField(AnyMappingModel.And) + mapping.fields.removeField(AnyMappingModel.Or) + mapping.fields.removeField(AnyMappingModel.If) + mapping.fields.removeField(AnyMappingModel.Then) + mapping.fields.removeField(AnyMappingModel.Else) + } + + private def removeNodeMappingFields(mapping: NodeMapping): Unit = { + mapping.fields.removeField(NodeMappingModel.PropertiesMapping) + } + + private def findAllMappings(mappingIds: Seq[StrField]): Seq[AnyNodeMappable] = mappingIds.map(findMapping) + + private def findMapping(mapping: StrField): AnyNodeMappable = findMapping(mapping.toString) + + private def findMapping(mapping: String): AnyNodeMappable = index.get.findNodeMappingById(mapping)._2 + + private def setMappingName(mapping: NodeMapping) = mapping.withName(newMappingName) + + private def newMappingName: String = counter.genId(s"CombiningMapping") + + private def registerMappingDeclaration(mapping: NodeMapping): Unit = dialect.get.withDeclaredElement(mapping) + + private def alreadyProcessed(anyMapping: AnyMapping) = + if (visitedCombinations.contains(anyMapping.id)) true + else { + visitedCombinations += anyMapping.id + false + } + + // TODO extract this to scala-common + private def cartesianProduct[T](lst: List[List[T]]): List[List[T]] = { + + @tailrec + def pel(e: T, ll: List[List[T]], a: List[List[T]] = Nil): List[List[T]] = + ll match { + case Nil => a.reverse + case x :: xs => pel(e, xs, (e :: x) :: a) + } + + lst match { + case Nil => Nil + case x :: Nil => List(x) + case x :: _ => + x match { + case Nil => Nil + case _ => + lst.foldRight(List(x))((l, a) => l.flatMap(pel(_, a))).map(_.dropRight(x.size)) + } + } + } + +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/DialectInstanceReferencesResolutionStage.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/DialectInstanceReferencesResolutionStage.scala index 05214a88..6d560916 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/DialectInstanceReferencesResolutionStage.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/DialectInstanceReferencesResolutionStage.scala @@ -11,9 +11,11 @@ import amf.core.client.scala.AMFGraphConfiguration import amf.core.client.scala.transform.TransformationStep class DialectInstanceReferencesResolutionStage() extends TransformationStep { - override def transform(model: BaseUnit, - errorHandler: AMFErrorHandler, - configuration: AMFGraphConfiguration): BaseUnit = { + override def transform( + model: BaseUnit, + errorHandler: AMFErrorHandler, + configuration: AMFGraphConfiguration + ): BaseUnit = { new DialectInstanceReferencesResolution()(errorHandler).transform(model) } } @@ -30,9 +32,11 @@ private class DialectInstanceReferencesResolution(implicit errorHandler: AMFErro } // Internal request that checks for mutually recursive types - protected def recursiveTransformInvocation(model: BaseUnit, - modelResolver: Option[ModelReferenceResolver], - mutuallyRecursive: Seq[String]): BaseUnit = { + protected def recursiveTransformInvocation( + model: BaseUnit, + modelResolver: Option[ModelReferenceResolver], + mutuallyRecursive: Seq[String] + ): BaseUnit = { this.mutuallyRecursive = mutuallyRecursive this.model = Some(model) this.modelResolver = Some(modelResolver.getOrElse(new ModelReferenceResolver(model))) diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/DialectNodeExtensionStage.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/DialectNodeExtensionStage.scala index 065a268d..bc48a0a0 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/DialectNodeExtensionStage.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/DialectNodeExtensionStage.scala @@ -9,9 +9,11 @@ import amf.core.client.scala.transform.TransformationStep class DialectNodeExtensionStage() extends TransformationStep() { - override def transform(model: BaseUnit, - errorHandler: AMFErrorHandler, - configuration: AMFGraphConfiguration): BaseUnit = { + override def transform( + model: BaseUnit, + errorHandler: AMFErrorHandler, + configuration: AMFGraphConfiguration + ): BaseUnit = { model match { case declarationModel: DeclaresModel => declarationModel.declares.foreach { diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/DialectPatchApplicationStage.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/DialectPatchApplicationStage.scala index 805360b2..8dc77cee 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/DialectPatchApplicationStage.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/DialectPatchApplicationStage.scala @@ -17,9 +17,11 @@ import amf.core.client.scala.transform.TransformationStep import scala.language.postfixOps class DialectPatchApplicationStage() extends TransformationStep { - override def transform(model: BaseUnit, - errorHandler: AMFErrorHandler, - configuration: AMFGraphConfiguration): BaseUnit = { + override def transform( + model: BaseUnit, + errorHandler: AMFErrorHandler, + configuration: AMFGraphConfiguration + ): BaseUnit = { new DialectPatchApplication()(errorHandler).transform(model) } } @@ -59,10 +61,12 @@ private class DialectPatchApplication()(implicit val errorHandler: AMFErrorHandl } private def applyPatch(target: DialectInstance, patch: DialectInstancePatch): DialectInstance = { - patchNode(Some(target.encodes.asInstanceOf[DialectDomainElement]), - target.location().get, - patch.encodes.asInstanceOf[DialectDomainElement], - patch.location().get) match { + patchNode( + Some(target.encodes.asInstanceOf[DialectDomainElement]), + target.location().get, + patch.encodes.asInstanceOf[DialectDomainElement], + patch.location().get + ) match { case Some(patchedDialectElement) => target.withEncodes(patchedDialectElement) case None => target.fields.remove(DialectInstanceModel.Encodes.value.iri()) @@ -70,10 +74,12 @@ private class DialectPatchApplication()(implicit val errorHandler: AMFErrorHandl } } - private def patchNode(targetNode: Option[DialectDomainElement], - targetLocation: String, - patchNode: DialectDomainElement, - patchLocation: String): Option[DialectDomainElement] = { + private def patchNode( + targetNode: Option[DialectDomainElement], + targetLocation: String, + patchNode: DialectDomainElement, + patchLocation: String + ): Option[DialectDomainElement] = { findNodeMergePolicy(patchNode) match { case INSERT => patchNodeInsert(targetNode, targetLocation, patchNode, patchLocation) @@ -87,12 +93,12 @@ private class DialectPatchApplication()(implicit val errorHandler: AMFErrorHandl targetNode case FAIL => errorHandler.violation( - InvalidDialectPatch, - patchNode.id, - None, - s"Node ${patchNode.meta.`type`.map(_.iri()).mkString(",")} cannot be patched", - patchNode.annotations.find(classOf[LexicalInformation]), - None + InvalidDialectPatch, + patchNode.id, + None, + s"Node ${patchNode.meta.`type`.map(_.iri()).mkString(",")} cannot be patched", + patchNode.annotations.find(classOf[LexicalInformation]), + None ) None } @@ -104,18 +110,22 @@ private class DialectPatchApplication()(implicit val errorHandler: AMFErrorHandl property.mergePolicy.option().getOrElse("update") // add or ignore if present - private def patchNodeInsert(targetNode: Option[DialectDomainElement], - targetLocation: String, - patchNode: DialectDomainElement, - patchLocation: String): Option[DialectDomainElement] = { + private def patchNodeInsert( + targetNode: Option[DialectDomainElement], + targetLocation: String, + patchNode: DialectDomainElement, + patchLocation: String + ): Option[DialectDomainElement] = { if (targetNode.isEmpty) Some(patchNode) else targetNode } // delete or ignore if not present - private def patchNodeDelete(targetNode: Option[DialectDomainElement], - targetLocation: String, - patchNode: DialectDomainElement, - patchLocation: String): Option[DialectDomainElement] = { + private def patchNodeDelete( + targetNode: Option[DialectDomainElement], + targetLocation: String, + patchNode: DialectDomainElement, + patchLocation: String + ): Option[DialectDomainElement] = { if (targetNode.nonEmpty && sameNodeIdentity(targetNode.get, targetLocation, patchNode, patchLocation)) { None } else { @@ -123,12 +133,14 @@ private class DialectPatchApplication()(implicit val errorHandler: AMFErrorHandl } } - private def patchProperty(targetNode: DialectDomainElement, - patchField: Field, - patchValue: Value, - propertyMapping: PropertyMapping, - targetLocation: String, - patchLocation: String): Unit = { + private def patchProperty( + targetNode: DialectDomainElement, + patchField: Field, + patchValue: Value, + propertyMapping: PropertyMapping, + targetLocation: String, + patchLocation: String + ): Unit = { propertyMapping.classification() match { case LiteralProperty => patchLiteralProperty(targetNode, patchField, patchValue, propertyMapping, targetLocation, patchLocation) @@ -137,31 +149,37 @@ private class DialectPatchApplication()(implicit val errorHandler: AMFErrorHandl case ObjectProperty => patchObjectProperty(targetNode, patchField, patchValue, propertyMapping, targetLocation, patchLocation) case ObjectPropertyCollection | ObjectMapProperty | ObjectPairProperty => - patchObjectCollectionProperty(targetNode, - patchField, - patchValue, - propertyMapping, - targetLocation, - patchLocation) + patchObjectCollectionProperty( + targetNode, + patchField, + patchValue, + propertyMapping, + targetLocation, + patchLocation + ) case _ => // throw new Exception("Unsupported node mapping in patch") } } - private def patchLiteralProperty(targetNode: DialectDomainElement, - patchField: Field, - patchValue: Value, - propertyMapping: PropertyMapping, - targetLocation: String, - patchLocation: String): Unit = { + private def patchLiteralProperty( + targetNode: DialectDomainElement, + patchField: Field, + patchValue: Value, + propertyMapping: PropertyMapping, + targetLocation: String, + patchLocation: String + ): Unit = { findPropertyMappingMergePolicy(propertyMapping) match { case INSERT if !targetNode.graph.containsField(patchField) => targetNode.graph.patchField(patchField, patchValue) case DELETE if targetNode.graph.containsField(patchField) => try { - if (targetNode.fields.getValue(patchField).value.asInstanceOf[AmfScalar].value - == patchValue.value.asInstanceOf[AmfScalar].value) + if ( + targetNode.fields.getValue(patchField).value.asInstanceOf[AmfScalar].value + == patchValue.value.asInstanceOf[AmfScalar].value + ) targetNode.graph.removeField(patchField.toString) } catch { case _: Exception => // ignore @@ -174,12 +192,12 @@ private class DialectPatchApplication()(implicit val errorHandler: AMFErrorHandl // ignore case FAIL => errorHandler.violation( - InvalidDialectPatch, - targetNode.id, - None, - s"Property ${patchField.value.iri()} cannot be patched", - targetNode.fields.getValue(patchField).annotations.find(classOf[LexicalInformation]), - None + InvalidDialectPatch, + targetNode.id, + None, + s"Property ${patchField.value.iri()} cannot be patched", + targetNode.fields.getValue(patchField).annotations.find(classOf[LexicalInformation]), + None ) case _ => // ignore @@ -201,10 +219,12 @@ private class DialectPatchApplication()(implicit val errorHandler: AMFErrorHandl } } - private def patchLiteralCollectionProperty(targetNode: DialectDomainElement, - patchField: Field, - patchValue: Value, - propertyMapping: PropertyMapping): Unit = { + private def patchLiteralCollectionProperty( + targetNode: DialectDomainElement, + patchField: Field, + patchValue: Value, + propertyMapping: PropertyMapping + ): Unit = { val targetPropertyValue = getCollectionFrom(targetNode, patchField).toSet val patchPropertyValue = getCollectionFrom(patchValue).toSet @@ -222,12 +242,12 @@ private class DialectPatchApplication()(implicit val errorHandler: AMFErrorHandl // ignore case FAIL => errorHandler.violation( - InvalidDialectPatch, - targetNode.id, - None, - s"Property ${patchField.value.iri()} cannot be patched", - patchValue.annotations.find(classOf[LexicalInformation]), - None + InvalidDialectPatch, + targetNode.id, + None, + s"Property ${patchField.value.iri()} cannot be patched", + patchValue.annotations.find(classOf[LexicalInformation]), + None ) case _ => // ignore @@ -246,20 +266,24 @@ private class DialectPatchApplication()(implicit val errorHandler: AMFErrorHandl .map(asDialectDomainElements) } - private def idIndex(elements: Seq[DialectDomainElement], - targetLocation: String): Map[NeutralId, DialectDomainElement] = { + private def idIndex( + elements: Seq[DialectDomainElement], + targetLocation: String + ): Map[NeutralId, DialectDomainElement] = { val indexById = (element: DialectDomainElement) => neutralId(element.id, targetLocation) -> element elements .map(indexById) .toMap } - private def patchObjectCollectionProperty(targetNode: DialectDomainElement, - patchField: Field, - patchValue: Value, - propertyMapping: PropertyMapping, - targetLocation: String, - patchLocation: String): Unit = { + private def patchObjectCollectionProperty( + targetNode: DialectDomainElement, + patchField: Field, + patchValue: Value, + propertyMapping: PropertyMapping, + targetLocation: String, + patchLocation: String + ): Unit = { val targetElements: Seq[TargetDomainElement] = onlyDomainElements { getCollectionFrom(targetNode, patchField) } val patchElements: Seq[PatchDomainElement] = onlyDomainElements { getCollectionFrom(patchValue) } @@ -272,8 +296,8 @@ private class DialectPatchApplication()(implicit val errorHandler: AMFErrorHandl case INSERT => // Elements not defined in target val toInsertElements = patchElementsIndex - .filter { - case (id, _) => !targetElementsIndex.contains(id) + .filter { case (id, _) => + !targetElementsIndex.contains(id) } .values .toSeq @@ -284,8 +308,8 @@ private class DialectPatchApplication()(implicit val errorHandler: AMFErrorHandl case DELETE => // Elements defined by both patch and target - val toDeleteElements = patchElementsIndex.flatMap { - case (id, _) => targetElementsIndex.get(id) + val toDeleteElements = patchElementsIndex.flatMap { case (id, _) => + targetElementsIndex.get(id) }.toSeq val unionElements = targetElements diff toDeleteElements @@ -295,14 +319,13 @@ private class DialectPatchApplication()(implicit val errorHandler: AMFErrorHandl case UPDATE | UPSERT => // Merge nodes defined for target and patch val mergedElementsIndex: Map[NeutralId, MergedDomainElement] = - patchElementsIndex.flatMap { - case (id, patchElement) => - for { - targetElement <- targetElementsIndex.get(id) - mergedElement <- patchNode(Some(targetElement), targetLocation, patchElement, patchLocation) - } yield { - (id, mergedElement) - } + patchElementsIndex.flatMap { case (id, patchElement) => + for { + targetElement <- targetElementsIndex.get(id) + mergedElement <- patchNode(Some(targetElement), targetLocation, patchElement, patchLocation) + } yield { + (id, mergedElement) + } } val unionElements = mergePolicy match { @@ -317,24 +340,26 @@ private class DialectPatchApplication()(implicit val errorHandler: AMFErrorHandl case FAIL => errorHandler.violation( - InvalidDialectPatch, - targetNode.id, - None, - s"Property ${patchField.value.iri()} cannot be patched", - patchValue.annotations.find(classOf[LexicalInformation]), - None + InvalidDialectPatch, + targetNode.id, + None, + s"Property ${patchField.value.iri()} cannot be patched", + patchValue.annotations.find(classOf[LexicalInformation]), + None ) case _ => // ignore } } - private def patchObjectProperty(targetNode: DialectDomainElement, - patchField: Field, - patchValue: Value, - propertyMapping: PropertyMapping, - targetLocation: String, - patchLocation: String): Unit = { + private def patchObjectProperty( + targetNode: DialectDomainElement, + patchField: Field, + patchValue: Value, + propertyMapping: PropertyMapping, + targetLocation: String, + patchLocation: String + ): Unit = { patchValue.value match { case patchDialectDomainElement: DialectDomainElement => val targetNodeValue = targetNode.fields ? patchField @@ -347,10 +372,12 @@ private class DialectPatchApplication()(implicit val errorHandler: AMFErrorHandl } // recursive merge if both present - private def patchNodeUpdate(targetNode: Option[DialectDomainElement], - targetLocation: String, - patchNode: DialectDomainElement, - patchLocation: String): Option[DialectDomainElement] = { + private def patchNodeUpdate( + targetNode: Option[DialectDomainElement], + targetLocation: String, + patchNode: DialectDomainElement, + patchLocation: String + ): Option[DialectDomainElement] = { val nodeMapping = patchNode.definedBy if (targetNode.isDefined && sameNodeIdentity(targetNode.get, targetLocation, patchNode, patchLocation)) { patchNode.meta.fields.foreach { patchField => @@ -371,20 +398,24 @@ private class DialectPatchApplication()(implicit val errorHandler: AMFErrorHandl } // recursive merge if both present - private def patchNodeUpsert(targetNode: Option[DialectDomainElement], - targetLocation: String, - patchNode: DialectDomainElement, - patchLocation: String): Option[DialectDomainElement] = { + private def patchNodeUpsert( + targetNode: Option[DialectDomainElement], + targetLocation: String, + patchNode: DialectDomainElement, + patchLocation: String + ): Option[DialectDomainElement] = { if (targetNode.isEmpty) patchNodeInsert(targetNode, targetLocation, patchNode, patchLocation) else patchNodeUpdate(targetNode, targetLocation, patchNode, patchLocation) } - private def sameNodeIdentity(target: DialectDomainElement, - targetLocation: String, - patchNode: DialectDomainElement, - patchLocation: String): Boolean = { + private def sameNodeIdentity( + target: DialectDomainElement, + targetLocation: String, + patchNode: DialectDomainElement, + patchLocation: String + ): Boolean = { neutralId(target.id, targetLocation) == neutralId(patchNode.id, patchLocation) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/DialectReferencesResolutionStage.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/DialectReferencesResolutionStage.scala index 5f540efd..d55658fc 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/DialectReferencesResolutionStage.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/DialectReferencesResolutionStage.scala @@ -23,15 +23,19 @@ import scala.collection.mutable class DialectReferencesResolutionStage() extends TransformationStep() { type NodeMappable = NodeMappable.AnyNodeMappable - override def transform(model: BaseUnit, - errorHandler: AMFErrorHandler, - configuration: AMFGraphConfiguration): BaseUnit = { + override def transform( + model: BaseUnit, + errorHandler: AMFErrorHandler, + configuration: AMFGraphConfiguration + ): BaseUnit = { val finalDeclarationsMap = mutable.Map[String, NodeMappable]() val unitDeclarations = model.asInstanceOf[DeclaresModel].declares.filterType[NodeMappable] - iteratePending(pending = unitDeclarations, - alreadyResolved = finalDeclarationsMap, - allDeclarations = model.recursivelyFindDeclarations()) + iteratePending( + pending = unitDeclarations, + alreadyResolved = finalDeclarationsMap, + allDeclarations = model.recursivelyFindDeclarations() + ) linkExtendedNodes(finalDeclarationsMap) @@ -76,9 +80,11 @@ class DialectReferencesResolutionStage() extends TransformationStep() { resolved } - def iteratePending(pending: Seq[NodeMappable], - alreadyResolved: mutable.Map[String, NodeMappable], - allDeclarations: Map[String, NodeMappable]): Unit = { + def iteratePending( + pending: Seq[NodeMappable], + alreadyResolved: mutable.Map[String, NodeMappable], + allDeclarations: Map[String, NodeMappable] + ): Unit = { if (pending.nonEmpty) { (pending.head, pending.tail) match { case (head, tail) if alreadyResolved.contains(head.id) => @@ -119,15 +125,19 @@ class DialectReferencesResolutionStage() extends TransformationStep() { acc } - if (nodeMappable.name - .value() - .contains(".")) { // this might come from a library TODO: check collisions in names + if ( + nodeMappable.name + .value() + .contains(".") + ) { // this might come from a library TODO: check collisions in names nodeMappable.withName(genName(nodeMappable.name.value().split(".").last, allDeclarations)) } } - private def collectReferencesFrom(nodeMappable: NodeMappable, - allDeclarations: Map[String, NodeMappable]): Seq[NodeMappable] = { + private def collectReferencesFrom( + nodeMappable: NodeMappable, + allDeclarations: Map[String, NodeMappable] + ): Seq[NodeMappable] = { def collectRange(element: HasObjectRange[_]) = { for { range <- element.objectRange() @@ -160,14 +170,11 @@ class DialectReferencesResolutionStage() extends TransformationStep() { private def linkExtendedNodes(alreadyResolved: mutable.Map[String, NodeMappable]): Unit = { alreadyResolved.values.foreach { nodeMappable => - nodeMappable.extend.headOption match { - case Some(extended: NodeMappable) - if extended.linkTarget.isDefined && alreadyResolved.contains(extended.linkTarget.get.id) => - val found = alreadyResolved(extended.linkTarget.get.id) - nodeMappable.setArrayWithoutId(NodeMappingModel.Extends, Seq(found)) - case _ => - // ignore + val extensions = nodeMappable.extend.map { + case extended: NodeMappable if extended.isLink && alreadyResolved.contains(extended.linkTarget.get.id) => + alreadyResolved(extended.linkTarget.get.id) } + nodeMappable.setArrayWithoutId(NodeMappingModel.Extends, extensions) } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/SemanticExtensionFlatteningStage.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/SemanticExtensionFlatteningStage.scala index 2c9f62e0..b6fb5a07 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/SemanticExtensionFlatteningStage.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/transform/steps/SemanticExtensionFlatteningStage.scala @@ -8,15 +8,22 @@ import amf.core.client.scala.model.domain.extensions.DomainExtension import amf.core.client.scala.transform.TransformationStep import amf.core.internal.metamodel.domain.extensions.DomainExtensionModel import amf.core.internal.metamodel.domain.extensions.DomainExtensionModel._ +import amf.core.internal.parser.domain.FieldEntry -object SemanticExtensionFlatteningStage extends TransformationStep { +class SemanticExtensionFlatteningStage() extends TransformationStep { private lazy val filterFields = DomainExtensionModel.fields - override def transform(model: BaseUnit, - errorHandler: AMFErrorHandler, - configuration: AMFGraphConfiguration): BaseUnit = { - model.transform(hasSemanticExtension, transform)(errorHandler) + override def transform( + model: BaseUnit, + errorHandler: AMFErrorHandler, + configuration: AMFGraphConfiguration + ): BaseUnit = { + model.iterator().foreach { + case element: DomainElement if hasSemanticExtension(element) => compactExtensionsIntoElement(element) + case _ => // Ignore + } + model } private def hasSemanticExtension(element: DomainElement): Boolean = { @@ -25,10 +32,6 @@ object SemanticExtensionFlatteningStage extends TransformationStep { private def isSemanticExtension(extension: DomainExtension): Boolean = Option(extension.extension).isEmpty - private def transform(element: DomainElement, isCycle: Boolean): Option[DomainElement] = { - Some(compactExtensionsIntoElement(element)) - } - private def compactExtensionsIntoElement(element: DomainElement): DomainElement = { element.customDomainProperties.filter(isSemanticExtension).foldLeft(element) { (elem, extension) => compactableFields(extension).foldLeft(elem) { (elem, fieldEntry) => @@ -42,7 +45,7 @@ object SemanticExtensionFlatteningStage extends TransformationStep { } else element.withCustomDomainProperties(notSemanticExtensions) } - private def compactableFields(extension: DomainExtension) = { + private def compactableFields(extension: DomainExtension): Iterable[FieldEntry] = { extension.fields.fields().filter(p => !filterFields.contains(p.field)) } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/utils/AmlExtensionSyntax.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/utils/AmlExtensionSyntax.scala index 6f23076e..c6d6bb7f 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/utils/AmlExtensionSyntax.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/utils/AmlExtensionSyntax.scala @@ -16,10 +16,10 @@ package object AmlExtensionSyntax { implicit class RichExternalsSeq(val externals: Seq[External]) extends AnyVal { - /** - * Fixes collisions when nested externals use the same alias + /** Fixes collisions when nested externals use the same alias * - * @return external sequence with handled collisions + * @return + * external sequence with handled collisions */ def fixAliasCollisions: Seq[External] = { val aliasIndex: mutable.Map[Aliases.Alias, Aliases.FullUrl] = mutable.Map.empty @@ -32,7 +32,9 @@ package object AmlExtensionSyntax { val alias = external.alias.value() val uriHash = external.base.value().hashCode external - .withAlias(s"$alias-$uriHash") // Appending the uri hash avoids enumeration problems & guarantees uniqueness + .withAlias( + s"$alias-$uriHash" + ) // Appending the uri hash avoids enumeration problems & guarantees uniqueness Some(external) case None => aliasIndex.put(external.alias.value(), external.base.value()) @@ -56,20 +58,20 @@ package object AmlExtensionSyntax { externals ++ nestedExternals } - def recursivelyFindDeclarations(model: BaseUnit = this.baseUnit, - acc: Map[String, NodeMappable] = Map()): Map[String, NodeMappable] = { + def recursivelyFindDeclarations( + model: BaseUnit = this.baseUnit, + acc: Map[String, NodeMappable] = Map() + ): Map[String, NodeMappable] = { val updateDeclarations = model match { case lib: DeclaresModel => - lib.declares.collect { case nodeMapping: NodeMappable => nodeMapping }.foldLeft(acc) { - case (acc, mapping) => - acc.updated(mapping.id, mapping) + lib.declares.collect { case nodeMapping: NodeMappable => nodeMapping }.foldLeft(acc) { case (acc, mapping) => + acc.updated(mapping.id, mapping) } case _ => acc } - model.references.collect { case lib: DeclaresModel => lib }.foldLeft(updateDeclarations) { - case (acc, lib) => - recursivelyFindDeclarations(lib, acc) + model.references.collect { case lib: DeclaresModel => lib }.foldLeft(updateDeclarations) { case (acc, lib) => + recursivelyFindDeclarations(lib, acc) } } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/utils/DialectHelper.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/utils/DialectHelper.scala index 61b0992b..778a2935 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/utils/DialectHelper.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/utils/DialectHelper.scala @@ -9,7 +9,7 @@ import scala.collection.immutable object DialectHelper { def findDialect(nameAndVersion: String, registry: AMFRegistry): immutable.Seq[Dialect] = - registry.getPluginsRegistry.parsePlugins.collect { + registry.getPluginsRegistry.rootParsePlugins.collect { case plugin: AMLDialectInstanceParsingPlugin if plugin.dialect.nameAndVersion() == nameAndVersion => plugin.dialect } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/utils/DialectRegister.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/utils/DialectRegister.scala index 90ac9cce..e4b46216 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/utils/DialectRegister.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/utils/DialectRegister.scala @@ -2,9 +2,9 @@ package amf.aml.internal.utils import amf.aml.client.scala.AMLConfiguration import amf.aml.client.scala.model.document.Dialect -import amf.aml.client.scala.model.domain.{NodeMapping, ObjectMapProperty} +import amf.aml.client.scala.model.domain.{NodeMapping, ObjectMapProperty, PropertyMapping} import amf.aml.internal.metamodel.domain.DialectDomainElementModel -import amf.aml.internal.namespace.AMLDialectNamespaceAliasesPlugin +import amf.aml.internal.namespace.DialectNamespaceAliases import amf.aml.internal.parse.plugin.AMLDialectInstanceParsingPlugin import amf.aml.internal.render.emitters.instances.DefaultNodeMappableFinder import amf.aml.internal.render.plugin.AMLDialectInstanceRenderingPlugin @@ -21,7 +21,7 @@ import amf.core.internal.plugins.AMFPlugin import amf.core.internal.validation.core.{SeverityMapping, ValidationProfile} object DialectRegister { - val SEMANTIC_EXTENSIONS_PROFILE = ProfileName("SEMANTIC_EXTENSIONS_PROFILE") + val SEMANTIC_EXTENSIONS_PROFILE: ProfileName = ProfileName("SEMANTIC_EXTENSIONS_PROFILE") } private[amf] case class DialectRegister(d: Dialect, configuration: AMLConfiguration) { @@ -34,33 +34,45 @@ private[amf] case class DialectRegister(d: Dialect, configuration: AMLConfigurat } } + lazy val domainMapProperties: Seq[PropertyMapping] = dialect.declares.collect { case nodeMapping: NodeMapping => + nodeMapping.propertiesMapping().filter(_.classification() == ObjectMapProperty) + }.flatten + def register(): AMLConfiguration = { val existingDialects = configuration.configurationState().getDialects() val finder = DefaultNodeMappableFinder(existingDialects) val profile = new AMFDialectValidations(dialect)(finder).profile() val newConfig = configuration - .withPlugins(plugins) + .withPlugins(plugins(profile)) .withValidationProfile(profile) .withEntities(domainModels) .withExtensions(dialect) + .withAliases(DialectNamespaceAliases(dialect)) updateSemanticExtensionsProfile(newConfig, profile) } - private def updateSemanticExtensionsProfile(config: AMLConfiguration, - dialectProfile: ValidationProfile): AMLConfiguration = { + private def updateSemanticExtensionsProfile( + config: AMLConfiguration, + dialectProfile: ValidationProfile + ): AMLConfiguration = { val validationsToPropagate = dialectProfile.validations.diff(AMFDialectValidations.staticValidations) val profile = config.getRegistry.getConstraintsRules.getOrElse( - SEMANTIC_EXTENSIONS_PROFILE, - ValidationProfile(SEMANTIC_EXTENSIONS_PROFILE, None, Seq.empty, SeverityMapping())) - val nextProfile = profile.copy(severities = profile.severities.concat(dialectProfile.severities), - validations = profile.validations ++ validationsToPropagate) + SEMANTIC_EXTENSIONS_PROFILE, + ValidationProfile(SEMANTIC_EXTENSIONS_PROFILE, None, Seq.empty, SeverityMapping()) + ) + val nextProfile = profile.copy( + severities = profile.severities.concat(dialectProfile.severities), + validations = profile.validations ++ validationsToPropagate + ) config.withValidationProfile(nextProfile) } - private lazy val plugins: List[AMFPlugin[_]] = { - List(new AMLDialectInstanceParsingPlugin(dialect), new AMLDialectInstanceRenderingPlugin(dialect)) ++ AMLDialectNamespaceAliasesPlugin - .forDialect(dialect) + private def plugins(constraints: ValidationProfile): List[AMFPlugin[_]] = { + List( + new AMLDialectInstanceParsingPlugin(dialect, Some(constraints)), + new AMLDialectInstanceRenderingPlugin(dialect) + ) } private[amf] def resolveDialect(cloned: Dialect) = { @@ -71,22 +83,17 @@ private[amf] case class DialectRegister(d: Dialect, configuration: AMLConfigurat private lazy val domainModels = { dialect.declares - .collect({ - case n: NodeMapping => n.id -> buildMetamodel(n) + .collect({ case n: NodeMapping => + n.id -> buildMetamodel(n) }) .toMap } private def buildMetamodel(nodeMapping: NodeMapping): DialectDomainElementModel = { val nodeType = nodeMapping.nodetypeMapping - val fields = nodeMapping.propertiesMapping().map(_.toField) - val mapPropertiesInDomain = dialect.declares - .collect { - case nodeMapping: NodeMapping => - nodeMapping.propertiesMapping().filter(_.classification() == ObjectMapProperty) - } - .flatten - .filter(prop => prop.objectRange().exists(_.value() == nodeMapping.id)) + val fields = nodeMapping.propertiesMapping().map(_.toField()) + val mapPropertiesInDomain = + domainMapProperties.filter(prop => prop.objectRange().exists(_.value() == nodeMapping.id)) val mapPropertiesFields = mapPropertiesInDomain @@ -95,8 +102,6 @@ private[amf] case class DialectRegister(d: Dialect, configuration: AMLConfigurat .map(iri => Field(Type.Str, ValueType(iri.value()), ModelDoc(ModelVocabularies.Parser, "custom", iri.value()))) val nodeTypes = nodeType.option().map(Seq(_)).getOrElse(Nil) - val result = - new DialectDomainElementModel(nodeTypes :+ nodeMapping.id, fields ++ mapPropertiesFields, Some(nodeMapping)) - result + new DialectDomainElementModel(nodeTypes :+ nodeMapping.id, fields ++ mapPropertiesFields, Some(nodeMapping)) } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/utils/VocabulariesRegister.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/utils/VocabulariesRegister.scala index 5c2d7657..2e7ff309 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/utils/VocabulariesRegister.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/utils/VocabulariesRegister.scala @@ -5,89 +5,88 @@ import amf.aml.client.platform.model.domain._ import amf.aml.client.scala.model.{document, domain} import amf.aml.internal.metamodel.document._ import amf.aml.internal.metamodel.domain._ -import amf.core.internal.convert.CoreRegister +import amf.core.internal.convert.UniqueInitializer import amf.core.internal.metamodel.Obj import amf.core.internal.remote.Platform import amf.core.internal.unsafe.PlatformSecrets -object VocabulariesRegister extends PlatformSecrets { +object VocabulariesRegister extends UniqueInitializer with PlatformSecrets { // TODO ARM remove when APIMF-3000 is done def register(): Unit = register(platform) - def register(platform: Platform): Unit = { - CoreRegister.register(platform) + def register(platform: Platform): Unit = if (shouldInitialize) { val p: (Obj) => Boolean = (x: Obj) => x.isInstanceOf[DialectDomainElementModel] - platform.registerWrapperPredicate(p) { - case m: domain.DialectDomainElement => DialectDomainElement(m) + platform.registerWrapperPredicate(p) { case m: domain.DialectDomainElement => + DialectDomainElement(m) } - platform.registerWrapper(ClassTermModel) { - case s: domain.ClassTerm => ClassTerm(s) + platform.registerWrapper(ClassTermModel) { case s: domain.ClassTerm => + ClassTerm(s) } - platform.registerWrapper(ExternalModel) { - case s: domain.External => External(s) + platform.registerWrapper(ExternalModel) { case s: domain.External => + External(s) } - platform.registerWrapper(NodeMappingModel) { - case s: domain.NodeMapping => NodeMapping(s) + platform.registerWrapper(NodeMappingModel) { case s: domain.NodeMapping => + NodeMapping(s) } - platform.registerWrapper(PropertyMappingModel) { - case s: domain.PropertyMapping => PropertyMapping(s) + platform.registerWrapper(PropertyMappingModel) { case s: domain.PropertyMapping => + PropertyMapping(s) } - platform.registerWrapper(ObjectPropertyTermModel) { - case s: domain.ObjectPropertyTerm => ObjectPropertyTerm(s) + platform.registerWrapper(ObjectPropertyTermModel) { case s: domain.ObjectPropertyTerm => + ObjectPropertyTerm(s) } - platform.registerWrapper(UnionNodeMappingModel) { - case s: domain.UnionNodeMapping => UnionNodeMapping(s) + platform.registerWrapper(UnionNodeMappingModel) { case s: domain.UnionNodeMapping => + UnionNodeMapping(s) } - platform.registerWrapper(DatatypePropertyTermModel) { - case s: domain.DatatypePropertyTerm => DatatypePropertyTerm(s) + platform.registerWrapper(DatatypePropertyTermModel) { case s: domain.DatatypePropertyTerm => + DatatypePropertyTerm(s) } - platform.registerWrapper(PublicNodeMappingModel) { - case s: domain.PublicNodeMapping => PublicNodeMapping(s) + platform.registerWrapper(PublicNodeMappingModel) { case s: domain.PublicNodeMapping => + PublicNodeMapping(s) } - platform.registerWrapper(DocumentMappingModel) { - case s: domain.DocumentMapping => DocumentMapping(s) + platform.registerWrapper(DocumentMappingModel) { case s: domain.DocumentMapping => + DocumentMapping(s) } - platform.registerWrapper(DocumentsModelModel) { - case s: domain.DocumentsModel => DocumentsModel(s) + platform.registerWrapper(DocumentsModelModel) { case s: domain.DocumentsModel => + DocumentsModel(s) } - platform.registerWrapper(VocabularyReferenceModel) { - case s: domain.VocabularyReference => VocabularyReference(s) + platform.registerWrapper(VocabularyReferenceModel) { case s: domain.VocabularyReference => + VocabularyReference(s) } - platform.registerWrapper(AnnotationMappingModel) { - case s: domain.AnnotationMapping => AnnotationMapping(s) + platform.registerWrapper(AnnotationMappingModel) { case s: domain.AnnotationMapping => + AnnotationMapping(s) } - platform.registerWrapper(SemanticExtensionModel) { - case s: domain.SemanticExtension => SemanticExtension(s) + platform.registerWrapper(SemanticExtensionModel) { case s: domain.SemanticExtension => + SemanticExtension(s) } - platform.registerWrapper(VocabularyModel) { - case s: document.Vocabulary => new Vocabulary(s) + platform.registerWrapper(VocabularyModel) { case s: document.Vocabulary => + new Vocabulary(s) } - platform.registerWrapper(DialectModel) { - case s: document.Dialect => Dialect(s) + platform.registerWrapper(DialectModel) { case s: document.Dialect => + Dialect(s) } - platform.registerWrapper(DialectFragmentModel) { - case s: document.DialectFragment => new DialectFragment(s) + platform.registerWrapper(DialectFragmentModel) { case s: document.DialectFragment => + new DialectFragment(s) } - platform.registerWrapper(DialectLibraryModel) { - case s: document.DialectLibrary => new DialectLibrary(s) + platform.registerWrapper(DialectLibraryModel) { case s: document.DialectLibrary => + new DialectLibrary(s) } - platform.registerWrapper(DialectInstanceModel) { - case s: document.DialectInstance => new DialectInstance(s) + platform.registerWrapper(DialectInstanceModel) { case s: document.DialectInstance => + new DialectInstance(s) } - platform.registerWrapper(DialectInstancePatchModel) { - case s: document.DialectInstancePatch => new DialectInstancePatch(s) + platform.registerWrapper(DialectInstancePatchModel) { case s: document.DialectInstancePatch => + new DialectInstancePatch(s) } - platform.registerWrapper(DialectInstanceFragmentModel) { - case s: document.DialectInstanceFragment => new DialectInstanceFragment(s) + platform.registerWrapper(DialectInstanceFragmentModel) { case s: document.DialectInstanceFragment => + new DialectInstanceFragment(s) } - platform.registerWrapper(DialectInstanceLibraryModel) { - case s: document.DialectInstanceLibrary => new DialectInstanceLibrary(s) + platform.registerWrapper(DialectInstanceLibraryModel) { case s: document.DialectInstanceLibrary => + new DialectInstanceLibrary(s) } - platform.registerWrapper(DialectInstanceProcessingDataModel) { - case s: document.DialectInstanceProcessingData => DialectInstanceProcessingData(s) + platform.registerWrapper(DialectInstanceProcessingDataModel) { case s: document.DialectInstanceProcessingData => + DialectInstanceProcessingData(s) } } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/validate/AMFDialectValidations.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/validate/AMFDialectValidations.scala index ca0d120a..3c09f823 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/validate/AMFDialectValidations.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/validate/AMFDialectValidations.scala @@ -1,8 +1,9 @@ package amf.aml.internal.validate import amf.aml.client.scala.model.document.Dialect +import amf.aml.client.scala.model.domain.NodeMappable.AnyNodeMappable import amf.aml.client.scala.model.domain._ -import amf.aml.internal.render.emitters.instances.{AmlEmittersHelper, NodeMappableFinder} +import amf.aml.internal.render.emitters.instances.{AmlEmittersHelper, DialectIndex, NodeMappableFinder} import amf.aml.internal.validate.AMFDialectValidations.staticValidations import amf.core.client.common.validation.{ProfileName, SeverityLevels} import amf.core.client.scala.model.{DataType, StrField} @@ -19,8 +20,9 @@ import amf.core.internal.validation.core.{ import scala.collection.mutable import scala.collection.mutable.ListBuffer -class AMFDialectValidations(val dialect: Dialect)(implicit val nodeMappableFinder: NodeMappableFinder) - extends AmlEmittersHelper { +class AMFDialectValidations(val dialect: Dialect)(implicit val nodeMappableFinder: NodeMappableFinder) { + + private val index = DialectIndex(dialect, nodeMappableFinder) def profile(): ValidationProfile = { val parsedValidations = validations() @@ -28,13 +30,17 @@ class AMFDialectValidations(val dialect: Dialect)(implicit val nodeMappableFinde // TODO: dialect validation profile does not take into account severities of static validations ValidationProfile( - name = ProfileName(dialect.nameAndVersion()), - baseProfile = None, - validations = parsedValidations ++ staticValidations, - severities = severityMapping + name = ProfileName(dialect.nameAndVersion()), + baseProfile = None, + validations = parsedValidations ++ staticValidations, + severities = severityMapping ) } + def propertyValidations(mapping: NodeMapping): Seq[ValidationSpecification] = { + mapping.propertiesMapping().flatMap(emitPropertyValidations(mapping, _)) + } + protected def validations(): Seq[ValidationSpecification] = { val mappingValidations = dialect.declares.flatMap { case nodeMapping: NodeMapping => emitEntityValidations(nodeMapping, mutable.Set()) @@ -45,12 +51,13 @@ class AMFDialectValidations(val dialect: Dialect)(implicit val nodeMappableFinde } protected def emitExtensionValidations(extension: SemanticExtension): List[ValidationSpecification] = { - lookupAnnotation(extension) - .map { mapping => - val classTarget = mapping.domain().option() - emitPropertyValidations(mapping, mapping, Option(extension.extensionName()), classTarget) + lookupAnnotation(extension).toList + .flatMap { mapping => + val targets = mapping.domain().flatMap(_.option()) + targets.flatMap { classTarget => + emitPropertyValidations(mapping, mapping, Option(extension.extensionName()), Some(classTarget)) + } } - .getOrElse(List.empty) } protected def lookupAnnotation(extension: SemanticExtension): Option[AnnotationMapping] = { @@ -59,8 +66,10 @@ class AMFDialectValidations(val dialect: Dialect)(implicit val nodeMappableFinde } } - protected def emitEntityValidations(node: NodeMapping, - recursion: mutable.Set[String]): List[ValidationSpecification] = { + protected def emitEntityValidations( + node: NodeMapping, + recursion: mutable.Set[String] + ): List[ValidationSpecification] = { node .propertiesMapping() .flatMap { propertyMapping => @@ -69,12 +78,14 @@ class AMFDialectValidations(val dialect: Dialect)(implicit val nodeMappableFinde .toList } - protected def emitRootUnionNodeMapping(nodeMapping: UnionNodeMapping, - recursion: mutable.Set[String]): List[ValidationSpecification] = { + protected def emitRootUnionNodeMapping( + nodeMapping: UnionNodeMapping, + recursion: mutable.Set[String] + ): List[ValidationSpecification] = { val validations: ListBuffer[ValidationSpecification] = ListBuffer.empty val range = nodeMapping.objectRange().map(_.value()) range.foreach { rangeId => - findNodeMappingById(rangeId) match { + index.findNodeMappingById(rangeId) match { case (_, nodeMapping: NodeMapping) => validations ++= emitEntityValidations(nodeMapping, recursion += nodeMapping.id) case _ => @@ -84,10 +95,12 @@ class AMFDialectValidations(val dialect: Dialect)(implicit val nodeMappableFinde validations.toList } - protected def emitPropertyValidations(node: NodeMappable, - prop: PropertyLikeMapping[_], - propertyName: Option[StrField] = None, - targetClass: Option[String] = None): List[ValidationSpecification] = { + protected def emitPropertyValidations( + node: AnyNodeMappable, + prop: PropertyLikeMapping[_], + propertyName: Option[StrField] = None, + targetClass: Option[String] = None + ): List[ValidationSpecification] = { val validations: ListBuffer[ValidationSpecification] = ListBuffer.empty val finalTargetClass = targetClass.getOrElse(node.id) @@ -95,71 +108,81 @@ class AMFDialectValidations(val dialect: Dialect)(implicit val nodeMappableFinde prop.minimum().option().foreach { minValue => val message = s"Property '${finalPropName}' minimum inclusive value is $minValue" validations += new ValidationSpecification( - name = validationId(node, finalPropName.value(), "minimum"), - message = message, - ramlMessage = Some(message), - oasMessage = Some(message), - targetClass = Seq(finalTargetClass), - propertyConstraints = Seq(PropertyConstraint( - ramlPropertyId = prop.nodePropertyMapping().value(), - name = validationId(node, finalPropName.value(), "minimum") + "/prop", - message = Some(message), - minInclusive = Some(minValue.toString) - )) + name = validationId(node, finalPropName.value(), "minimum"), + message = message, + ramlMessage = Some(message), + oasMessage = Some(message), + targetClass = Set(finalTargetClass), + propertyConstraints = Seq( + PropertyConstraint( + ramlPropertyId = prop.nodePropertyMapping().value(), + name = validationId(node, finalPropName.value(), "minimum") + "/prop", + message = Some(message), + minInclusive = Some(minValue.toString) + ) + ) ) } prop.maximum().option().foreach { maxValue => val message = s"Property '${finalPropName}' maximum inclusive value is $maxValue" validations += new ValidationSpecification( - name = validationId(node, finalPropName.value(), "maximum"), - message = message, - ramlMessage = Some(message), - oasMessage = Some(message), - targetClass = Seq(finalTargetClass), - propertyConstraints = Seq(PropertyConstraint( - ramlPropertyId = prop.nodePropertyMapping().value(), - name = validationId(node, finalPropName.value(), "maximum") + "/prop", - message = Some(message), - maxInclusive = Some(maxValue.toString) - )) + name = validationId(node, finalPropName.value(), "maximum"), + message = message, + ramlMessage = Some(message), + oasMessage = Some(message), + targetClass = Set(finalTargetClass), + propertyConstraints = Seq( + PropertyConstraint( + ramlPropertyId = prop.nodePropertyMapping().value(), + name = validationId(node, finalPropName.value(), "maximum") + "/prop", + message = Some(message), + maxInclusive = Some(maxValue.toString) + ) + ) ) } - if (prop.minCount().nonNull && prop.minCount().value() > 0) { + // Mandatory field will be validated along with minCount + if (prop.minCount().nonNull) { val message = s"Property '${finalPropName}' is mandatory" validations += new ValidationSpecification( - name = validationId(node, finalPropName.value(), "required"), - message = message, - ramlMessage = Some(message), - oasMessage = Some(message), - targetClass = Seq(finalTargetClass), - propertyConstraints = Seq( - PropertyConstraint( - ramlPropertyId = prop.nodePropertyMapping().value(), - name = validationId(node, finalPropName.value(), "required") + "/prop", - message = Some(message), - minCount = Some("1") - )) + name = validationId(node, finalPropName.value(), "required"), + message = message, + ramlMessage = Some(message), + oasMessage = Some(message), + targetClass = Set(finalTargetClass), + propertyConstraints = Seq( + PropertyConstraint( + ramlPropertyId = prop.nodePropertyMapping().value(), + name = validationId(node, finalPropName.value(), "required") + "/prop", + message = Some(message), + minCount = prop.minCount().option().map(_.toString), + mandatory = prop.mandatory().option().map(_.toString) + ) + ) ) } - if (!prop.allowMultiple().value() && prop - .isInstanceOf[PropertyMapping] && prop.asInstanceOf[PropertyMapping].mapTermKeyProperty().isNullOrEmpty) { + if ( + !prop.allowMultiple().value() && prop + .isInstanceOf[PropertyMapping] && prop.asInstanceOf[PropertyMapping].mapTermKeyProperty().isNullOrEmpty + ) { val message = s"Property '${finalPropName}' cannot have more than 1 value" validations += new ValidationSpecification( - name = validationId(node, finalPropName.value(), "notCollection"), - message = message, - ramlMessage = Some(message), - oasMessage = Some(message), - targetClass = Seq(finalTargetClass), - propertyConstraints = Seq( - PropertyConstraint( - ramlPropertyId = prop.nodePropertyMapping().value(), - name = validationId(node, finalPropName.value(), "notCollection") + "/prop", - message = Some(message), - maxCount = Some("1") - )) + name = validationId(node, finalPropName.value(), "notCollection"), + message = message, + ramlMessage = Some(message), + oasMessage = Some(message), + targetClass = Set(finalTargetClass), + propertyConstraints = Seq( + PropertyConstraint( + ramlPropertyId = prop.nodePropertyMapping().value(), + name = validationId(node, finalPropName.value(), "notCollection") + "/prop", + message = Some(message), + maxCount = Some("1") + ) + ) ) } @@ -167,18 +190,19 @@ class AMFDialectValidations(val dialect: Dialect)(implicit val nodeMappableFinde case Some(pattern) => val message = s"Property '${finalPropName}' must match pattern $pattern" validations += new ValidationSpecification( - name = validationId(node, finalPropName.value(), "pattern"), - message = message, - ramlMessage = Some(message), - oasMessage = Some(message), - targetClass = Seq(finalTargetClass), - propertyConstraints = Seq( - PropertyConstraint( - ramlPropertyId = prop.nodePropertyMapping().value(), - name = validationId(node, finalPropName.value(), "pattern") + "/prop", - message = Some(message), - pattern = Some(pattern) - )) + name = validationId(node, finalPropName.value(), "pattern"), + message = message, + ramlMessage = Some(message), + oasMessage = Some(message), + targetClass = Set(finalTargetClass), + propertyConstraints = Seq( + PropertyConstraint( + ramlPropertyId = prop.nodePropertyMapping().value(), + name = validationId(node, finalPropName.value(), "pattern") + "/prop", + message = Some(message), + pattern = Some(pattern) + ) + ) ) case _ => // ignore } @@ -187,20 +211,19 @@ class AMFDialectValidations(val dialect: Dialect)(implicit val nodeMappableFinde val values = prop.enum().map(_.value()) val message = s"Property '${finalPropName}' must match some value in ${values.mkString(",")}" validations += new ValidationSpecification( - name = validationId(node, finalPropName.value(), "enum"), - message = message, - ramlMessage = Some(message), - oasMessage = Some(message), - targetClass = Seq(finalTargetClass), - propertyConstraints = Seq( - PropertyConstraint( - ramlPropertyId = prop.nodePropertyMapping().value(), - name = validationId(node, finalPropName.value(), "enum") + "/prop", - message = Some(message), - in = values.map { v => - s"$v" - } - )) + name = validationId(node, finalPropName.value(), "enum"), + message = message, + ramlMessage = Some(message), + oasMessage = Some(message), + targetClass = Set(finalTargetClass), + propertyConstraints = Seq( + PropertyConstraint( + ramlPropertyId = prop.nodePropertyMapping().value(), + name = validationId(node, finalPropName.value(), "enum") + "/prop", + message = Some(message), + in = values.toSet + ) + ) ) } @@ -214,81 +237,87 @@ class AMFDialectValidations(val dialect: Dialect)(implicit val nodeMappableFinde case DataType.Number | DataType.Float | DataType.Double => val message = s"Property '${finalPropName}' value must be of type ${DataType.Integer} or ${DataType.Float}" validations += new ValidationSpecification( - name = validationId(node, finalPropName.value(), "dialectRange"), - message = message, - ramlMessage = Some(message), - oasMessage = Some(message), - targetClass = Seq(finalTargetClass), - propertyConstraints = Seq( - PropertyConstraint( - ramlPropertyId = prop.nodePropertyMapping().value(), - name = validationId(node, finalPropName.value(), "dialectRange") + "/prop", - message = Some(message), - datatype = Some(DataType.Double) - )) + name = validationId(node, finalPropName.value(), "dialectRange"), + message = message, + ramlMessage = Some(message), + oasMessage = Some(message), + targetClass = Set(finalTargetClass), + propertyConstraints = Seq( + PropertyConstraint( + ramlPropertyId = prop.nodePropertyMapping().value(), + name = validationId(node, finalPropName.value(), "dialectRange") + "/prop", + message = Some(message), + datatype = Some(DataType.Double) + ) + ) ) case DataType.Link => val message = s"Property '${finalPropName}' value must be of a link" validations += new ValidationSpecification( - name = validationId(node, finalPropName.value(), "dialectRange"), - message = message, - ramlMessage = Some(message), - oasMessage = Some(message), - targetClass = Seq(finalTargetClass), - propertyConstraints = Seq( - PropertyConstraint( - ramlPropertyId = prop.nodePropertyMapping().value(), - name = validationId(node, finalPropName.value(), "dialectRange") + "/prop", - message = Some(message), - datatype = Some(DataType.AnyUri) - )) + name = validationId(node, finalPropName.value(), "dialectRange"), + message = message, + ramlMessage = Some(message), + oasMessage = Some(message), + targetClass = Set(finalTargetClass), + propertyConstraints = Seq( + PropertyConstraint( + ramlPropertyId = prop.nodePropertyMapping().value(), + name = validationId(node, finalPropName.value(), "dialectRange") + "/prop", + message = Some(message), + datatype = Some(DataType.AnyUri) + ) + ) ) case literal if literal.endsWith("guid") => val message = s"Property '${finalPropName}' value must be of type xsd:string > $dataRange" validations += new ValidationSpecification( - name = validationId(node, finalPropName.value(), "dataRange"), - message = message, - ramlMessage = Some(message), - oasMessage = Some(message), - targetClass = Seq(finalTargetClass), - propertyConstraints = Seq( - PropertyConstraint( - ramlPropertyId = prop.nodePropertyMapping().value(), - name = validationId(node, finalPropName.value(), "dataRange") + "/prop", - message = Some(message), - datatype = Some((Namespace.Xsd + "string").iri()) - )) + name = validationId(node, finalPropName.value(), "dataRange"), + message = message, + ramlMessage = Some(message), + oasMessage = Some(message), + targetClass = Set(finalTargetClass), + propertyConstraints = Seq( + PropertyConstraint( + ramlPropertyId = prop.nodePropertyMapping().value(), + name = validationId(node, finalPropName.value(), "dataRange") + "/prop", + message = Some(message), + datatype = Some((Namespace.Xsd + "string").iri()) + ) + ) ) case literal => val message = s"Property '${finalPropName}' value must be of type $dataRange" validations += new ValidationSpecification( - name = validationId(node, finalPropName.value(), "dataRange"), - message = message, - ramlMessage = Some(message), - oasMessage = Some(message), - targetClass = Seq(finalTargetClass), - propertyConstraints = Seq( - PropertyConstraint( - ramlPropertyId = prop.nodePropertyMapping().value(), - name = validationId(node, finalPropName.value(), "dataRange") + "/prop", - message = Some(message), - datatype = Some(literal) - )) + name = validationId(node, finalPropName.value(), "dataRange"), + message = message, + ramlMessage = Some(message), + oasMessage = Some(message), + targetClass = Set(finalTargetClass), + propertyConstraints = Seq( + PropertyConstraint( + ramlPropertyId = prop.nodePropertyMapping().value(), + name = validationId(node, finalPropName.value(), "dataRange") + "/prop", + message = Some(message), + datatype = Some(literal) + ) + ) ) } } - if (prop.objectRange().nonEmpty && - !prop.objectRange().map(_.value()).contains((Namespace.Meta + "anyNode").iri()) && - !prop.externallyLinkable().option().getOrElse(false)) { + if ( + prop.objectRange().nonEmpty && + !prop.objectRange().map(_.value()).contains((Namespace.Meta + "anyNode").iri()) && + !prop.externallyLinkable().option().getOrElse(false) + ) { val effectiveRange: Set[String] = prop .objectRange() .flatMap({ rangeId => - findNodeMappingById(rangeId.value()) match { + index.findNodeMappingById(rangeId.value()) match { case (_, nodeMapping: NodeMapping) => Seq(nodeMapping.id) case (_, unionMapping: UnionNodeMapping) => unionMapping.objectRange().map(_.value()) case _ => Seq.empty @@ -298,25 +327,26 @@ class AMFDialectValidations(val dialect: Dialect)(implicit val nodeMappableFinde val message = s"Property '${finalPropName}' value must be of type ${prop.objectRange()}" validations += new ValidationSpecification( - name = validationId(node, finalPropName.value(), "objectRange"), - message = message, - ramlMessage = Some(message), - oasMessage = Some(message), - targetClass = Seq(finalTargetClass), - propertyConstraints = Seq( - PropertyConstraint( - ramlPropertyId = prop.nodePropertyMapping().value(), - name = validationId(node, finalPropName.value(), "objectRange") + "/prop", - message = Some(message), - `class` = effectiveRange.toSeq - )) + name = validationId(node, finalPropName.value(), "objectRange"), + message = message, + ramlMessage = Some(message), + oasMessage = Some(message), + targetClass = Set(finalTargetClass), + propertyConstraints = Seq( + PropertyConstraint( + ramlPropertyId = prop.nodePropertyMapping().value(), + name = validationId(node, finalPropName.value(), "objectRange") + "/prop", + message = Some(message), + `class` = effectiveRange.toSeq + ) + ) ) } validations.toList } - private def validationId(dialectNode: NodeMappable, propName: String, constraint: String): String = + private def validationId(dialectNode: AnyNodeMappable, propName: String, constraint: String): String = Option(dialectNode.id) match { case Some(id) => s"${id}_${propName.urlComponentEncoded}_${constraint}_validation" case None => throw new Exception("Cannot generate validation for dialect node without ID") diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/validate/AMLValidationPlugin.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/validate/AMLValidationPlugin.scala index 629624a6..769203f4 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/validate/AMLValidationPlugin.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/validate/AMLValidationPlugin.scala @@ -19,8 +19,9 @@ class AMLValidationPlugin() extends AMFValidatePlugin { override def applies(info: ValidationInfo): Boolean = info.baseUnit.isInstanceOf[DialectInstanceUnit] - override def validate(unit: BaseUnit, options: ValidationOptions)( - implicit executionContext: ExecutionContext): Future[ValidationResult] = { + override def validate(unit: BaseUnit, options: ValidationOptions)(implicit + executionContext: ExecutionContext + ): Future[ValidationResult] = { AMLValidator.validate(unit, options) } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/validate/AMLValidator.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/validate/AMLValidator.scala index 7e39ec29..6c235357 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/validate/AMLValidator.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/validate/AMLValidator.scala @@ -22,8 +22,9 @@ import scala.concurrent.{ExecutionContext, Future} object AMLValidator extends ShaclReportAdaptation with SemanticExtensionConstraints { - def validate(baseUnit: BaseUnit, options: ValidationOptions)( - implicit executionContext: ExecutionContext): Future[ValidationResult] = { + def validate(baseUnit: BaseUnit, options: ValidationOptions)(implicit + executionContext: ExecutionContext + ): Future[ValidationResult] = { val configuration = options.config val amfConfig = options.config.amfConfig @@ -43,21 +44,19 @@ object AMLValidator extends ShaclReportAdaptation with SemanticExtensionConstrai computeValidationProfilesOfDependencies(dialectInstance, knownDialects, configuration.constraints) val validator = new CustomShaclValidator(Map.empty, instanceProfile.messageStyle) val finalValidations = addValidations(validations, validationsFromDeps) - for { - shaclReport <- validator.validate(resolvedModel, finalValidations.effective.values.toSeq) - } yield { - val report = adaptToAmfReport(baseUnit, instanceProfile, shaclReport, validations) - ValidationResult(resolvedModel, report) - } - + val shaclLikeReport = validator.validate(resolvedModel, finalValidations.effective.values.toSeq) + val report = adaptToAmfReport(baseUnit, instanceProfile, shaclLikeReport, validations) + Future.successful(ValidationResult(resolvedModel, report)) case _ => notifyValidationSkipped(options) Future.successful(ValidationResult(baseUnit, AMFValidationReport.empty(baseUnit.id, UnknownProfile))) } } - private def buildValidations(profile: ProfileName, - constraints: Map[ProfileName, ValidationProfile]): EffectiveValidations = { + private def buildValidations( + profile: ProfileName, + constraints: Map[ProfileName, ValidationProfile] + ): EffectiveValidations = { val instanceValidations = EffectiveValidationsCompute .build(profile, constraints) .getOrElse(EffectiveValidations()) @@ -65,8 +64,8 @@ object AMLValidator extends ShaclReportAdaptation with SemanticExtensionConstrai } private def collectDialects(amfConfig: => AMFGraphConfiguration) = { - amfConfig.registry.getPluginsRegistry.parsePlugins.collect { - case plugin: AMLDialectInstanceParsingPlugin => plugin.dialect + amfConfig.registry.getPluginsRegistry.rootParsePlugins.collect { case plugin: AMLDialectInstanceParsingPlugin => + plugin.dialect } } @@ -79,7 +78,8 @@ object AMLValidator extends ShaclReportAdaptation with SemanticExtensionConstrai private def computeValidationProfilesOfDependencies( dialectInstance: DialectInstanceUnit, knownDialects: Seq[Dialect], - constraints: Map[ProfileName, ValidationProfile])(implicit executionContext: ExecutionContext) = { + constraints: Map[ProfileName, ValidationProfile] + )(implicit executionContext: ExecutionContext) = { @silent("deprecated") // Silent can only be used in assignment expressions val graphDependencies = if (dialectInstance.processingData.graphDependencies.nonEmpty) { @@ -95,10 +95,12 @@ object AMLValidator extends ShaclReportAdaptation with SemanticExtensionConstrai } - private def addValidations(validations: EffectiveValidations, - dependenciesValidations: Seq[ValidationProfile]): EffectiveValidations = { - dependenciesValidations.foldLeft(validations) { - case (effective, profile) => effective.someEffective(profile) + private def addValidations( + validations: EffectiveValidations, + dependenciesValidations: Seq[ValidationProfile] + ): EffectiveValidations = { + dependenciesValidations.foldLeft(validations) { case (effective, profile) => + effective.someEffective(profile) } } } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/validate/DialectEnumValidationPlugin.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/validate/DialectEnumValidationPlugin.scala new file mode 100644 index 00000000..0b085245 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/validate/DialectEnumValidationPlugin.scala @@ -0,0 +1,28 @@ +package amf.aml.internal.validate + +import amf.aml.client.scala.model.document.Dialect +import amf.core.client.common.{HighPriority, PluginPriority} +import amf.core.client.scala.model.document.BaseUnit +import amf.core.internal.plugins.validation.{AMFValidatePlugin, ValidationInfo, ValidationOptions, ValidationResult} +import amf.core.internal.validation.ShaclReportAdaptation + +import scala.concurrent.{ExecutionContext, Future} + +object DialectEnumValidationPlugin extends AMFValidatePlugin { + override val id: String = "dialect-enum-validation-plugin" + + override def priority: PluginPriority = HighPriority + + override def applies(element: ValidationInfo): Boolean = element.baseUnit.isInstanceOf[Dialect] + + override def validate(unit: BaseUnit, options: ValidationOptions)(implicit + executionContext: ExecutionContext + ): Future[ValidationResult] = { + unit match { + case dialect: Dialect => + val validator = DialectEnumValidator() + val report = validator.validate(dialect) + Future.successful(ValidationResult(dialect, report)) + } + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/validate/DialectEnumValidator.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/validate/DialectEnumValidator.scala new file mode 100644 index 00000000..40e00b4a --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/validate/DialectEnumValidator.scala @@ -0,0 +1,92 @@ +package amf.aml.internal.validate + +import amf.aml.client.scala.model.document.Dialect +import amf.aml.client.scala.model.domain.DialectDomainElement +import amf.aml.internal.parse.instances.parser.LiteralValueParser +import amf.aml.internal.render.emitters.instances.DefaultNodeMappableFinder +import amf.core.client.common.validation.{AMFStyle, AmlProfile, ProfileName} +import amf.core.client.scala.errorhandling.DefaultErrorHandler +import amf.core.client.scala.model.domain.AmfScalar +import amf.core.client.scala.model.{BoolField, DoubleField, FloatField, IntField, StrField, ValueField} +import amf.core.client.scala.validation.AMFValidationReport +import amf.core.internal.annotations.LexicalInformation +import amf.core.internal.parser.domain.Annotations +import amf.core.internal.plugins.syntax.SyamlAMFErrorHandler +import amf.core.internal.validation.ShaclReportAdaptation +import amf.core.internal.validation.core.{ValidationReport, ValidationSpecification} +import amf.validation.internal.shacl.custom.{CustomShaclValidator, ScalarElementExtractor} +import org.yaml.model.{YNode, YScalar} + +case class DialectEnumValidator() extends ShaclReportAdaptation { + + def validate(dialect: Dialect): AMFValidationReport = { + val candidates = LiteralCandidateCollector.collect(dialect) + val reports = candidates.map { candidate => + val eh = + new SyamlAMFErrorHandler( + DefaultErrorHandler() + ) // create error handler for each candidate to avoid duplicating errors in report + validateCandidate(dialect, eh, candidate) + } + val mergedReport = mergeReports(dialect, reports) + mergedReport + } + + private def validateCandidate(dialect: Dialect, eh: SyamlAMFErrorHandler, candidate: AmlValidationCandidate) = { + val validations = + new AMFDialectValidations(dialect)(DefaultNodeMappableFinder(dialect)) + .propertyValidations(candidate.node) + .filter( + _.propertyConstraints.exists(_.ramlPropertyId == candidate.mapping.nodePropertyMapping().value()) + ) // should optimize this + val nodes = candidate.enums.flatMap(toNode) + parseErrors(eh, candidate, nodes) + val reports = nodes.map { case (_, scalar) => + val report = validate(scalar, candidate, validations) + adaptToAmfReport( + dialect, + AmlProfile, + report, + scalar.annotations.location(), + LexicalInformation(scalar.annotations.lexical()) + ) + } + val mergedReport: AMFValidationReport = mergeReports(dialect, reports) + mergedReport.copy(results = mergedReport.results ++ eh.getResults) + } + + private def mergeReports(dialect: Dialect, reports: Seq[AMFValidationReport]) = { + val mergedReport = reports.foldLeft(AMFValidationReport.empty(dialect.id, AmlProfile)) { (acc, curr) => + acc.merge(curr) + } + mergedReport + } + + private def validate( + scalar: AmfScalar, + candidate: AmlValidationCandidate, + validations: Seq[ValidationSpecification] + ): ValidationReport = { + val validator = new CustomShaclValidator(Map.empty, AMFStyle, new ScalarElementExtractor(scalar)) + validator.validateProperties(DialectDomainElement("anId", candidate.node, Annotations()), validations) + } + + private def parseErrors( + eh: SyamlAMFErrorHandler, + candidate: AmlValidationCandidate, + nodes: List[(YNode, AmfScalar)] + ) = { + nodes.foreach { case (node, scalar) => + LiteralValueParser.parseLiteralValue(node, candidate.mapping, "anId", scalar.annotations)(eh) + } + } + + private def toNode(value: Any): Option[(YNode, AmfScalar)] = value match { + case value @ AmfScalar(inner: Boolean, _) => Some(YNode(inner), value) + case value @ AmfScalar(inner: Int, _) => Some(YNode(inner), value) + case value @ AmfScalar(inner: String, _) => Some(YNode(inner), value) + case value @ AmfScalar(inner: Float, _) => Some(YNode(inner), value) + case value @ AmfScalar(inner: Double, _) => Some(YNode(inner), value) + case _ => None + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/validate/DialectValidations.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/validate/DialectValidations.scala index 0e9fad7c..0c3ab5f1 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/validate/DialectValidations.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/validate/DialectValidations.scala @@ -14,108 +14,108 @@ object DialectValidations extends Validations { override val namespace: Namespace = AmfAml val DialectError = validation( - "dialect-error", - "Dialect error" + "dialect-error", + "Dialect error" ) val MissingVocabulary = validation( - "missing-vocabulary", - "Missing vocabulary" + "missing-vocabulary", + "Missing vocabulary" ) val MissingVocabularyTerm = validation( - "missing-vocabulary-term", - "Missing vocabulary term" + "missing-vocabulary-term", + "Missing vocabulary term" ) val MissingBaseTerm = validation( - "missing-base-term", - "Missing base term" + "missing-base-term", + "Missing base term" ) val MissingClassTermSpecification = validation( - "missing-class-term", - "Missing class term" + "missing-class-term", + "Missing class term" ) val MissingPropertyTermSpecification = validation( - "missing-property-term", - "Missing property term" + "missing-property-term", + "Missing property term" ) val MissingFragmentSpecification = validation( - "missing-dialect-fragment", - "Missing dialect fragment" + "missing-dialect-fragment", + "Missing dialect fragment" ) val MissingPropertyRangeSpecification = validation( - "missing-node-mapping-range-term", - "Missing property range term" + "missing-node-mapping-range-term", + "Missing property range term" ) val UnavoidableAmbiguity = validation( - "unavoidable-ambiguity", - "Unavoidable ambiguity" + "unavoidable-ambiguity", + "Unavoidable ambiguity" ) val EventualAmbiguity = validation( - "eventual-ambiguity", - "Eventual ambiguity" + "eventual-ambiguity", + "Eventual ambiguity" ) val DifferentTermsInMapKey = validation( - "different-terms-in-mapkey", - "Different terms in map key" + "different-terms-in-mapkey", + "Different terms in map key" ) val InconsistentPropertyRangeValueSpecification = validation( - "inconsistent-property-range-value", - "Range value does not match the expected type" + "inconsistent-property-range-value", + "Range value does not match the expected type" ) val ClosedShapeSpecification = validation( - "closed-shape", - "Invalid property for node" + "closed-shape", + "Invalid property for node" ) val ClosedShapeSpecificationWarning = validation( - "closed-shape-warning", - "Invalid property for node" + "closed-shape-warning", + "Invalid property for node" ) val MissingPropertySpecification = validation( - "mandatory-property-shape", - "Missing mandatory property" + "mandatory-property-shape", + "Missing mandatory property" ) val InvalidModuleType = validation( - "invalid-module-type", - "Invalid module type" + "invalid-module-type", + "Invalid module type" ) val DialectAmbiguousRangeSpecification = validation( - "dialect-ambiguous-range", - "Ambiguous entity range" + "dialect-ambiguous-range", + "Ambiguous entity range" ) val InvalidUnionType = validation( - "invalid-union-type", - "Union should be a sequence" + "invalid-union-type", + "Union should be a sequence" ) val ExpectedVocabularyModule = validation( - "expected-vocabulary-module", - "Expected vocabulary module" + "expected-vocabulary-module", + "Expected vocabulary module" ) val InvalidDialectPatch = validation( - "invalid-dialect-patch", - "Invalid dialect patch" + "invalid-dialect-patch", + "Invalid dialect patch" ) val GuidRangeWithoutUnique = validation( - "guid-scalar-non-unique", - "GUID scalar type declared without unique constraint" + "guid-scalar-non-unique", + "GUID scalar type declared without unique constraint" ) val PropertyMappingMustBeAMap = validation("property-mapping-must-be-a-map", "Property mapping must be a map") @@ -127,30 +127,30 @@ object DialectValidations extends Validations { // is seems that these severities are not taken into account for aml profile, must be registered in AMFDialectValidations override val levels: Map[String, Map[ProfileName, String]] = Map( - ClosedShapeSpecificationWarning.id -> all(WARNING), - MissingClassTermSpecification.id -> all(WARNING), - MissingPropertyTermSpecification.id -> all(WARNING), - MissingVocabularyTerm.id -> all(WARNING) + ClosedShapeSpecificationWarning.id -> all(WARNING), + MissingClassTermSpecification.id -> all(WARNING), + MissingPropertyTermSpecification.id -> all(WARNING), + MissingVocabularyTerm.id -> all(WARNING) ) override val validations: List[ValidationSpecification] = List( - ClosedShapeSpecification, - DialectAmbiguousRangeSpecification, - InconsistentPropertyRangeValueSpecification, - MissingPropertyRangeSpecification, - MissingClassTermSpecification, - MissingPropertyTermSpecification, - DifferentTermsInMapKey, - MissingFragmentSpecification, - MissingPropertySpecification, - InvalidModuleType, - MissingVocabulary, - MissingVocabularyTerm, - MissingBaseTerm, - InvalidUnionType, - InvalidDialectPatch, - DialectError, - GuidRangeWithoutUnique, - DuplicateTerm + ClosedShapeSpecification, + DialectAmbiguousRangeSpecification, + InconsistentPropertyRangeValueSpecification, + MissingPropertyRangeSpecification, + MissingClassTermSpecification, + MissingPropertyTermSpecification, + DifferentTermsInMapKey, + MissingFragmentSpecification, + MissingPropertySpecification, + InvalidModuleType, + MissingVocabulary, + MissingVocabularyTerm, + MissingBaseTerm, + InvalidUnionType, + InvalidDialectPatch, + DialectError, + GuidRangeWithoutUnique, + DuplicateTerm ) } diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/validate/LiteralCandidateCollector.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/validate/LiteralCandidateCollector.scala new file mode 100644 index 00000000..f37b9278 --- /dev/null +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/validate/LiteralCandidateCollector.scala @@ -0,0 +1,35 @@ +package amf.aml.internal.validate + +import amf.aml.client.scala.model.document.Dialect +import amf.aml.client.scala.model.domain.{NodeMapping, PropertyMapping} +import amf.aml.internal.metamodel.domain.PropertyMappingModel +import amf.core.client.scala.model.domain.{AmfArray, AmfScalar} +import amf.core.internal.metamodel.Field + +case class AmlValidationCandidate(node: NodeMapping, mapping: PropertyMapping, enums: List[AmfScalar]) + +object LiteralCandidateCollector { + + def collect(dialect: Dialect): Seq[AmlValidationCandidate] = collectCandidates(dialect) + + private def collectCandidates(dialect: Dialect) = { + dialect + .iterator() + .collect { case node: NodeMapping => + val properties = node.propertiesMapping().filter(_.`enum`().nonEmpty) + properties.flatMap { mapping => + val scalarEnums = collectScalarValues(mapping, PropertyMappingModel.Enum) + if (scalarEnums.nonEmpty) Some(AmlValidationCandidate(node, mapping, scalarEnums)) + else None + } + } + .toList + .flatten + } + + private def collectScalarValues(mapping: PropertyMapping, field: Field): List[AmfScalar] = + mapping.fields.get(field) match { + case array: AmfArray => array.scalars.toList + case _ => Nil + } +} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/validate/SemanticExtensionConstraints.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/validate/SemanticExtensionConstraints.scala index d45ac4de..c1725ac7 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/validate/SemanticExtensionConstraints.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/validate/SemanticExtensionConstraints.scala @@ -9,7 +9,8 @@ trait SemanticExtensionConstraints { protected def withSemanticExtensionsConstraints( validations: EffectiveValidations, - constraints: Map[ProfileName, ValidationProfile]): EffectiveValidations = { + constraints: Map[ProfileName, ValidationProfile] + ): EffectiveValidations = { constraints .get(DialectRegister.SEMANTIC_EXTENSIONS_PROFILE) .map(profile => validations.someEffective(profile)) diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/validate/ValidationDialectText.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/validate/ValidationDialectText.scala deleted file mode 100644 index 6c4fd533..00000000 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/validate/ValidationDialectText.scala +++ /dev/null @@ -1,303 +0,0 @@ -package amf.aml.internal.validate - -object ValidationDialectText { - - def text: String = - """ - |#%Dialect 1.0 - | - |dialect: Validation Profile - |version: 1.0 - |usage: Dialect to describe validations over RAML documents - |external: - | schema-org: "http://schema.org/" - | shacl: "http://www.w3.org/ns/shacl#" - | validation: "http://a.ml/vocabularies/amf-validation#" - |nodeMappings: - | functionConstraintNode: - | classTerm: shacl.JSConstraint - | mapping: - | message: - | propertyTerm: shacl.message - | range: string - | code: - | range: string - | propertyTerm: validation.jsCode - | #pattern: '^function\(.+\)\s*\{.+\}$' - | libraries: - | propertyTerm: shacl.jsLibrary - | range: string - | allowMultiple: true - | functionName: - | propertyTerm: shacl.jsFunctionName - | range: string - | propertyConstraintNode: - | classTerm: shacl.PropertyShape - | mapping: - | message: - | propertyTerm: shacl.message - | range: string - | name: - | propertyTerm: validation.ramlPropertyId - | mandatory: true - | range: string - | pattern: - | propertyTerm: shacl.pattern - | range: string - | maxCount: - | propertyTerm: shacl.maxCount - | range: integer - | minCount: - | propertyTerm: shacl.minCount - | range: integer - | minExclusive: - | propertyTerm: shacl.minExclusive - | range: number - | maxExclusive: - | propertyTerm: shacl.maxExclusive - | range: number - | minInclusive: - | propertyTerm: shacl.minInclusive - | range: number - | maxInclusive: - | propertyTerm: shacl.maxInclusive - | range: number - | datatype: - | propertyTerm: shacl.datatype - | range: string - | in: - | propertyTerm: shacl.in - | allowMultiple: true - | range: any - | nested: - | propertyTerm: shacl.node - | range: [ shapeValidationNode, queryValidationNode, functionValidationNode, xoneShapeValidationNode, orShapeValidationNode, notShapeValidationNode, andShapeValidationNode] - | atLeast: - | propertyTerm: shacl.atLeastNode - | range: qualifiedShapeValidationNode - | atMost: - | propertyTerm: shacl.atMostNode - | range: qualifiedShapeValidationNode - | equalsToProperty: - | propertyTerm: shacl.equals - | range: string - | disjointWithProperty: - | propertyTerm: shacl.disjoint - | range: string - | lessThanProperty: - | propertyTerm: shacl.lessThan - | range: string - | lessThanOrEqualsToProperty: - | propertyTerm: shacl.lessThanOrEquals - | range: string - | functionValidationNode: - | classTerm: validation.FunctionValidation - | mapping: - | name: - | propertyTerm: schema-org.name - | range: string - | message: - | propertyTerm: shacl.message - | range: string - | targetClass: - | propertyTerm: validation.ramlClassId - | range: string - | allowMultiple: true - | functionConstraint: - | mandatory: true - | propertyTerm: shacl.js - | range: functionConstraintNode - | qualifiedShapeValidationNode: - | classTerm: validation.QualifiedShapevalidationNode - | mapping: - | count: - | propertyTerm: shacl.count - | range: integer - | mandatory: true - | validation: - | propertyTerm: shacl.valueShape - | range: [ shapeValidationNode, queryValidationNode, functionValidationNode, xoneShapeValidationNode, orShapeValidationNode, notShapeValidationNode, andShapeValidationNode] - | mandatory: true - | shapeValidationNode: - | classTerm: validation.ShapeValidation - | mapping: - | name: - | propertyTerm: schema-org.name - | range: string - | message: - | propertyTerm: shacl.message - | range: string - | targetClass: - | propertyTerm: validation.ramlClassId - | range: string - | allowMultiple: true - | classConstraints: - | propertyTerm: shacl.class - | range: string - | allowMultiple: true - | propertyConstraints: - | mandatory: true - | propertyTerm: shacl.property - | mapKey: name - | range: propertyConstraintNode - | andShapeValidationNode: - | classTerm: validation.AndShapeValidation - | mapping: - | name: - | propertyTerm: schema-org.name - | range: string - | message: - | propertyTerm: shacl.message - | range: string - | targetClass: - | propertyTerm: validation.ramlClassId - | range: string - | allowMultiple: true - | and: - | propertyTerm: shacl.and - | range: [ shapeValidationNode, queryValidationNode, functionValidationNode, xoneShapeValidationNode, orShapeValidationNode, notShapeValidationNode, andShapeValidationNode] - | allowMultiple: true - | mandatory: true - | notShapeValidationNode: - | classTerm: validation.NotShapeValidation - | mapping: - | name: - | propertyTerm: schema-org.name - | range: string - | message: - | propertyTerm: shacl.message - | range: string - | targetClass: - | propertyTerm: validation.ramlClassId - | range: string - | allowMultiple: true - | not: - | propertyTerm: shacl.not - | range: [ shapeValidationNode, queryValidationNode, functionValidationNode, xoneShapeValidationNode, orShapeValidationNode, notShapeValidationNode, andShapeValidationNode] - | mandatory: true - | orShapeValidationNode: - | classTerm: validation.OrShapeValidation - | mapping: - | name: - | propertyTerm: schema-org.name - | range: string - | message: - | propertyTerm: shacl.message - | range: string - | targetClass: - | propertyTerm: validation.ramlClassId - | range: string - | allowMultiple: true - | or: - | propertyTerm: shacl.or - | range: [ shapeValidationNode, queryValidationNode, functionValidationNode, xoneShapeValidationNode, orShapeValidationNode, notShapeValidationNode, andShapeValidationNode] - | allowMultiple: true - | mandatory: true - | xoneShapeValidationNode: - | classTerm: validation.XoneShapeValidation - | mapping: - | name: - | propertyTerm: schema-org.name - | range: string - | message: - | propertyTerm: shacl.message - | range: string - | targetClass: - | propertyTerm: validation.ramlClassId - | range: string - | allowMultiple: true - | xone: - | propertyTerm: shacl.xone - | range: [ shapeValidationNode, queryValidationNode, functionValidationNode, xoneShapeValidationNode, orShapeValidationNode, notShapeValidationNode, andShapeValidationNode] - | allowMultiple: true - | mandatory: true - | queryValidationNode: - | classTerm: validation.QueryValidation - | mapping: - | name: - | propertyTerm: schema-org.name - | range: string - | message: - | propertyTerm: shacl.message - | range: string - | targetClass: - | propertyTerm: validation.ramlClassId - | range: string - | allowMultiple: true - | query: - | mandatory: true - | propertyTerm: validation.targetQuery - | range: string - | ramlPrefixNode: - | classTerm: validation.RamlPrefix - | mapping: - | prefix: - | propertyTerm: validation.ramlPrefixName - | range: string - | uri: - | propertyTerm: validation.ramlPrefixUri - | range: string - | - | profileNode: - | classTerm: validation.Profile - | mapping: - | prefixes: - | propertyTerm: validation.ramlPrefixes - | mapKey: prefix - | mapValue: uri - | range: ramlPrefixNode - | profile: - | propertyTerm: schema-org.name - | mandatory: true - | range: string - | description: - | propertyTerm: schema-org.description - | range: string - | extends: - | propertyTerm: validation.extendsProfile - | range: string - | violation: - | propertyTerm: validation.setSeverityViolation - | range: string - | allowMultiple: true - | info: - | propertyTerm: validation.setSeverityInfo - | range: string - | allowMultiple: true - | warning: - | propertyTerm: validation.setSeverityWarning - | range: string - | allowMultiple: true - | disabled: - | propertyTerm: validation.disableValidation - | range: string - | allowMultiple: true - | validations: - | propertyTerm: validation.validations - | mapKey: name - | range: [ shapeValidationNode, queryValidationNode, functionValidationNode, xoneShapeValidationNode, orShapeValidationNode, notShapeValidationNode, andShapeValidationNode] - - | validationShapesUnion: - | union: - | - shapeValidationNode - | - queryValidationNode - | - xoneShapeValidationNode - | - orShapeValidationNode - | - notShapeValidationNode - | - andShapeValidationNode - | - |documents: - | fragments: - | encodes: - | ShapeValidation: queryValidationNode - | FunctionValidation: functionValidationNode - | - | library: - | declares: - | validations: validationShapesUnion - | functions: functionValidationNode - | - | root: - | encodes: profileNode - """.stripMargin -} diff --git a/amf-aml/shared/src/main/scala/amf/aml/internal/validate/custom/Model.scala b/amf-aml/shared/src/main/scala/amf/aml/internal/validate/custom/Model.scala index e708653c..599cd919 100644 --- a/amf-aml/shared/src/main/scala/amf/aml/internal/validate/custom/Model.scala +++ b/amf-aml/shared/src/main/scala/amf/aml/internal/validate/custom/Model.scala @@ -18,6 +18,14 @@ trait DialectWrapper { } } + def extractLiterals(node: DialectDomainElement, property: String): Seq[Any] = { + node.definedBy + .propertiesMapping() + .find(_.name().value() == property) + .map(p => node.literalProperties(p.toField()).map(_.toString)) + .getOrElse(Nil) + } + def extractString(node: DialectDomainElement, property: String): Option[String] = { node.definedBy .propertiesMapping() @@ -50,13 +58,14 @@ trait DialectWrapper { .getOrElse(Nil) } - def mapIndexedEntities[T](node: DialectDomainElement, - property: String, - f: (DialectDomainElement, Int) => T): Seq[T] = { + def mapIndexedEntities[T]( + node: DialectDomainElement, + property: String, + f: (DialectDomainElement, Int) => T + ): Seq[T] = { node.definedBy.propertiesMapping().find(_.name().value() == property).map { p => - node.objectCollectionProperty(p.toField).zipWithIndex.map { - case (dialectDomainElement, i) => - f(dialectDomainElement, i) + node.objectCollectionProperty(p.toField).zipWithIndex.map { case (dialectDomainElement, i) => + f(dialectDomainElement, i) } } getOrElse (Nil) } @@ -78,12 +87,11 @@ trait DialectWrapper { } case _ => } - Namespace.defaultAliases.ns.foreach { - case (p, v) => - prefixMap.get(p) match { - case Some(x) => // ignore - case _ => prefixMap.put(p, v.base) - } + Namespace.defaultAliases.ns.foreach { case (p, v) => + prefixMap.get(p) match { + case Some(x) => // ignore + case _ => prefixMap.put(p, v.base) + } } prefixMap } @@ -101,7 +109,7 @@ object ParsedFunctionConstraint extends DialectWrapper { message = extractString(node, "message"), code = extractString(node, "code"), libraries = extractStrings(node, "libraries"), - functionName = extractString(node, "functionName"), + functionName = extractString(node, "functionName") ) } } @@ -121,41 +129,52 @@ object ParsedQueryConstraint extends DialectWrapper { object ParsedPropertyConstraint extends DialectWrapper { val validationNs = "http://a.ml/vocabularies/amf-validation#" - def apply(node: DialectDomainElement, - prefixes: mutable.Map[String, String], - nameForNestedValidation: String, - message: Option[String] = None, - nested: String): (PropertyConstraint, Seq[ValidationSpecification]) = { + def apply( + node: DialectDomainElement, + prefixes: mutable.Map[String, String], + nameForNestedValidation: String, + message: Option[String] = None, + nested: String + ): (PropertyConstraint, Seq[ValidationSpecification]) = { val name = mandatory("name in property constraint", extractString(node, "name")) val path = PropertyPathParser(name, s => expand(s, prefixes)) val (nestedNode, nestedConstraints) = mapEntity( node, "nested", - ParsedValidationSpecification(_, - prefixes, - Some(s"${nameForNestedValidation}_nested_node"), - message, - None, - Some(nested))).map { case (v, nested) => (Seq(v), nested) } getOrElse ((Nil, Nil)) + ParsedValidationSpecification( + _, + prefixes, + Some(s"${nameForNestedValidation}_nested_node"), + message, + None, + Some(nested) + ) + ).map { case (v, nested) => (Seq(v), nested) } getOrElse ((Nil, Nil)) val atLeastTuple = mapEntity( node, "atLeast", - ParsedQualifiedValidationSpecification(_, - prefixes, - Some(s"${nameForNestedValidation}_${name}_atLeast_"), - message, - None, - Some(nested))) + ParsedQualifiedValidationSpecification( + _, + prefixes, + Some(s"${nameForNestedValidation}_${name}_atLeast_"), + message, + None, + Some(nested) + ) + ) val atMostTuple = mapEntity( node, "atMost", - ParsedQualifiedValidationSpecification(_, - prefixes, - Some(s"${nameForNestedValidation}_${name}_atLeast_"), - message, - None, - Some(nested))) + ParsedQualifiedValidationSpecification( + _, + prefixes, + Some(s"${nameForNestedValidation}_${name}_atLeast_"), + message, + None, + Some(nested) + ) + ) val property = PropertyConstraint( ramlPropertyId = expand(mandatory("ramlID in property constraint", Some(name)), prefixes), @@ -171,7 +190,7 @@ object ParsedPropertyConstraint extends DialectWrapper { minExclusive = extractString(node, "minExclusive"), maxInclusive = extractString(node, "maxInclusive"), minInclusive = extractString(node, "minInclusive"), - in = extractStrings(node, "in"), + in = extractLiterals(node, "in").toSet, node = nestedNode.headOption.map(_.id), equalToProperty = extractString(node, "equalsToProperty").map(s => expand(s, prefixes)), disjointWithProperty = extractString(node, "disjointWithProperty").map(s => expand(s, prefixes)), @@ -183,7 +202,7 @@ object ParsedPropertyConstraint extends DialectWrapper { }, atMost = atMostTuple.map { t => (t._1, t._2.id) - }, + } ) val atLeastAcc = atLeastTuple.map(t => Seq(t._2)).getOrElse(Nil) ++ atLeastTuple.map(_._3).getOrElse(Nil) @@ -194,17 +213,20 @@ object ParsedPropertyConstraint extends DialectWrapper { } object ParsedQualifiedValidationSpecification extends DialectWrapper { - def apply(node: DialectDomainElement, - prefixes: mutable.Map[String, String], - nameForNestedValidation: Option[String] = None, - message: Option[String] = None, - targetClassForNestedValidation: Option[Seq[String]] = None, - nested: Option[String] = None): (Int, ValidationSpecification, Seq[ValidationSpecification]) = { + def apply( + node: DialectDomainElement, + prefixes: mutable.Map[String, String], + nameForNestedValidation: Option[String] = None, + message: Option[String] = None, + targetClassForNestedValidation: Option[Seq[String]] = None, + nested: Option[String] = None + ): (Int, ValidationSpecification, Seq[ValidationSpecification]) = { val count: Int = mandatory("count missing in qualified validation specification", extractInt(node, "count")) val (validation, nestedValidations) = mapEntity( node, "validation", - ParsedValidationSpecification(_, prefixes, nameForNestedValidation, message, None, nested)).get + ParsedValidationSpecification(_, prefixes, nameForNestedValidation, message, None, nested) + ).get (count, validation, nestedValidations) } @@ -212,37 +234,41 @@ object ParsedQualifiedValidationSpecification extends DialectWrapper { object ParsedValidationSpecification extends DialectWrapper { - def apply(node: DialectDomainElement, - prefixes: mutable.Map[String, String], - nameForNestedValidation: Option[String] = None, - message: Option[String] = None, - targetClassForNestedValidation: Option[Seq[String]] = None, - nested: Option[String] = None): (ValidationSpecification, Seq[ValidationSpecification]) = { + def apply( + node: DialectDomainElement, + prefixes: mutable.Map[String, String], + nameForNestedValidation: Option[String] = None, + message: Option[String] = None, + targetClassForNestedValidation: Option[Seq[String]] = None, + nested: Option[String] = None + ): (ValidationSpecification, Seq[ValidationSpecification]) = { val name: String = nameForNestedValidation.getOrElse(mandatory("name in validation specification", extractString(node, "name"))) - val targetClasses: Seq[String] = - targetClassForNestedValidation.getOrElse(extractStrings(node, "targetClass").map(expand(_, prefixes))) + val targetClasses: Set[String] = + targetClassForNestedValidation.getOrElse(extractStrings(node, "targetClass").map(expand(_, prefixes))).toSet val finalMessage: String = message.getOrElse(extractString(node, "message").getOrElse(s"Unsatisfied constraint ${name}")) val finalNested: Option[String] = Some(nested.getOrElse(name)) val propsTuples: Seq[(PropertyConstraint, Seq[ValidationSpecification])] = - mapIndexedEntities(node, "propertyConstraints", { - case (e, i) => + mapIndexedEntities( + node, + "propertyConstraints", + { case (e, i) => ParsedPropertyConstraint(e, prefixes, name + s"_prop${i}", Some(finalMessage), finalNested.get) - }) + } + ) val propertyConstraints = propsTuples.map(_._1) val nestedProperties = propsTuples.flatMap(_._2) val additionalPropertyConstraints: Seq[PropertyConstraint] = - extractStrings(node, "classConstraints").map(s => expand(s, prefixes)).zipWithIndex.map { - case (id, i) => - PropertyConstraint( - ramlPropertyId = expand("rdf.type", prefixes), - name = s"rdf.type_$i", - path = Some(PropertyPathParser("rdf.type", s => expand(s, prefixes))), - value = Some(expand(id, prefixes)) - ) + extractStrings(node, "classConstraints").map(s => expand(s, prefixes)).zipWithIndex.map { case (id, i) => + PropertyConstraint( + ramlPropertyId = expand("rdf.type", prefixes), + name = s"rdf.type_$i", + path = Some(PropertyPathParser("rdf.type", s => expand(s, prefixes))), + value = Some(expand(id, prefixes)) + ) } // optional query constraint @@ -265,41 +291,62 @@ object ParsedValidationSpecification extends DialectWrapper { val (andConstraints, nestedAndConstraints) = collectNestedValidations( mapIndexedEntities( node, - "and", { - case (n: DialectDomainElement, i: Int) => - ParsedValidationSpecification(n, prefixes, Some(s"${name}_and_${i}"), Some(finalMessage), None, finalNested) + "and", + { case (n: DialectDomainElement, i: Int) => + ParsedValidationSpecification( + n, + prefixes, + Some(s"${name}_and_${i}"), + Some(finalMessage), + None, + finalNested + ) } - )) + ) + ) val (orConstraints, nestedOrConstraints) = collectNestedValidations( mapIndexedEntities( node, - "or", { - case (n: DialectDomainElement, i: Int) => - ParsedValidationSpecification(n, prefixes, Some(s"${name}_or_${i}"), Some(finalMessage), None, finalNested) + "or", + { case (n: DialectDomainElement, i: Int) => + ParsedValidationSpecification( + n, + prefixes, + Some(s"${name}_or_${i}"), + Some(finalMessage), + None, + finalNested + ) } - )) + ) + ) val (xoneConstraints, xoneNestedConstraints) = collectNestedValidations( mapIndexedEntities( node, - "xone", { - case (n: DialectDomainElement, i: Int) => - ParsedValidationSpecification(n, - prefixes, - Some(s"${name}_xone_${i}"), - Some(finalMessage), - None, - finalNested) + "xone", + { case (n: DialectDomainElement, i: Int) => + ParsedValidationSpecification( + n, + prefixes, + Some(s"${name}_xone_${i}"), + Some(finalMessage), + None, + finalNested + ) } - )) + ) + ) val (notConstraints, notNestedConstraints) = mapEntity( node, "not", - ParsedValidationSpecification(_, prefixes, Some(s"${name}_not"), Some(finalMessage), None, finalNested)).map { - case (v, nested) => (Seq(v), nested) + ParsedValidationSpecification(_, prefixes, Some(s"${name}_not"), Some(finalMessage), None, finalNested) + ).map { case (v, nested) => + (Seq(v), nested) } getOrElse ((Nil, Nil)) - val allNested = nestedAndConstraints ++ nestedOrConstraints ++ xoneNestedConstraints ++ notNestedConstraints ++ nestedProperties + val allNested = + nestedAndConstraints ++ nestedOrConstraints ++ xoneNestedConstraints ++ notNestedConstraints ++ nestedProperties val finalValidation = base.copy( andConstraints = andConstraints.map(_.id), @@ -311,8 +358,8 @@ object ParsedValidationSpecification extends DialectWrapper { } protected def collectNestedValidations( - nestedValidations: Seq[(ValidationSpecification, Seq[ValidationSpecification])]) - : (Seq[ValidationSpecification], Seq[ValidationSpecification]) = { + nestedValidations: Seq[(ValidationSpecification, Seq[ValidationSpecification])] + ): (Seq[ValidationSpecification], Seq[ValidationSpecification]) = { nestedValidations.foldLeft((Seq[ValidationSpecification](), Seq[ValidationSpecification]())) { case ((validationsAcc, nestedAcc), (validation, nested)) => (validationsAcc ++ Seq(validation), nestedAcc ++ nested) @@ -329,15 +376,17 @@ object ParsedValidationProfile extends DialectWrapper { .set(extractStrings(node, "info"), SeverityLevels.INFO) .set(extractStrings(node, "warning"), SeverityLevels.WARNING) .disable(extractStrings(node, "disabled")) - val validations = collectValidations(mapEntities(node, "validations", (v) => ParsedValidationSpecification(deref(v), prfx))).collect { - case v: ValidationSpecification => - severityMapping.getSeverityOf(v.name) - .map(s => - v.copy( - severity = ShaclSeverityUris.amfToShaclSeverity(s) - ) + val validations = collectValidations( + mapEntities(node, "validations", (v) => ParsedValidationSpecification(deref(v), prfx)) + ).collect { case v: ValidationSpecification => + severityMapping + .getSeverityOf(v.name) + .map(s => + v.copy( + severity = ShaclSeverityUris.amfToShaclSeverity(s) ) - .getOrElse(v) + ) + .getOrElse(v) } ValidationProfile( name = ProfileName(mandatory("profile in validation profile", extractString(node, "profile"))), @@ -362,10 +411,10 @@ object ParsedValidationProfile extends DialectWrapper { } protected def collectValidations( - nestedValidations: Seq[(ValidationSpecification, Seq[ValidationSpecification])]): Seq[ValidationSpecification] = { - nestedValidations.foldLeft(Seq[ValidationSpecification]()) { - case (validationsAcc, (validation, nested)) => - validationsAcc ++ Seq(validation) ++ nested + nestedValidations: Seq[(ValidationSpecification, Seq[ValidationSpecification])] + ): Seq[ValidationSpecification] = { + nestedValidations.foldLeft(Seq[ValidationSpecification]()) { case (validationsAcc, (validation, nested)) => + validationsAcc ++ Seq(validation) ++ nested } } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.cycled.jsonld.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.cycled.jsonld.yaml new file mode 100644 index 00000000..efa00fa4 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.cycled.jsonld.yaml @@ -0,0 +1,16 @@ +#%Dialect 1.0 +dialect: Mapping Additional properties +version: "1.0" +documents: + root: + encodes: Person +nodeMappings: + Person: + mapping: + name: + range: string + surname: + range: string + email: + range: string + additionalProperties: true diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.cycled.yaml new file mode 100644 index 00000000..efa00fa4 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.cycled.yaml @@ -0,0 +1,16 @@ +#%Dialect 1.0 +dialect: Mapping Additional properties +version: "1.0" +documents: + root: + encodes: Person +nodeMappings: + Person: + mapping: + name: + range: string + surname: + range: string + email: + range: string + additionalProperties: true diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.expanded.jsonld new file mode 100644 index 00000000..762998c1 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.expanded.jsonld @@ -0,0 +1,517 @@ +[ + { + "@id": "", + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": [ + { + "@value": "Mapping Additional properties" + } + ], + "core:version": [ + { + "@value": "1.0" + } + ], + "meta:documents": [ + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": [ + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Mapping Additional properties 1.0" + } + ], + "meta:encodedNode": [ + { + "@id": "#/declarations/Person" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.yaml#/documents/root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,7)-(9,0)]" + } + ] + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:encodedNode" + } + ], + "sourcemaps:value": [ + { + "@value": "[(7,4)-(9,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.yaml/documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,0)-(9,0)]" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:rootDocument" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,2)-(9,0)]" + } + ] + } + ] + } + ] + } + ], + "doc:location": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.yaml" + } + ], + "doc:root": [ + { + "@value": true + } + ], + "doc:processingData": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": [ + { + "@value": false + } + ], + "doc:sourceSpec": [ + { + "@value": "AML 1.0" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:version" + } + ], + "sourcemaps:value": [ + { + "@value": "[(3,0)-(5,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,0)-(9,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.yaml" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(19,0)]" + } + ] + } + ] + } + ], + "doc:declares": [ + { + "@id": "#/declarations/Person", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Person" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Person/property/surname", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#surname" + } + ], + "core:name": [ + { + "@value": "surname" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Person/property/surname/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Person/property/surname/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(14,6)-(14,13)]" + } + ] + }, + { + "@id": "#/declarations/Person/property/surname/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(15,8)-(16,0)]" + } + ] + }, + { + "@id": "#/declarations/Person/property/surname/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.yaml#/declarations/Person/property/surname" + } + ], + "sourcemaps:value": [ + { + "@value": "[(14,14)-(16,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Person/property/name", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#name" + } + ], + "core:name": [ + { + "@value": "name" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Person/property/name/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Person/property/name/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(12,6)-(12,10)]" + } + ] + }, + { + "@id": "#/declarations/Person/property/name/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(13,8)-(14,0)]" + } + ] + }, + { + "@id": "#/declarations/Person/property/name/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.yaml#/declarations/Person/property/name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(12,11)-(14,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Person/property/email", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#email" + } + ], + "core:name": [ + { + "@value": "email" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Person/property/email/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Person/property/email/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(16,6)-(16,11)]" + } + ] + }, + { + "@id": "#/declarations/Person/property/email/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(17,8)-(18,0)]" + } + ] + }, + { + "@id": "#/declarations/Person/property/email/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.yaml#/declarations/Person/property/email" + } + ], + "sourcemaps:value": [ + { + "@value": "[(16,12)-(18,0)]" + } + ] + } + ] + } + ] + } + ], + "shacl:closed": [ + { + "@value": false + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Person/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Person/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(11,4)-(18,0)]" + } + ] + }, + { + "@id": "#/declarations/Person/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(10,2)-(10,8)]" + } + ] + }, + { + "@id": "#/declarations/Person/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:closed" + } + ], + "sourcemaps:value": [ + { + "@value": "[(18,4)-(19,0)]" + } + ] + }, + { + "@id": "#/declarations/Person/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.yaml#/declarations/Person" + } + ], + "sourcemaps:value": [ + { + "@value": "[(10,2)-(19,0)]" + } + ] + } + ] + } + ] + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#" + } + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.flattened.jsonld new file mode 100644 index 00000000..06cb3e78 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.flattened.jsonld @@ -0,0 +1,402 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + }, + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map" + } + ] + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "Mapping Additional properties 1.0", + "meta:encodedNode": [ + { + "@id": "#/declarations/Person" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map" + } + ] + }, + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1" + }, + { + "@id": "/documents#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.yaml/documents", + "sourcemaps:value": "[(6,0)-(9,0)]" + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": "meta:rootDocument", + "sourcemaps:value": "[(6,2)-(9,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.yaml#/documents/root", + "sourcemaps:value": "[(6,7)-(9,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": "meta:encodedNode", + "sourcemaps:value": "[(7,4)-(9,0)]" + }, + { + "@id": "", + "doc:declares": [ + { + "@id": "#/declarations/Person" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "Mapping Additional properties", + "core:version": "1.0", + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.yaml", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + }, + "sourcemaps:sources": [ + { + "@id": "#/source-map" + } + ] + }, + { + "@id": "#/declarations/Person", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Person", + "shacl:property": [ + { + "@id": "#/declarations/Person/property/surname" + }, + { + "@id": "#/declarations/Person/property/name" + }, + { + "@id": "#/declarations/Person/property/email" + } + ], + "shacl:closed": false, + "sourcemaps:sources": [ + { + "@id": "#/declarations/Person/source-map" + } + ] + }, + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_3" + }, + { + "@id": "#/source-map/lexical/element_1" + }, + { + "@id": "#/source-map/lexical/element_0" + }, + { + "@id": "#/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/Person/property/surname", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#surname" + } + ], + "core:name": "surname", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Person/property/surname/source-map" + } + ] + }, + { + "@id": "#/declarations/Person/property/name", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#name" + } + ], + "core:name": "name", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Person/property/name/source-map" + } + ] + }, + { + "@id": "#/declarations/Person/property/email", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#email" + } + ], + "core:name": "email", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Person/property/email/source-map" + } + ] + }, + { + "@id": "#/declarations/Person/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Person/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/Person/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/Person/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Person/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": "core:version", + "sourcemaps:value": "[(3,0)-(5,0)]" + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(2,0)-(3,0)]" + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": "meta:documents", + "sourcemaps:value": "[(5,0)-(9,0)]" + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.yaml", + "sourcemaps:value": "[(2,0)-(19,0)]" + }, + { + "@id": "#/declarations/Person/property/surname/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Person/property/surname/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Person/property/surname/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Person/property/surname/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Person/property/name/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Person/property/name/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Person/property/name/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Person/property/name/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Person/property/email/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Person/property/email/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Person/property/email/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Person/property/email/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Person/source-map/lexical/element_3", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(11,4)-(18,0)]" + }, + { + "@id": "#/declarations/Person/source-map/lexical/element_1", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(10,2)-(10,8)]" + }, + { + "@id": "#/declarations/Person/source-map/lexical/element_0", + "sourcemaps:element": "shacl:closed", + "sourcemaps:value": "[(18,4)-(19,0)]" + }, + { + "@id": "#/declarations/Person/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.yaml#/declarations/Person", + "sourcemaps:value": "[(10,2)-(19,0)]" + }, + { + "@id": "#/declarations/Person/property/surname/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(14,6)-(14,13)]" + }, + { + "@id": "#/declarations/Person/property/surname/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(15,8)-(16,0)]" + }, + { + "@id": "#/declarations/Person/property/surname/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.yaml#/declarations/Person/property/surname", + "sourcemaps:value": "[(14,14)-(16,0)]" + }, + { + "@id": "#/declarations/Person/property/name/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(12,6)-(12,10)]" + }, + { + "@id": "#/declarations/Person/property/name/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(13,8)-(14,0)]" + }, + { + "@id": "#/declarations/Person/property/name/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.yaml#/declarations/Person/property/name", + "sourcemaps:value": "[(12,11)-(14,0)]" + }, + { + "@id": "#/declarations/Person/property/email/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(16,6)-(16,11)]" + }, + { + "@id": "#/declarations/Person/property/email/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(17,8)-(18,0)]" + }, + { + "@id": "#/declarations/Person/property/email/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.yaml#/declarations/Person/property/email", + "sourcemaps:value": "[(16,12)-(18,0)]" + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.yaml new file mode 100644 index 00000000..6cbcf85a --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/additional-properties/dialect.yaml @@ -0,0 +1,18 @@ +#%Dialect 1.0 +dialect: Mapping Additional properties +version: 1.0 + +documents: + root: + encodes: Person + +nodeMappings: + Person: + mapping: + name: + range: string + surname: + range: string + email: + range: string + additionalProperties: true diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.cycled.jsonld.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.cycled.jsonld.yaml new file mode 100644 index 00000000..f2cfa928 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.cycled.jsonld.yaml @@ -0,0 +1,55 @@ +#%Dialect 1.0 +dialect: Mapping AllOf +version: "1.0" +external: + schema-org: https://schema.org/ +documents: + root: + encodes: Root +nodeMappings: + Root: + allOf: + - AndMember1 + - AndMember2 + - AndMember3 + AndMember1: + mapping: + am11: + range: string + am12: + range: string + AndMember2: + conditional: + if: Condition + then: ConditionMatch + else: ConditionNoMatch + AndMember3: + oneOf: + - OrMember1 + - OrMember2 + Condition: + mapping: + c1: + range: string + enum: + - something + ConditionMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.something + ConditionNoMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.no-something + OrMember1: + mapping: + om11: + range: string + om12: + range: number + OrMember2: + mapping: + om21: + range: boolean diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.cycled.yaml new file mode 100644 index 00000000..f2cfa928 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.cycled.yaml @@ -0,0 +1,55 @@ +#%Dialect 1.0 +dialect: Mapping AllOf +version: "1.0" +external: + schema-org: https://schema.org/ +documents: + root: + encodes: Root +nodeMappings: + Root: + allOf: + - AndMember1 + - AndMember2 + - AndMember3 + AndMember1: + mapping: + am11: + range: string + am12: + range: string + AndMember2: + conditional: + if: Condition + then: ConditionMatch + else: ConditionNoMatch + AndMember3: + oneOf: + - OrMember1 + - OrMember2 + Condition: + mapping: + c1: + range: string + enum: + - something + ConditionMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.something + ConditionNoMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.no-something + OrMember1: + mapping: + om11: + range: string + om12: + range: number + OrMember2: + mapping: + om21: + range: boolean diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.expanded.jsonld new file mode 100644 index 00000000..993d0bb4 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.expanded.jsonld @@ -0,0 +1,1491 @@ +[ + { + "@id": "", + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": [ + { + "@value": "Mapping AllOf" + } + ], + "core:version": [ + { + "@value": "1.0" + } + ], + "meta:externals": [ + { + "@id": "/externals/schema-org", + "@type": [ + "owl:Ontology", + "meta:ExternalVocabulary", + "doc:DomainElement" + ], + "core:displayName": [ + { + "@value": "schema-org" + } + ], + "meta:base": [ + { + "@value": "https://schema.org/" + } + ], + "sourcemaps:sources": [ + { + "@id": "/externals/schema-org#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/externals/schema-org#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:displayName" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,2)-(6,12)]" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:base" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,14)-(6,33)]" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml/externals/schema-org" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,2)-(8,0)]" + } + ] + } + ] + } + ] + } + ], + "meta:documents": [ + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": [ + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Mapping AllOf 1.0" + } + ], + "meta:encodedNode": [ + { + "@id": "#/declarations/Root" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/documents/root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,7)-(12,0)]" + } + ] + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:encodedNode" + } + ], + "sourcemaps:value": [ + { + "@value": "[(10,4)-(12,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml/documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,0)-(12,0)]" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:rootDocument" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,2)-(12,0)]" + } + ] + } + ] + } + ] + } + ], + "doc:location": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml" + } + ], + "doc:root": [ + { + "@value": true + } + ], + "doc:processingData": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": [ + { + "@value": false + } + ], + "doc:sourceSpec": [ + { + "@value": "AML 1.0" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_4", + "sourcemaps:element": [ + { + "@value": "meta:externals" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,0)-(8,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(57,22)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(8,0)-(12,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:version" + } + ], + "sourcemaps:value": [ + { + "@value": "[(3,0)-(5,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + } + ] + } + ], + "doc:declares": [ + { + "@id": "#/declarations/AndMember3", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "AndMember3" + } + ], + "http://a.ml/vocabularies/amf/aml#or": [ + { + "@id": "#/declarations/OrMember1" + }, + { + "@id": "#/declarations/OrMember2" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember3/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember3/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember3" + } + ], + "sourcemaps:value": [ + { + "@value": "[(29,2)-(33,0)]" + } + ] + }, + { + "@id": "#/declarations/AndMember3/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(29,2)-(29,12)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Root", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Root" + } + ], + "http://a.ml/vocabularies/amf/aml#and": [ + { + "@id": "#/declarations/AndMember1" + }, + { + "@id": "#/declarations/AndMember2" + }, + { + "@id": "#/declarations/AndMember3" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/Root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(13,2)-(18,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(13,2)-(13,6)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Condition", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Condition" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Condition/property/c1", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#c1" + } + ], + "core:name": [ + { + "@value": "c1" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:in": [ + { + "@id": "#/declarations/Condition/property/c1/list", + "@type": "rdfs:Seq", + "rdfs:_1": [ + { + "@value": "something", + "@type": "xsd:string" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Condition/property/c1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(36,8)-(37,0)]" + } + ] + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(35,6)-(35,8)]" + } + ] + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:in" + } + ], + "sourcemaps:value": [ + { + "@value": "[(37,8)-(38,0)]" + } + ] + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/Condition/property/c1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(35,9)-(38,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Condition/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Condition/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(33,2)-(33,11)]" + } + ] + }, + { + "@id": "#/declarations/Condition/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(34,4)-(38,0)]" + } + ] + }, + { + "@id": "#/declarations/Condition/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/Condition" + } + ], + "sourcemaps:value": [ + { + "@value": "[(33,2)-(38,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "ConditionNoMatch" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/ConditionNoMatch/property/c1", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/no-something" + } + ], + "core:name": [ + { + "@value": "c1" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(45,6)-(45,8)]" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "shacl:path" + } + ], + "sourcemaps:value": [ + { + "@value": "[(47,8)-(48,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(46,8)-(47,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch/property/c1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(45,9)-(48,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionNoMatch/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(43,2)-(43,18)]" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(44,4)-(48,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch" + } + ], + "sourcemaps:value": [ + { + "@value": "[(43,2)-(48,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/OrMember2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "OrMember2" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/OrMember2/property/om21", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#om21" + } + ], + "core:name": [ + { + "@value": "om21" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#boolean" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/OrMember2/property/om21/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/OrMember2/property/om21/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(56,6)-(56,10)]" + } + ] + }, + { + "@id": "#/declarations/OrMember2/property/om21/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(57,8)-(57,22)]" + } + ] + }, + { + "@id": "#/declarations/OrMember2/property/om21/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2/property/om21" + } + ], + "sourcemaps:value": [ + { + "@value": "[(56,11)-(57,22)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/OrMember2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/OrMember2/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(54,2)-(54,11)]" + } + ] + }, + { + "@id": "#/declarations/OrMember2/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(55,4)-(57,22)]" + } + ] + }, + { + "@id": "#/declarations/OrMember2/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2" + } + ], + "sourcemaps:value": [ + { + "@value": "[(54,2)-(57,22)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/AndMember1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "AndMember1" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/AndMember1/property/am12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am12" + } + ], + "core:name": [ + { + "@value": "am12" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember1/property/am12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(22,6)-(22,10)]" + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(23,8)-(24,0)]" + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am12" + } + ], + "sourcemaps:value": [ + { + "@value": "[(22,11)-(24,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am11" + } + ], + "core:name": [ + { + "@value": "am11" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember1/property/am11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(20,6)-(20,10)]" + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(21,8)-(22,0)]" + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am11" + } + ], + "sourcemaps:value": [ + { + "@value": "[(20,11)-(22,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(18,2)-(18,12)]" + } + ] + }, + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(19,4)-(24,0)]" + } + ] + }, + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(18,2)-(24,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/OrMember1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "OrMember1" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/OrMember1/property/om12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#om12" + } + ], + "core:name": [ + { + "@value": "om12" + } + ], + "shacl:datatype": [ + { + "@id": "http://a.ml/vocabularies/shapes#number" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/OrMember1/property/om12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/OrMember1/property/om12/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(52,6)-(52,10)]" + } + ] + }, + { + "@id": "#/declarations/OrMember1/property/om12/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(53,8)-(54,0)]" + } + ] + }, + { + "@id": "#/declarations/OrMember1/property/om12/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1/property/om12" + } + ], + "sourcemaps:value": [ + { + "@value": "[(52,11)-(54,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/OrMember1/property/om11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#om11" + } + ], + "core:name": [ + { + "@value": "om11" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/OrMember1/property/om11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/OrMember1/property/om11/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(50,6)-(50,10)]" + } + ] + }, + { + "@id": "#/declarations/OrMember1/property/om11/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(51,8)-(52,0)]" + } + ] + }, + { + "@id": "#/declarations/OrMember1/property/om11/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1/property/om11" + } + ], + "sourcemaps:value": [ + { + "@value": "[(50,11)-(52,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/OrMember1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/OrMember1/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(48,2)-(48,11)]" + } + ] + }, + { + "@id": "#/declarations/OrMember1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(49,4)-(54,0)]" + } + ] + }, + { + "@id": "#/declarations/OrMember1/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(48,2)-(54,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/AndMember2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "AndMember2" + } + ], + "http://a.ml/vocabularies/amf/aml#if": [ + { + "@id": "#/declarations/Condition" + } + ], + "http://a.ml/vocabularies/amf/aml#then": [ + { + "@id": "#/declarations/ConditionMatch" + } + ], + "http://a.ml/vocabularies/amf/aml#else": [ + { + "@id": "#/declarations/ConditionNoMatch" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember2/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember2" + } + ], + "sourcemaps:value": [ + { + "@value": "[(24,2)-(29,0)]" + } + ] + }, + { + "@id": "#/declarations/AndMember2/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(24,2)-(24,12)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/ConditionMatch", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "ConditionMatch" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/ConditionMatch/property/c1", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/something" + } + ], + "core:name": [ + { + "@value": "c1" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(40,6)-(40,8)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "shacl:path" + } + ], + "sourcemaps:value": [ + { + "@value": "[(42,8)-(43,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(41,8)-(42,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch/property/c1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(40,9)-(43,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionMatch/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(38,2)-(38,16)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(39,4)-(43,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch" + } + ], + "sourcemaps:value": [ + { + "@value": "[(38,2)-(43,0)]" + } + ] + } + ] + } + ] + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "owl": "http://www.w3.org/2002/07/owl#", + "meta": "http://a.ml/vocabularies/meta#", + "xsd": "http://www.w3.org/2001/XMLSchema#" + } + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.flattened.jsonld new file mode 100644 index 00000000..51fffdf6 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.flattened.jsonld @@ -0,0 +1,1193 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/externals/schema-org", + "@type": [ + "owl:Ontology", + "meta:ExternalVocabulary", + "doc:DomainElement" + ], + "core:displayName": "schema-org", + "meta:base": "https://schema.org/", + "sourcemaps:sources": [ + { + "@id": "/externals/schema-org#/source-map" + } + ] + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + }, + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/externals/schema-org#/source-map/lexical/element_2" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_0" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "Mapping AllOf 1.0", + "meta:encodedNode": [ + { + "@id": "#/declarations/Root" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map" + } + ] + }, + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1" + }, + { + "@id": "/documents#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_2", + "sourcemaps:element": "core:displayName", + "sourcemaps:value": "[(6,2)-(6,12)]" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_0", + "sourcemaps:element": "meta:base", + "sourcemaps:value": "[(6,14)-(6,33)]" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml/externals/schema-org", + "sourcemaps:value": "[(6,2)-(8,0)]" + }, + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml/documents", + "sourcemaps:value": "[(9,0)-(12,0)]" + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": "meta:rootDocument", + "sourcemaps:value": "[(9,2)-(12,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/documents/root", + "sourcemaps:value": "[(9,7)-(12,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": "meta:encodedNode", + "sourcemaps:value": "[(10,4)-(12,0)]" + }, + { + "@id": "", + "doc:declares": [ + { + "@id": "#/declarations/AndMember3" + }, + { + "@id": "#/declarations/Root" + }, + { + "@id": "#/declarations/Condition" + }, + { + "@id": "#/declarations/ConditionNoMatch" + }, + { + "@id": "#/declarations/OrMember2" + }, + { + "@id": "#/declarations/AndMember1" + }, + { + "@id": "#/declarations/OrMember1" + }, + { + "@id": "#/declarations/AndMember2" + }, + { + "@id": "#/declarations/ConditionMatch" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "Mapping AllOf", + "core:version": "1.0", + "meta:externals": [ + { + "@id": "/externals/schema-org" + } + ], + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + }, + "sourcemaps:sources": [ + { + "@id": "#/source-map" + } + ] + }, + { + "@id": "#/declarations/AndMember3", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "AndMember3", + "http://a.ml/vocabularies/amf/aml#or": [ + { + "@id": "#/declarations/OrMember1" + }, + { + "@id": "#/declarations/OrMember2" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember3/source-map" + } + ] + }, + { + "@id": "#/declarations/Root", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Root", + "http://a.ml/vocabularies/amf/aml#and": [ + { + "@id": "#/declarations/AndMember1" + }, + { + "@id": "#/declarations/AndMember2" + }, + { + "@id": "#/declarations/AndMember3" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/source-map" + } + ] + }, + { + "@id": "#/declarations/Condition", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Condition", + "shacl:property": [ + { + "@id": "#/declarations/Condition/property/c1" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Condition/source-map" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "ConditionNoMatch", + "shacl:property": [ + { + "@id": "#/declarations/ConditionNoMatch/property/c1" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionNoMatch/source-map" + } + ] + }, + { + "@id": "#/declarations/OrMember2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "OrMember2", + "shacl:property": [ + { + "@id": "#/declarations/OrMember2/property/om21" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/OrMember2/source-map" + } + ] + }, + { + "@id": "#/declarations/AndMember1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "AndMember1", + "shacl:property": [ + { + "@id": "#/declarations/AndMember1/property/am12" + }, + { + "@id": "#/declarations/AndMember1/property/am11" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember1/source-map" + } + ] + }, + { + "@id": "#/declarations/OrMember1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "OrMember1", + "shacl:property": [ + { + "@id": "#/declarations/OrMember1/property/om12" + }, + { + "@id": "#/declarations/OrMember1/property/om11" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/OrMember1/source-map" + } + ] + }, + { + "@id": "#/declarations/AndMember2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "AndMember2", + "http://a.ml/vocabularies/amf/aml#if": [ + { + "@id": "#/declarations/Condition" + } + ], + "http://a.ml/vocabularies/amf/aml#then": [ + { + "@id": "#/declarations/ConditionMatch" + } + ], + "http://a.ml/vocabularies/amf/aml#else": [ + { + "@id": "#/declarations/ConditionNoMatch" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember2/source-map" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "ConditionMatch", + "shacl:property": [ + { + "@id": "#/declarations/ConditionMatch/property/c1" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionMatch/source-map" + } + ] + }, + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_4" + }, + { + "@id": "#/source-map/lexical/element_2" + }, + { + "@id": "#/source-map/lexical/element_0" + }, + { + "@id": "#/source-map/lexical/element_1" + }, + { + "@id": "#/source-map/lexical/element_3" + } + ] + }, + { + "@id": "#/declarations/AndMember3/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember3/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/AndMember3/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/declarations/Root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/declarations/Condition/property/c1", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#c1" + } + ], + "core:name": "c1", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:in": { + "@id": "#/declarations/Condition/property/c1/list" + }, + "sourcemaps:sources": [ + { + "@id": "#/declarations/Condition/property/c1/source-map" + } + ] + }, + { + "@id": "#/declarations/Condition/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Condition/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Condition/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Condition/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/no-something" + } + ], + "core:name": "c1", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/OrMember2/property/om21", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#om21" + } + ], + "core:name": "om21", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#boolean" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/OrMember2/property/om21/source-map" + } + ] + }, + { + "@id": "#/declarations/OrMember2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/OrMember2/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/OrMember2/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/OrMember2/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am12" + } + ], + "core:name": "am12", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember1/property/am12/source-map" + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am11" + } + ], + "core:name": "am11", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember1/property/am11/source-map" + } + ] + }, + { + "@id": "#/declarations/AndMember1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/OrMember1/property/om12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#om12" + } + ], + "core:name": "om12", + "shacl:datatype": [ + { + "@id": "http://a.ml/vocabularies/shapes#number" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/OrMember1/property/om12/source-map" + } + ] + }, + { + "@id": "#/declarations/OrMember1/property/om11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#om11" + } + ], + "core:name": "om11", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/OrMember1/property/om11/source-map" + } + ] + }, + { + "@id": "#/declarations/OrMember1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/OrMember1/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/OrMember1/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/OrMember1/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/AndMember2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember2/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/AndMember2/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/property/c1", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/something" + } + ], + "core:name": "c1", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/source-map/lexical/element_4", + "sourcemaps:element": "meta:externals", + "sourcemaps:value": "[(5,0)-(8,0)]" + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml", + "sourcemaps:value": "[(2,0)-(57,22)]" + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": "meta:documents", + "sourcemaps:value": "[(8,0)-(12,0)]" + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": "core:version", + "sourcemaps:value": "[(3,0)-(5,0)]" + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(2,0)-(3,0)]" + }, + { + "@id": "#/declarations/AndMember3/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember3", + "sourcemaps:value": "[(29,2)-(33,0)]" + }, + { + "@id": "#/declarations/AndMember3/source-map/lexical/element_0", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(29,2)-(29,12)]" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/Root", + "sourcemaps:value": "[(13,2)-(18,0)]" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(13,2)-(13,6)]" + }, + { + "@id": "#/declarations/Condition/property/c1/list", + "@type": "rdfs:Seq", + "rdfs:_1": { + "@value": "something", + "@type": "xsd:string" + } + }, + { + "@id": "#/declarations/Condition/property/c1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/Condition/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(33,2)-(33,11)]" + }, + { + "@id": "#/declarations/Condition/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(34,4)-(38,0)]" + }, + { + "@id": "#/declarations/Condition/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/Condition", + "sourcemaps:value": "[(33,2)-(38,0)]" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(43,2)-(43,18)]" + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(44,4)-(48,0)]" + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch", + "sourcemaps:value": "[(43,2)-(48,0)]" + }, + { + "@id": "#/declarations/OrMember2/property/om21/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/OrMember2/property/om21/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/OrMember2/property/om21/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/OrMember2/property/om21/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/OrMember2/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(54,2)-(54,11)]" + }, + { + "@id": "#/declarations/OrMember2/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(55,4)-(57,22)]" + }, + { + "@id": "#/declarations/OrMember2/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2", + "sourcemaps:value": "[(54,2)-(57,22)]" + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(18,2)-(18,12)]" + }, + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(19,4)-(24,0)]" + }, + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1", + "sourcemaps:value": "[(18,2)-(24,0)]" + }, + { + "@id": "#/declarations/OrMember1/property/om12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/OrMember1/property/om12/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/OrMember1/property/om12/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/OrMember1/property/om12/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/OrMember1/property/om11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/OrMember1/property/om11/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/OrMember1/property/om11/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/OrMember1/property/om11/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/OrMember1/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(48,2)-(48,11)]" + }, + { + "@id": "#/declarations/OrMember1/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(49,4)-(54,0)]" + }, + { + "@id": "#/declarations/OrMember1/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1", + "sourcemaps:value": "[(48,2)-(54,0)]" + }, + { + "@id": "#/declarations/AndMember2/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember2", + "sourcemaps:value": "[(24,2)-(29,0)]" + }, + { + "@id": "#/declarations/AndMember2/source-map/lexical/element_0", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(24,2)-(24,12)]" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(38,2)-(38,16)]" + }, + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(39,4)-(43,0)]" + }, + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch", + "sourcemaps:value": "[(38,2)-(43,0)]" + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_3", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(36,8)-(37,0)]" + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_1", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(35,6)-(35,8)]" + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_0", + "sourcemaps:element": "shacl:in", + "sourcemaps:value": "[(37,8)-(38,0)]" + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/Condition/property/c1", + "sourcemaps:value": "[(35,9)-(38,0)]" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(45,6)-(45,8)]" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_1", + "sourcemaps:element": "shacl:path", + "sourcemaps:value": "[(47,8)-(48,0)]" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(46,8)-(47,0)]" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch/property/c1", + "sourcemaps:value": "[(45,9)-(48,0)]" + }, + { + "@id": "#/declarations/OrMember2/property/om21/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(56,6)-(56,10)]" + }, + { + "@id": "#/declarations/OrMember2/property/om21/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(57,8)-(57,22)]" + }, + { + "@id": "#/declarations/OrMember2/property/om21/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2/property/om21", + "sourcemaps:value": "[(56,11)-(57,22)]" + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(22,6)-(22,10)]" + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(23,8)-(24,0)]" + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am12", + "sourcemaps:value": "[(22,11)-(24,0)]" + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(20,6)-(20,10)]" + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(21,8)-(22,0)]" + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am11", + "sourcemaps:value": "[(20,11)-(22,0)]" + }, + { + "@id": "#/declarations/OrMember1/property/om12/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(52,6)-(52,10)]" + }, + { + "@id": "#/declarations/OrMember1/property/om12/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(53,8)-(54,0)]" + }, + { + "@id": "#/declarations/OrMember1/property/om12/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1/property/om12", + "sourcemaps:value": "[(52,11)-(54,0)]" + }, + { + "@id": "#/declarations/OrMember1/property/om11/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(50,6)-(50,10)]" + }, + { + "@id": "#/declarations/OrMember1/property/om11/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(51,8)-(52,0)]" + }, + { + "@id": "#/declarations/OrMember1/property/om11/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1/property/om11", + "sourcemaps:value": "[(50,11)-(52,0)]" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(40,6)-(40,8)]" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_1", + "sourcemaps:element": "shacl:path", + "sourcemaps:value": "[(42,8)-(43,0)]" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(41,8)-(42,0)]" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch/property/c1", + "sourcemaps:value": "[(40,9)-(43,0)]" + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#", + "owl": "http://www.w3.org/2002/07/owl#", + "xsd": "http://www.w3.org/2001/XMLSchema#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.resolved.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.resolved.expanded.jsonld new file mode 100644 index 00000000..17f0c5a1 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.resolved.expanded.jsonld @@ -0,0 +1,1011 @@ +[ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml", +"@type": [ +"http://a.ml/vocabularies/meta#Dialect", +"http://a.ml/vocabularies/document#Document", +"http://a.ml/vocabularies/document#Fragment", +"http://a.ml/vocabularies/document#Module", +"http://a.ml/vocabularies/document#Unit" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Mapping AllOf" +} +], +"http://a.ml/vocabularies/core#version": [ +{ +"@value": "1.0" +} +], +"http://a.ml/vocabularies/meta#extensions": [], +"http://a.ml/vocabularies/meta#externals": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml/externals/schema-org", +"@type": [ +"http://www.w3.org/2002/07/owl#Ontology", +"http://a.ml/vocabularies/meta#ExternalVocabulary", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#displayName": [ +{ +"@value": "schema-org" +} +], +"http://a.ml/vocabularies/meta#base": [ +{ +"@value": "https://schema.org/" +} +] +} +], +"http://a.ml/vocabularies/meta#documents": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml/documents", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentsModel", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/meta#rootDocument": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/documents/root", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Mapping AllOf 1.0" +} +], +"http://a.ml/vocabularies/meta#encodedNode": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/Root" +} +] +} +] +} +], +"http://a.ml/vocabularies/document#location": [ +{ +"@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml" +} +], +"http://a.ml/vocabularies/document#root": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/document#processingData": [ +{ +"@id": "null/BaseUnitProcessingData", +"@type": [ +"http://a.ml/vocabularies/document#BaseUnitProcessingData" +], +"http://a.ml/vocabularies/document#transformed": [ +{ +"@value": true +} +] +} +], +"http://a.ml/vocabularies/document#declares": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "OrMember2" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2/property/om21", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om21" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om21" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#boolean" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember3", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "AndMember3" +} +], +"http://a.ml/vocabularies/amf/aml#or": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "ConditionMatch" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/Root", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Root" +} +], +"http://a.ml/vocabularies/amf/aml#and": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember3" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml/CombiningMapping_2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_2" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2/property/om21", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om21" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om21" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#boolean" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "OrMember1" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1/property/om12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://a.ml/vocabularies/shapes#number" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1/property/om11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "AndMember2" +} +], +"http://a.ml/vocabularies/amf/aml#if": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/Condition" +} +], +"http://a.ml/vocabularies/amf/aml#then": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch" +} +], +"http://a.ml/vocabularies/amf/aml#else": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml/CombiningMapping_4", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_4" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/no-something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2/property/om21", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om21" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om21" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#boolean" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/Condition", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Condition" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/Condition/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#c1" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +], +"http://www.w3.org/ns/shacl#in": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/Condition/property/c1/list", +"@type": "http://www.w3.org/2000/01/rdf-schema#Seq", +"http://www.w3.org/2000/01/rdf-schema#_1": [ +{ +"@value": "something", +"@type": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml/CombiningMapping_1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_1" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1/property/om12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://a.ml/vocabularies/shapes#number" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1/property/om11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "ConditionNoMatch" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/no-something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "AndMember1" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml/CombiningMapping_3", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_3" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/no-something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1/property/om12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://a.ml/vocabularies/shapes#number" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1/property/om11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1" +} +] +} +] +} +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.resolved.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.resolved.flattened.jsonld new file mode 100644 index 00000000..bb3d35c0 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.resolved.flattened.jsonld @@ -0,0 +1,607 @@ +{ +"@graph": [ +{ +"@id": "null/BaseUnitProcessingData", +"@type": [ +"http://a.ml/vocabularies/document#BaseUnitProcessingData" +], +"http://a.ml/vocabularies/document#transformed": true +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml/documents", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentsModel", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/meta#rootDocument": { +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/documents/root" +} +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml/externals/schema-org", +"@type": [ +"http://www.w3.org/2002/07/owl#Ontology", +"http://a.ml/vocabularies/meta#ExternalVocabulary", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#displayName": "schema-org", +"http://a.ml/vocabularies/meta#base": "https://schema.org/" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/documents/root", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "Mapping AllOf 1.0", +"http://a.ml/vocabularies/meta#encodedNode": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/Root" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml", +"http://a.ml/vocabularies/document#declares": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember3" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/Root" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml/CombiningMapping_2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml/CombiningMapping_4" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/Condition" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml/CombiningMapping_1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml/CombiningMapping_3" +} +], +"@type": [ +"http://a.ml/vocabularies/meta#Dialect", +"http://a.ml/vocabularies/document#Document", +"http://a.ml/vocabularies/document#Fragment", +"http://a.ml/vocabularies/document#Module", +"http://a.ml/vocabularies/document#Unit" +], +"http://a.ml/vocabularies/core#name": "Mapping AllOf", +"http://a.ml/vocabularies/core#version": "1.0", +"http://a.ml/vocabularies/meta#extensions": [], +"http://a.ml/vocabularies/meta#externals": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml/externals/schema-org" +} +], +"http://a.ml/vocabularies/meta#documents": { +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml/documents" +}, +"http://a.ml/vocabularies/document#location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml", +"http://a.ml/vocabularies/document#root": false, +"http://a.ml/vocabularies/document#processingData": { +"@id": "null/BaseUnitProcessingData" +} +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "OrMember2", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2/property/om21" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember3", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "AndMember3", +"http://a.ml/vocabularies/amf/aml#or": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "ConditionMatch", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch/property/c1" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/Root", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "Root", +"http://a.ml/vocabularies/amf/aml#and": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember3" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml/CombiningMapping_2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_2", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am11" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch/property/c1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2/property/om21" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "OrMember1", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1/property/om12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1/property/om11" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "AndMember2", +"http://a.ml/vocabularies/amf/aml#if": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/Condition" +} +], +"http://a.ml/vocabularies/amf/aml#then": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch" +} +], +"http://a.ml/vocabularies/amf/aml#else": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml/CombiningMapping_4", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_4", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am11" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch/property/c1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2/property/om21" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/Condition", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "Condition", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/Condition/property/c1" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml/CombiningMapping_1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_1", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am11" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch/property/c1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1/property/om12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1/property/om11" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "ConditionNoMatch", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch/property/c1" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "AndMember1", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am11" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml/CombiningMapping_3", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_3", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am11" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch/property/c1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1/property/om12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1/property/om11" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember2/property/om21", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om21" +} +], +"http://a.ml/vocabularies/core#name": "om21", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#boolean" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/something" +} +], +"http://a.ml/vocabularies/core#name": "c1", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": "am12", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/AndMember1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": "am11", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1/property/om12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om12" +} +], +"http://a.ml/vocabularies/core#name": "om12", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://a.ml/vocabularies/shapes#number" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/OrMember1/property/om11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om11" +} +], +"http://a.ml/vocabularies/core#name": "om11", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/ConditionNoMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/no-something" +} +], +"http://a.ml/vocabularies/core#name": "c1", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/Condition/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#c1" +} +], +"http://a.ml/vocabularies/core#name": "c1", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +], +"http://www.w3.org/ns/shacl#in": { +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/Condition/property/c1/list" +} +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml#/declarations/Condition/property/c1/list", +"@type": "http://www.w3.org/2000/01/rdf-schema#Seq", +"http://www.w3.org/2000/01/rdf-schema#_1": { +"@value": "something", +"@type": "http://www.w3.org/2001/XMLSchema#string" +} +} +] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.resolved.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.resolved.yaml new file mode 100644 index 00000000..0cd3bddf --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.resolved.yaml @@ -0,0 +1,123 @@ +#%Dialect 1.0 +external: + schema-org: https://schema.org/ +documents: + root: + encodes: Root +nodeMappings: + Root: + allOf: + - AndMember1 + - AndMember2 + - AndMember3 + AndMember1: + mapping: + am11: + range: string + am12: + range: string + AndMember2: + conditional: + if: Condition + then: ConditionMatch + else: ConditionNoMatch + AndMember3: + oneOf: + - OrMember1 + - OrMember2 + Condition: + mapping: + c1: + range: string + enum: + - something + ConditionMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.something + ConditionNoMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.no-something + OrMember1: + mapping: + om11: + range: string + om12: + range: number + OrMember2: + mapping: + om21: + range: boolean + CombiningMapping_2: + components: + - AndMember1 + - ConditionMatch + - OrMember2 + mapping: + am11: + range: string + am12: + range: string + c1: + range: string + propertyTerm: schema-org.something + om21: + range: boolean + additionalProperties: true + CombiningMapping_4: + components: + - AndMember1 + - ConditionNoMatch + - OrMember2 + mapping: + am11: + range: string + am12: + range: string + c1: + range: string + propertyTerm: schema-org.no-something + om21: + range: boolean + additionalProperties: true + CombiningMapping_1: + components: + - AndMember1 + - ConditionMatch + - OrMember1 + mapping: + am11: + range: string + am12: + range: string + c1: + range: string + propertyTerm: schema-org.something + om11: + range: string + om12: + range: number + additionalProperties: true + CombiningMapping_3: + components: + - AndMember1 + - ConditionNoMatch + - OrMember1 + mapping: + am11: + range: string + am12: + range: string + c1: + range: string + propertyTerm: schema-org.no-something + om11: + range: string + om12: + range: number + additionalProperties: true +dialect: Mapping AllOf +version: "1.0" diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml new file mode 100644 index 00000000..302ed26c --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-complex/dialect.yaml @@ -0,0 +1,57 @@ +#%Dialect 1.0 +dialect: Mapping AllOf +version: 1.0 + +external: + schema-org: https://schema.org/ + +documents: + root: + encodes: Root + +nodeMappings: + Root: + allOf: + - AndMember1 + - AndMember2 + - AndMember3 + AndMember1: + mapping: + am11: + range: string + am12: + range: string + AndMember2: + conditional: + if: Condition + then: ConditionMatch + else: ConditionNoMatch + AndMember3: + oneOf: + - OrMember1 + - OrMember2 + Condition: + mapping: + c1: + range: string + enum: ["something"] + ConditionMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.something + ConditionNoMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.no-something + OrMember1: + mapping: + om11: + range: string + om12: + range: number + OrMember2: + mapping: + om21: + range: boolean \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.cycled.jsonld.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.cycled.jsonld.yaml new file mode 100644 index 00000000..2e0d1aa6 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.cycled.jsonld.yaml @@ -0,0 +1,80 @@ +#%Dialect 1.0 +dialect: Mapping AllOf +version: "1.0" +external: + schema-org: https://schema.org/ +documents: + root: + encodes: Root +nodeMappings: + Root: + allOf: + - AndMember1 + - AndMember2 + - AndMember3 + AndMember1: + mapping: + am11: + range: string + am12: + range: string + AndMember2: + conditional: + if: Condition + then: ConditionMatch + else: ConditionNoMatch + AndMember3: + allOf: + - InnerAndMember1 + - InnerAndMember2 + Condition: + mapping: + c1: + range: string + enum: + - something + ConditionMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.something + ConditionNoMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.no-something + InnerAndMember1: + conditional: + if: InnerCondition + then: InnerConditionMatch + else: InnerConditionNoMatch + InnerAndMember2: + oneOf: + - InnerOrMember1 + - InnerOrMember2 + InnerCondition: + mapping: + c2: + range: string + enum: + - other-something + InnerConditionMatch: + mapping: + c2: + range: string + propertyTerm: schema-org.other-something + InnerConditionNoMatch: + mapping: + c2: + range: string + propertyTerm: schema-org.no-other-something + InnerOrMember1: + mapping: + om11: + range: string + om12: + range: number + InnerOrMember2: + mapping: + om21: + range: boolean diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.cycled.yaml new file mode 100644 index 00000000..2e0d1aa6 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.cycled.yaml @@ -0,0 +1,80 @@ +#%Dialect 1.0 +dialect: Mapping AllOf +version: "1.0" +external: + schema-org: https://schema.org/ +documents: + root: + encodes: Root +nodeMappings: + Root: + allOf: + - AndMember1 + - AndMember2 + - AndMember3 + AndMember1: + mapping: + am11: + range: string + am12: + range: string + AndMember2: + conditional: + if: Condition + then: ConditionMatch + else: ConditionNoMatch + AndMember3: + allOf: + - InnerAndMember1 + - InnerAndMember2 + Condition: + mapping: + c1: + range: string + enum: + - something + ConditionMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.something + ConditionNoMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.no-something + InnerAndMember1: + conditional: + if: InnerCondition + then: InnerConditionMatch + else: InnerConditionNoMatch + InnerAndMember2: + oneOf: + - InnerOrMember1 + - InnerOrMember2 + InnerCondition: + mapping: + c2: + range: string + enum: + - other-something + InnerConditionMatch: + mapping: + c2: + range: string + propertyTerm: schema-org.other-something + InnerConditionNoMatch: + mapping: + c2: + range: string + propertyTerm: schema-org.no-other-something + InnerOrMember1: + mapping: + om11: + range: string + om12: + range: number + InnerOrMember2: + mapping: + om21: + range: boolean diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.expanded.jsonld new file mode 100644 index 00000000..9a6865af --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.expanded.jsonld @@ -0,0 +1,2068 @@ +[ + { + "@id": "", + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": [ + { + "@value": "Mapping AllOf" + } + ], + "core:version": [ + { + "@value": "1.0" + } + ], + "meta:externals": [ + { + "@id": "/externals/schema-org", + "@type": [ + "owl:Ontology", + "meta:ExternalVocabulary", + "doc:DomainElement" + ], + "core:displayName": [ + { + "@value": "schema-org" + } + ], + "meta:base": [ + { + "@value": "https://schema.org/" + } + ], + "sourcemaps:sources": [ + { + "@id": "/externals/schema-org#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/externals/schema-org#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:displayName" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,2)-(6,12)]" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:base" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,14)-(6,33)]" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/externals/schema-org" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,2)-(8,0)]" + } + ] + } + ] + } + ] + } + ], + "meta:documents": [ + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": [ + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Mapping AllOf 1.0" + } + ], + "meta:encodedNode": [ + { + "@id": "#/declarations/Root" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/documents/root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,7)-(12,0)]" + } + ] + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:encodedNode" + } + ], + "sourcemaps:value": [ + { + "@value": "[(10,4)-(12,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,0)-(12,0)]" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:rootDocument" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,2)-(12,0)]" + } + ] + } + ] + } + ] + } + ], + "doc:location": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml" + } + ], + "doc:root": [ + { + "@value": true + } + ], + "doc:processingData": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": [ + { + "@value": false + } + ], + "doc:sourceSpec": [ + { + "@value": "AML 1.0" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_4", + "sourcemaps:element": [ + { + "@value": "meta:externals" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,0)-(8,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(81,22)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(8,0)-(12,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:version" + } + ], + "sourcemaps:value": [ + { + "@value": "[(3,0)-(5,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + } + ] + } + ], + "doc:declares": [ + { + "@id": "#/declarations/InnerAndMember2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "InnerAndMember2" + } + ], + "http://a.ml/vocabularies/amf/aml#or": [ + { + "@id": "#/declarations/InnerOrMember1" + }, + { + "@id": "#/declarations/InnerOrMember2" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerAndMember2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerAndMember2/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerAndMember2" + } + ], + "sourcemaps:value": [ + { + "@value": "[(53,2)-(57,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerAndMember2/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(53,2)-(53,17)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/InnerCondition", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "InnerCondition" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/InnerCondition/property/c2", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#c2" + } + ], + "core:name": [ + { + "@value": "c2" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:in": [ + { + "@id": "#/declarations/InnerCondition/property/c2/list", + "@type": "rdfs:Seq", + "rdfs:_1": [ + { + "@value": "other-something", + "@type": "xsd:string" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerCondition/property/c2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(60,8)-(61,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(59,6)-(59,8)]" + } + ] + }, + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:in" + } + ], + "sourcemaps:value": [ + { + "@value": "[(61,8)-(62,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerCondition/property/c2" + } + ], + "sourcemaps:value": [ + { + "@value": "[(59,9)-(62,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerCondition/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerCondition/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(57,2)-(57,16)]" + } + ] + }, + { + "@id": "#/declarations/InnerCondition/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(58,4)-(62,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerCondition/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerCondition" + } + ], + "sourcemaps:value": [ + { + "@value": "[(57,2)-(62,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/AndMember3", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "AndMember3" + } + ], + "http://a.ml/vocabularies/amf/aml#and": [ + { + "@id": "#/declarations/InnerAndMember1" + }, + { + "@id": "#/declarations/InnerAndMember2" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember3/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember3/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember3" + } + ], + "sourcemaps:value": [ + { + "@value": "[(29,2)-(33,0)]" + } + ] + }, + { + "@id": "#/declarations/AndMember3/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(29,2)-(29,12)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/InnerConditionNoMatch", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "InnerConditionNoMatch" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/no-other-something" + } + ], + "core:name": [ + { + "@value": "c2" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(69,6)-(69,8)]" + } + ] + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "shacl:path" + } + ], + "sourcemaps:value": [ + { + "@value": "[(71,8)-(72,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(70,8)-(71,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch/property/c2" + } + ], + "sourcemaps:value": [ + { + "@value": "[(69,9)-(72,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerConditionNoMatch/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerConditionNoMatch/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(67,2)-(67,23)]" + } + ] + }, + { + "@id": "#/declarations/InnerConditionNoMatch/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(68,4)-(72,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerConditionNoMatch/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch" + } + ], + "sourcemaps:value": [ + { + "@value": "[(67,2)-(72,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Root", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Root" + } + ], + "http://a.ml/vocabularies/amf/aml#and": [ + { + "@id": "#/declarations/AndMember1" + }, + { + "@id": "#/declarations/AndMember2" + }, + { + "@id": "#/declarations/AndMember3" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/Root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(13,2)-(18,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(13,2)-(13,6)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Condition", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Condition" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Condition/property/c1", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#c1" + } + ], + "core:name": [ + { + "@value": "c1" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:in": [ + { + "@id": "#/declarations/Condition/property/c1/list", + "@type": "rdfs:Seq", + "rdfs:_1": [ + { + "@value": "something", + "@type": "xsd:string" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Condition/property/c1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(36,8)-(37,0)]" + } + ] + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(35,6)-(35,8)]" + } + ] + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:in" + } + ], + "sourcemaps:value": [ + { + "@value": "[(37,8)-(38,0)]" + } + ] + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/Condition/property/c1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(35,9)-(38,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Condition/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Condition/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(33,2)-(33,11)]" + } + ] + }, + { + "@id": "#/declarations/Condition/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(34,4)-(38,0)]" + } + ] + }, + { + "@id": "#/declarations/Condition/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/Condition" + } + ], + "sourcemaps:value": [ + { + "@value": "[(33,2)-(38,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "ConditionNoMatch" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/ConditionNoMatch/property/c1", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/no-something" + } + ], + "core:name": [ + { + "@value": "c1" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(45,6)-(45,8)]" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "shacl:path" + } + ], + "sourcemaps:value": [ + { + "@value": "[(47,8)-(48,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(46,8)-(47,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionNoMatch/property/c1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(45,9)-(48,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionNoMatch/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(43,2)-(43,18)]" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(44,4)-(48,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionNoMatch" + } + ], + "sourcemaps:value": [ + { + "@value": "[(43,2)-(48,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/InnerConditionMatch", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "InnerConditionMatch" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/InnerConditionMatch/property/c2", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/other-something" + } + ], + "core:name": [ + { + "@value": "c2" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(64,6)-(64,8)]" + } + ] + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "shacl:path" + } + ], + "sourcemaps:value": [ + { + "@value": "[(66,8)-(67,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(65,8)-(66,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch/property/c2" + } + ], + "sourcemaps:value": [ + { + "@value": "[(64,9)-(67,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerConditionMatch/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerConditionMatch/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(62,2)-(62,21)]" + } + ] + }, + { + "@id": "#/declarations/InnerConditionMatch/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(63,4)-(67,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerConditionMatch/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch" + } + ], + "sourcemaps:value": [ + { + "@value": "[(62,2)-(67,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/AndMember1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "AndMember1" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/AndMember1/property/am12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am12" + } + ], + "core:name": [ + { + "@value": "am12" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember1/property/am12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(22,6)-(22,10)]" + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(23,8)-(24,0)]" + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1/property/am12" + } + ], + "sourcemaps:value": [ + { + "@value": "[(22,11)-(24,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am11" + } + ], + "core:name": [ + { + "@value": "am11" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember1/property/am11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(20,6)-(20,10)]" + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(21,8)-(22,0)]" + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1/property/am11" + } + ], + "sourcemaps:value": [ + { + "@value": "[(20,11)-(22,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(18,2)-(18,12)]" + } + ] + }, + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(19,4)-(24,0)]" + } + ] + }, + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(18,2)-(24,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "InnerOrMember1" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/InnerOrMember1/property/om12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#om12" + } + ], + "core:name": [ + { + "@value": "om12" + } + ], + "shacl:datatype": [ + { + "@id": "http://a.ml/vocabularies/shapes#number" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(76,6)-(76,10)]" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(77,8)-(78,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1/property/om12" + } + ], + "sourcemaps:value": [ + { + "@value": "[(76,11)-(78,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/property/om11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#om11" + } + ], + "core:name": [ + { + "@value": "om11" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(74,6)-(74,10)]" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(75,8)-(76,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1/property/om11" + } + ], + "sourcemaps:value": [ + { + "@value": "[(74,11)-(76,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerOrMember1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerOrMember1/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(72,2)-(72,16)]" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(73,4)-(78,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(72,2)-(78,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/InnerOrMember2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "InnerOrMember2" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/InnerOrMember2/property/om21", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#om21" + } + ], + "core:name": [ + { + "@value": "om21" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#boolean" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(80,6)-(80,10)]" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(81,8)-(81,22)]" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2/property/om21" + } + ], + "sourcemaps:value": [ + { + "@value": "[(80,11)-(81,22)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerOrMember2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerOrMember2/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(78,2)-(78,16)]" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember2/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(79,4)-(81,22)]" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember2/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2" + } + ], + "sourcemaps:value": [ + { + "@value": "[(78,2)-(81,22)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/InnerAndMember1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "InnerAndMember1" + } + ], + "http://a.ml/vocabularies/amf/aml#if": [ + { + "@id": "#/declarations/InnerCondition" + } + ], + "http://a.ml/vocabularies/amf/aml#then": [ + { + "@id": "#/declarations/InnerConditionMatch" + } + ], + "http://a.ml/vocabularies/amf/aml#else": [ + { + "@id": "#/declarations/InnerConditionNoMatch" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerAndMember1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerAndMember1/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerAndMember1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(48,2)-(53,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerAndMember1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(48,2)-(48,17)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/AndMember2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "AndMember2" + } + ], + "http://a.ml/vocabularies/amf/aml#if": [ + { + "@id": "#/declarations/Condition" + } + ], + "http://a.ml/vocabularies/amf/aml#then": [ + { + "@id": "#/declarations/ConditionMatch" + } + ], + "http://a.ml/vocabularies/amf/aml#else": [ + { + "@id": "#/declarations/ConditionNoMatch" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember2/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember2" + } + ], + "sourcemaps:value": [ + { + "@value": "[(24,2)-(29,0)]" + } + ] + }, + { + "@id": "#/declarations/AndMember2/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(24,2)-(24,12)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/ConditionMatch", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "ConditionMatch" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/ConditionMatch/property/c1", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/something" + } + ], + "core:name": [ + { + "@value": "c1" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(40,6)-(40,8)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "shacl:path" + } + ], + "sourcemaps:value": [ + { + "@value": "[(42,8)-(43,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(41,8)-(42,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionMatch/property/c1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(40,9)-(43,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionMatch/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(38,2)-(38,16)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(39,4)-(43,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionMatch" + } + ], + "sourcemaps:value": [ + { + "@value": "[(38,2)-(43,0)]" + } + ] + } + ] + } + ] + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "owl": "http://www.w3.org/2002/07/owl#", + "meta": "http://a.ml/vocabularies/meta#", + "xsd": "http://www.w3.org/2001/XMLSchema#" + } + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.flattened.jsonld new file mode 100644 index 00000000..679632f7 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.flattened.jsonld @@ -0,0 +1,1660 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/externals/schema-org", + "@type": [ + "owl:Ontology", + "meta:ExternalVocabulary", + "doc:DomainElement" + ], + "core:displayName": "schema-org", + "meta:base": "https://schema.org/", + "sourcemaps:sources": [ + { + "@id": "/externals/schema-org#/source-map" + } + ] + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + }, + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/externals/schema-org#/source-map/lexical/element_2" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_0" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "Mapping AllOf 1.0", + "meta:encodedNode": [ + { + "@id": "#/declarations/Root" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map" + } + ] + }, + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1" + }, + { + "@id": "/documents#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_2", + "sourcemaps:element": "core:displayName", + "sourcemaps:value": "[(6,2)-(6,12)]" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_0", + "sourcemaps:element": "meta:base", + "sourcemaps:value": "[(6,14)-(6,33)]" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/externals/schema-org", + "sourcemaps:value": "[(6,2)-(8,0)]" + }, + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/documents", + "sourcemaps:value": "[(9,0)-(12,0)]" + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": "meta:rootDocument", + "sourcemaps:value": "[(9,2)-(12,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/documents/root", + "sourcemaps:value": "[(9,7)-(12,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": "meta:encodedNode", + "sourcemaps:value": "[(10,4)-(12,0)]" + }, + { + "@id": "", + "doc:declares": [ + { + "@id": "#/declarations/InnerAndMember2" + }, + { + "@id": "#/declarations/InnerCondition" + }, + { + "@id": "#/declarations/AndMember3" + }, + { + "@id": "#/declarations/InnerConditionNoMatch" + }, + { + "@id": "#/declarations/Root" + }, + { + "@id": "#/declarations/Condition" + }, + { + "@id": "#/declarations/ConditionNoMatch" + }, + { + "@id": "#/declarations/InnerConditionMatch" + }, + { + "@id": "#/declarations/AndMember1" + }, + { + "@id": "#/declarations/InnerOrMember1" + }, + { + "@id": "#/declarations/InnerOrMember2" + }, + { + "@id": "#/declarations/InnerAndMember1" + }, + { + "@id": "#/declarations/AndMember2" + }, + { + "@id": "#/declarations/ConditionMatch" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "Mapping AllOf", + "core:version": "1.0", + "meta:externals": [ + { + "@id": "/externals/schema-org" + } + ], + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + }, + "sourcemaps:sources": [ + { + "@id": "#/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerAndMember2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "InnerAndMember2", + "http://a.ml/vocabularies/amf/aml#or": [ + { + "@id": "#/declarations/InnerOrMember1" + }, + { + "@id": "#/declarations/InnerOrMember2" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerAndMember2/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerCondition", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "InnerCondition", + "shacl:property": [ + { + "@id": "#/declarations/InnerCondition/property/c2" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerCondition/source-map" + } + ] + }, + { + "@id": "#/declarations/AndMember3", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "AndMember3", + "http://a.ml/vocabularies/amf/aml#and": [ + { + "@id": "#/declarations/InnerAndMember1" + }, + { + "@id": "#/declarations/InnerAndMember2" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember3/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerConditionNoMatch", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "InnerConditionNoMatch", + "shacl:property": [ + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerConditionNoMatch/source-map" + } + ] + }, + { + "@id": "#/declarations/Root", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Root", + "http://a.ml/vocabularies/amf/aml#and": [ + { + "@id": "#/declarations/AndMember1" + }, + { + "@id": "#/declarations/AndMember2" + }, + { + "@id": "#/declarations/AndMember3" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/source-map" + } + ] + }, + { + "@id": "#/declarations/Condition", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Condition", + "shacl:property": [ + { + "@id": "#/declarations/Condition/property/c1" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Condition/source-map" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "ConditionNoMatch", + "shacl:property": [ + { + "@id": "#/declarations/ConditionNoMatch/property/c1" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionNoMatch/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerConditionMatch", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "InnerConditionMatch", + "shacl:property": [ + { + "@id": "#/declarations/InnerConditionMatch/property/c2" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerConditionMatch/source-map" + } + ] + }, + { + "@id": "#/declarations/AndMember1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "AndMember1", + "shacl:property": [ + { + "@id": "#/declarations/AndMember1/property/am12" + }, + { + "@id": "#/declarations/AndMember1/property/am11" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember1/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "InnerOrMember1", + "shacl:property": [ + { + "@id": "#/declarations/InnerOrMember1/property/om12" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om11" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerOrMember1/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "InnerOrMember2", + "shacl:property": [ + { + "@id": "#/declarations/InnerOrMember2/property/om21" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerOrMember2/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerAndMember1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "InnerAndMember1", + "http://a.ml/vocabularies/amf/aml#if": [ + { + "@id": "#/declarations/InnerCondition" + } + ], + "http://a.ml/vocabularies/amf/aml#then": [ + { + "@id": "#/declarations/InnerConditionMatch" + } + ], + "http://a.ml/vocabularies/amf/aml#else": [ + { + "@id": "#/declarations/InnerConditionNoMatch" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerAndMember1/source-map" + } + ] + }, + { + "@id": "#/declarations/AndMember2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "AndMember2", + "http://a.ml/vocabularies/amf/aml#if": [ + { + "@id": "#/declarations/Condition" + } + ], + "http://a.ml/vocabularies/amf/aml#then": [ + { + "@id": "#/declarations/ConditionMatch" + } + ], + "http://a.ml/vocabularies/amf/aml#else": [ + { + "@id": "#/declarations/ConditionNoMatch" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember2/source-map" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "ConditionMatch", + "shacl:property": [ + { + "@id": "#/declarations/ConditionMatch/property/c1" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionMatch/source-map" + } + ] + }, + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_4" + }, + { + "@id": "#/source-map/lexical/element_2" + }, + { + "@id": "#/source-map/lexical/element_0" + }, + { + "@id": "#/source-map/lexical/element_1" + }, + { + "@id": "#/source-map/lexical/element_3" + } + ] + }, + { + "@id": "#/declarations/InnerAndMember2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerAndMember2/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/InnerAndMember2/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/declarations/InnerCondition/property/c2", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#c2" + } + ], + "core:name": "c2", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:in": { + "@id": "#/declarations/InnerCondition/property/c2/list" + }, + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerCondition/property/c2/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerCondition/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerCondition/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/InnerCondition/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/InnerCondition/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/AndMember3/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember3/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/AndMember3/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/no-other-something" + } + ], + "core:name": "c2", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerConditionNoMatch/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerConditionNoMatch/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/declarations/Condition/property/c1", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#c1" + } + ], + "core:name": "c1", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:in": { + "@id": "#/declarations/Condition/property/c1/list" + }, + "sourcemaps:sources": [ + { + "@id": "#/declarations/Condition/property/c1/source-map" + } + ] + }, + { + "@id": "#/declarations/Condition/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Condition/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Condition/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Condition/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/no-something" + } + ], + "core:name": "c1", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/other-something" + } + ], + "core:name": "c2", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerConditionMatch/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerConditionMatch/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/InnerConditionMatch/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/InnerConditionMatch/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am12" + } + ], + "core:name": "am12", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember1/property/am12/source-map" + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am11" + } + ], + "core:name": "am11", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember1/property/am11/source-map" + } + ] + }, + { + "@id": "#/declarations/AndMember1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/property/om12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#om12" + } + ], + "core:name": "om12", + "shacl:datatype": [ + { + "@id": "http://a.ml/vocabularies/shapes#number" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/property/om11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#om11" + } + ], + "core:name": "om11", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerOrMember1/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/InnerOrMember1/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/InnerOrMember1/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember2/property/om21", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#om21" + } + ], + "core:name": "om21", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#boolean" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerOrMember2/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/InnerOrMember2/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/InnerOrMember2/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/InnerAndMember1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerAndMember1/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/InnerAndMember1/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/declarations/AndMember2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember2/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/AndMember2/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/property/c1", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/something" + } + ], + "core:name": "c1", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/source-map/lexical/element_4", + "sourcemaps:element": "meta:externals", + "sourcemaps:value": "[(5,0)-(8,0)]" + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml", + "sourcemaps:value": "[(2,0)-(81,22)]" + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": "meta:documents", + "sourcemaps:value": "[(8,0)-(12,0)]" + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": "core:version", + "sourcemaps:value": "[(3,0)-(5,0)]" + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(2,0)-(3,0)]" + }, + { + "@id": "#/declarations/InnerAndMember2/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerAndMember2", + "sourcemaps:value": "[(53,2)-(57,0)]" + }, + { + "@id": "#/declarations/InnerAndMember2/source-map/lexical/element_0", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(53,2)-(53,17)]" + }, + { + "@id": "#/declarations/InnerCondition/property/c2/list", + "@type": "rdfs:Seq", + "rdfs:_1": { + "@value": "other-something", + "@type": "xsd:string" + } + }, + { + "@id": "#/declarations/InnerCondition/property/c2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/InnerCondition/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(57,2)-(57,16)]" + }, + { + "@id": "#/declarations/InnerCondition/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(58,4)-(62,0)]" + }, + { + "@id": "#/declarations/InnerCondition/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerCondition", + "sourcemaps:value": "[(57,2)-(62,0)]" + }, + { + "@id": "#/declarations/AndMember3/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember3", + "sourcemaps:value": "[(29,2)-(33,0)]" + }, + { + "@id": "#/declarations/AndMember3/source-map/lexical/element_0", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(29,2)-(29,12)]" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/InnerConditionNoMatch/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(67,2)-(67,23)]" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(68,4)-(72,0)]" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch", + "sourcemaps:value": "[(67,2)-(72,0)]" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/Root", + "sourcemaps:value": "[(13,2)-(18,0)]" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(13,2)-(13,6)]" + }, + { + "@id": "#/declarations/Condition/property/c1/list", + "@type": "rdfs:Seq", + "rdfs:_1": { + "@value": "something", + "@type": "xsd:string" + } + }, + { + "@id": "#/declarations/Condition/property/c1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/Condition/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(33,2)-(33,11)]" + }, + { + "@id": "#/declarations/Condition/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(34,4)-(38,0)]" + }, + { + "@id": "#/declarations/Condition/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/Condition", + "sourcemaps:value": "[(33,2)-(38,0)]" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(43,2)-(43,18)]" + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(44,4)-(48,0)]" + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionNoMatch", + "sourcemaps:value": "[(43,2)-(48,0)]" + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/InnerConditionMatch/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(62,2)-(62,21)]" + }, + { + "@id": "#/declarations/InnerConditionMatch/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(63,4)-(67,0)]" + }, + { + "@id": "#/declarations/InnerConditionMatch/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch", + "sourcemaps:value": "[(62,2)-(67,0)]" + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(18,2)-(18,12)]" + }, + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(19,4)-(24,0)]" + }, + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1", + "sourcemaps:value": "[(18,2)-(24,0)]" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(72,2)-(72,16)]" + }, + { + "@id": "#/declarations/InnerOrMember1/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(73,4)-(78,0)]" + }, + { + "@id": "#/declarations/InnerOrMember1/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1", + "sourcemaps:value": "[(72,2)-(78,0)]" + }, + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember2/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(78,2)-(78,16)]" + }, + { + "@id": "#/declarations/InnerOrMember2/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(79,4)-(81,22)]" + }, + { + "@id": "#/declarations/InnerOrMember2/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2", + "sourcemaps:value": "[(78,2)-(81,22)]" + }, + { + "@id": "#/declarations/InnerAndMember1/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerAndMember1", + "sourcemaps:value": "[(48,2)-(53,0)]" + }, + { + "@id": "#/declarations/InnerAndMember1/source-map/lexical/element_0", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(48,2)-(48,17)]" + }, + { + "@id": "#/declarations/AndMember2/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember2", + "sourcemaps:value": "[(24,2)-(29,0)]" + }, + { + "@id": "#/declarations/AndMember2/source-map/lexical/element_0", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(24,2)-(24,12)]" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(38,2)-(38,16)]" + }, + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(39,4)-(43,0)]" + }, + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionMatch", + "sourcemaps:value": "[(38,2)-(43,0)]" + }, + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_3", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(60,8)-(61,0)]" + }, + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_1", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(59,6)-(59,8)]" + }, + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_0", + "sourcemaps:element": "shacl:in", + "sourcemaps:value": "[(61,8)-(62,0)]" + }, + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerCondition/property/c2", + "sourcemaps:value": "[(59,9)-(62,0)]" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(69,6)-(69,8)]" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_1", + "sourcemaps:element": "shacl:path", + "sourcemaps:value": "[(71,8)-(72,0)]" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(70,8)-(71,0)]" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch/property/c2", + "sourcemaps:value": "[(69,9)-(72,0)]" + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_3", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(36,8)-(37,0)]" + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_1", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(35,6)-(35,8)]" + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_0", + "sourcemaps:element": "shacl:in", + "sourcemaps:value": "[(37,8)-(38,0)]" + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/Condition/property/c1", + "sourcemaps:value": "[(35,9)-(38,0)]" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(45,6)-(45,8)]" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_1", + "sourcemaps:element": "shacl:path", + "sourcemaps:value": "[(47,8)-(48,0)]" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(46,8)-(47,0)]" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionNoMatch/property/c1", + "sourcemaps:value": "[(45,9)-(48,0)]" + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(64,6)-(64,8)]" + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_1", + "sourcemaps:element": "shacl:path", + "sourcemaps:value": "[(66,8)-(67,0)]" + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(65,8)-(66,0)]" + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch/property/c2", + "sourcemaps:value": "[(64,9)-(67,0)]" + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(22,6)-(22,10)]" + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(23,8)-(24,0)]" + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1/property/am12", + "sourcemaps:value": "[(22,11)-(24,0)]" + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(20,6)-(20,10)]" + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(21,8)-(22,0)]" + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1/property/am11", + "sourcemaps:value": "[(20,11)-(22,0)]" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(76,6)-(76,10)]" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(77,8)-(78,0)]" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1/property/om12", + "sourcemaps:value": "[(76,11)-(78,0)]" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(74,6)-(74,10)]" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(75,8)-(76,0)]" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1/property/om11", + "sourcemaps:value": "[(74,11)-(76,0)]" + }, + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(80,6)-(80,10)]" + }, + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(81,8)-(81,22)]" + }, + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2/property/om21", + "sourcemaps:value": "[(80,11)-(81,22)]" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(40,6)-(40,8)]" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_1", + "sourcemaps:element": "shacl:path", + "sourcemaps:value": "[(42,8)-(43,0)]" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(41,8)-(42,0)]" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionMatch/property/c1", + "sourcemaps:value": "[(40,9)-(43,0)]" + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#", + "owl": "http://www.w3.org/2002/07/owl#", + "xsd": "http://www.w3.org/2001/XMLSchema#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.resolved.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.resolved.expanded.jsonld new file mode 100644 index 00000000..0ce2f700 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.resolved.expanded.jsonld @@ -0,0 +1,1199 @@ +[ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml", +"@type": [ +"http://a.ml/vocabularies/meta#Dialect", +"http://a.ml/vocabularies/document#Document", +"http://a.ml/vocabularies/document#Fragment", +"http://a.ml/vocabularies/document#Module", +"http://a.ml/vocabularies/document#Unit" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Mapping AllOf" +} +], +"http://a.ml/vocabularies/core#version": [ +{ +"@value": "1.0" +} +], +"http://a.ml/vocabularies/meta#extensions": [], +"http://a.ml/vocabularies/meta#externals": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/externals/schema-org", +"@type": [ +"http://www.w3.org/2002/07/owl#Ontology", +"http://a.ml/vocabularies/meta#ExternalVocabulary", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#displayName": [ +{ +"@value": "schema-org" +} +], +"http://a.ml/vocabularies/meta#base": [ +{ +"@value": "https://schema.org/" +} +] +} +], +"http://a.ml/vocabularies/meta#documents": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/documents", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentsModel", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/meta#rootDocument": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/documents/root", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Mapping AllOf 1.0" +} +], +"http://a.ml/vocabularies/meta#encodedNode": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/Root" +} +] +} +] +} +], +"http://a.ml/vocabularies/document#location": [ +{ +"@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml" +} +], +"http://a.ml/vocabularies/document#root": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/document#processingData": [ +{ +"@id": "null/BaseUnitProcessingData", +"@type": [ +"http://a.ml/vocabularies/document#BaseUnitProcessingData" +], +"http://a.ml/vocabularies/document#transformed": [ +{ +"@value": true +} +] +} +], +"http://a.ml/vocabularies/document#declares": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "InnerConditionNoMatch" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch/property/c2", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/no-other-something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c2" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember3", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "AndMember3" +} +], +"http://a.ml/vocabularies/amf/aml#and": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerAndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerAndMember2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/CombiningMapping_3", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_3" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch/property/c2", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/no-other-something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c2" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1/property/om12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://a.ml/vocabularies/shapes#number" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1/property/om11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "InnerOrMember1" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1/property/om12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://a.ml/vocabularies/shapes#number" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1/property/om11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/CombiningMapping_6", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_6" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionNoMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/no-something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember3" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember3" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/Condition", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Condition" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/Condition/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#c1" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +], +"http://www.w3.org/ns/shacl#in": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/Condition/property/c1/list", +"@type": "http://www.w3.org/2000/01/rdf-schema#Seq", +"http://www.w3.org/2000/01/rdf-schema#_1": [ +{ +"@value": "something", +"@type": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "InnerConditionMatch" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch/property/c2", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/other-something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c2" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerCondition", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "InnerCondition" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerCondition/property/c2", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#c2" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c2" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +], +"http://www.w3.org/ns/shacl#in": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerCondition/property/c2/list", +"@type": "http://www.w3.org/2000/01/rdf-schema#Seq", +"http://www.w3.org/2000/01/rdf-schema#_1": [ +{ +"@value": "other-something", +"@type": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "AndMember2" +} +], +"http://a.ml/vocabularies/amf/aml#if": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/Condition" +} +], +"http://a.ml/vocabularies/amf/aml#then": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionMatch" +} +], +"http://a.ml/vocabularies/amf/aml#else": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionNoMatch" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/CombiningMapping_2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_2" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch/property/c2", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/other-something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c2" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2/property/om21", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om21" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om21" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#boolean" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/Root", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Root" +} +], +"http://a.ml/vocabularies/amf/aml#and": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember3" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/CombiningMapping_5", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_5" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember3" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember3" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionNoMatch", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "ConditionNoMatch" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionNoMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/no-something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerAndMember2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "InnerAndMember2" +} +], +"http://a.ml/vocabularies/amf/aml#or": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "InnerOrMember2" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2/property/om21", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om21" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om21" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#boolean" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/CombiningMapping_4", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_4" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch/property/c2", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/no-other-something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c2" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2/property/om21", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om21" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om21" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#boolean" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "AndMember1" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerAndMember1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "InnerAndMember1" +} +], +"http://a.ml/vocabularies/amf/aml#if": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerCondition" +} +], +"http://a.ml/vocabularies/amf/aml#then": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch" +} +], +"http://a.ml/vocabularies/amf/aml#else": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/CombiningMapping_1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_1" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch/property/c2", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/other-something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c2" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1/property/om12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://a.ml/vocabularies/shapes#number" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1/property/om11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionMatch", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "ConditionMatch" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +} +] +} +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.resolved.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.resolved.flattened.jsonld new file mode 100644 index 00000000..a7c27b70 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.resolved.flattened.jsonld @@ -0,0 +1,814 @@ +{ +"@graph": [ +{ +"@id": "null/BaseUnitProcessingData", +"@type": [ +"http://a.ml/vocabularies/document#BaseUnitProcessingData" +], +"http://a.ml/vocabularies/document#transformed": true +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/documents", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentsModel", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/meta#rootDocument": { +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/documents/root" +} +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/externals/schema-org", +"@type": [ +"http://www.w3.org/2002/07/owl#Ontology", +"http://a.ml/vocabularies/meta#ExternalVocabulary", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#displayName": "schema-org", +"http://a.ml/vocabularies/meta#base": "https://schema.org/" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/documents/root", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "Mapping AllOf 1.0", +"http://a.ml/vocabularies/meta#encodedNode": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/Root" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml", +"http://a.ml/vocabularies/document#declares": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember3" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/CombiningMapping_3" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/CombiningMapping_6" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/Condition" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerCondition" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/CombiningMapping_2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/Root" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/CombiningMapping_5" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerAndMember2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/CombiningMapping_4" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerAndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/CombiningMapping_1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionMatch" +} +], +"@type": [ +"http://a.ml/vocabularies/meta#Dialect", +"http://a.ml/vocabularies/document#Document", +"http://a.ml/vocabularies/document#Fragment", +"http://a.ml/vocabularies/document#Module", +"http://a.ml/vocabularies/document#Unit" +], +"http://a.ml/vocabularies/core#name": "Mapping AllOf", +"http://a.ml/vocabularies/core#version": "1.0", +"http://a.ml/vocabularies/meta#extensions": [], +"http://a.ml/vocabularies/meta#externals": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/externals/schema-org" +} +], +"http://a.ml/vocabularies/meta#documents": { +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/documents" +}, +"http://a.ml/vocabularies/document#location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml", +"http://a.ml/vocabularies/document#root": false, +"http://a.ml/vocabularies/document#processingData": { +"@id": "null/BaseUnitProcessingData" +} +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "InnerConditionNoMatch", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch/property/c2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember3", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "AndMember3", +"http://a.ml/vocabularies/amf/aml#and": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerAndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerAndMember2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/CombiningMapping_3", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_3", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch/property/c2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1/property/om12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1/property/om11" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "InnerOrMember1", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1/property/om12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1/property/om11" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/CombiningMapping_6", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_6", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1/property/am12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1/property/am11" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionNoMatch/property/c1" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember3" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember3" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/Condition", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "Condition", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/Condition/property/c1" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "InnerConditionMatch", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch/property/c2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerCondition", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "InnerCondition", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerCondition/property/c2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "AndMember2", +"http://a.ml/vocabularies/amf/aml#if": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/Condition" +} +], +"http://a.ml/vocabularies/amf/aml#then": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionMatch" +} +], +"http://a.ml/vocabularies/amf/aml#else": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionNoMatch" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/CombiningMapping_2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_2", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch/property/c2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2/property/om21" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/Root", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "Root", +"http://a.ml/vocabularies/amf/aml#and": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember3" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/CombiningMapping_5", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_5", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1/property/am12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1/property/am11" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionMatch/property/c1" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember3" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember3" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionNoMatch", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "ConditionNoMatch", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionNoMatch/property/c1" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerAndMember2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "InnerAndMember2", +"http://a.ml/vocabularies/amf/aml#or": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "InnerOrMember2", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2/property/om21" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/CombiningMapping_4", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_4", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch/property/c2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2/property/om21" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "AndMember1", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1/property/am12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1/property/am11" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerAndMember1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "InnerAndMember1", +"http://a.ml/vocabularies/amf/aml#if": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerCondition" +} +], +"http://a.ml/vocabularies/amf/aml#then": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch" +} +], +"http://a.ml/vocabularies/amf/aml#else": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml/CombiningMapping_1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_1", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch/property/c2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1/property/om12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1/property/om11" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionMatch", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "ConditionMatch", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionMatch/property/c1" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionNoMatch/property/c2", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/no-other-something" +} +], +"http://a.ml/vocabularies/core#name": "c2", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1/property/om12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om12" +} +], +"http://a.ml/vocabularies/core#name": "om12", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://a.ml/vocabularies/shapes#number" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember1/property/om11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om11" +} +], +"http://a.ml/vocabularies/core#name": "om11", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": "am12", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/AndMember1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": "am11", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionNoMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/no-something" +} +], +"http://a.ml/vocabularies/core#name": "c1", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/Condition/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#c1" +} +], +"http://a.ml/vocabularies/core#name": "c1", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +], +"http://www.w3.org/ns/shacl#in": { +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/Condition/property/c1/list" +} +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerConditionMatch/property/c2", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/other-something" +} +], +"http://a.ml/vocabularies/core#name": "c2", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerCondition/property/c2", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#c2" +} +], +"http://a.ml/vocabularies/core#name": "c2", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +], +"http://www.w3.org/ns/shacl#in": { +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerCondition/property/c2/list" +} +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerOrMember2/property/om21", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om21" +} +], +"http://a.ml/vocabularies/core#name": "om21", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#boolean" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/ConditionMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/something" +} +], +"http://a.ml/vocabularies/core#name": "c1", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/Condition/property/c1/list", +"@type": "http://www.w3.org/2000/01/rdf-schema#Seq", +"http://www.w3.org/2000/01/rdf-schema#_1": { +"@value": "something", +"@type": "http://www.w3.org/2001/XMLSchema#string" +} +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml#/declarations/InnerCondition/property/c2/list", +"@type": "http://www.w3.org/2000/01/rdf-schema#Seq", +"http://www.w3.org/2000/01/rdf-schema#_1": { +"@value": "other-something", +"@type": "http://www.w3.org/2001/XMLSchema#string" +} +} +] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.resolved.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.resolved.yaml new file mode 100644 index 00000000..9c5d6c45 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.resolved.yaml @@ -0,0 +1,156 @@ +#%Dialect 1.0 +external: + schema-org: https://schema.org/ +documents: + root: + encodes: Root +nodeMappings: + Root: + allOf: + - AndMember1 + - AndMember2 + - AndMember3 + AndMember1: + mapping: + am11: + range: string + am12: + range: string + AndMember2: + conditional: + if: Condition + then: ConditionMatch + else: ConditionNoMatch + AndMember3: + allOf: + - InnerAndMember1 + - InnerAndMember2 + Condition: + mapping: + c1: + range: string + enum: + - something + ConditionMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.something + ConditionNoMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.no-something + InnerAndMember1: + conditional: + if: InnerCondition + then: InnerConditionMatch + else: InnerConditionNoMatch + InnerAndMember2: + oneOf: + - InnerOrMember1 + - InnerOrMember2 + InnerCondition: + mapping: + c2: + range: string + enum: + - other-something + InnerConditionMatch: + mapping: + c2: + range: string + propertyTerm: schema-org.other-something + InnerConditionNoMatch: + mapping: + c2: + range: string + propertyTerm: schema-org.no-other-something + InnerOrMember1: + mapping: + om11: + range: string + om12: + range: number + InnerOrMember2: + mapping: + om21: + range: boolean + CombiningMapping_3: + components: + - InnerConditionNoMatch + - InnerOrMember1 + mapping: + c2: + range: string + propertyTerm: schema-org.no-other-something + om11: + range: string + om12: + range: number + additionalProperties: true + CombiningMapping_6: + components: + - AndMember1 + - ConditionNoMatch + - AndMember3 + mapping: + am11: + range: string + am12: + range: string + c1: + range: string + propertyTerm: schema-org.no-something + additionalProperties: true + CombiningMapping_2: + components: + - InnerConditionMatch + - InnerOrMember2 + mapping: + c2: + range: string + propertyTerm: schema-org.other-something + om21: + range: boolean + additionalProperties: true + CombiningMapping_5: + components: + - AndMember1 + - ConditionMatch + - AndMember3 + mapping: + am11: + range: string + am12: + range: string + c1: + range: string + propertyTerm: schema-org.something + additionalProperties: true + CombiningMapping_4: + components: + - InnerConditionNoMatch + - InnerOrMember2 + mapping: + c2: + range: string + propertyTerm: schema-org.no-other-something + om21: + range: boolean + additionalProperties: true + CombiningMapping_1: + components: + - InnerConditionMatch + - InnerOrMember1 + mapping: + c2: + range: string + propertyTerm: schema-org.other-something + om11: + range: string + om12: + range: number + additionalProperties: true +dialect: Mapping AllOf +version: "1.0" diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml new file mode 100644 index 00000000..120475ef --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested-allOf/dialect.yaml @@ -0,0 +1,81 @@ +#%Dialect 1.0 +dialect: Mapping AllOf +version: 1.0 + +external: + schema-org: https://schema.org/ + +documents: + root: + encodes: Root + +nodeMappings: + Root: + allOf: + - AndMember1 + - AndMember2 + - AndMember3 + AndMember1: + mapping: + am11: + range: string + am12: + range: string + AndMember2: + conditional: + if: Condition + then: ConditionMatch + else: ConditionNoMatch + AndMember3: + allOf: + - InnerAndMember1 + - InnerAndMember2 + Condition: + mapping: + c1: + range: string + enum: ["something"] + ConditionMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.something + ConditionNoMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.no-something + InnerAndMember1: + conditional: + if: InnerCondition + then: InnerConditionMatch + else: InnerConditionNoMatch + InnerAndMember2: + oneOf: + - InnerOrMember1 + - InnerOrMember2 + InnerCondition: + mapping: + c2: + range: string + enum: [ "other-something" ] + InnerConditionMatch: + mapping: + c2: + range: string + propertyTerm: schema-org.other-something + InnerConditionNoMatch: + mapping: + c2: + range: string + propertyTerm: schema-org.no-other-something + InnerOrMember1: + mapping: + om11: + range: string + om12: + range: number + InnerOrMember2: + mapping: + om21: + range: boolean \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.cycled.jsonld.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.cycled.jsonld.yaml new file mode 100644 index 00000000..b189aba8 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.cycled.jsonld.yaml @@ -0,0 +1,80 @@ +#%Dialect 1.0 +dialect: Mapping AllOf +version: "1.0" +external: + schema-org: https://schema.org/ +documents: + root: + encodes: Root +nodeMappings: + Root: + allOf: + - AndMember1 + - AndMember2 + - AndMember3 + AndMember1: + mapping: + am11: + range: string + am12: + range: string + AndMember2: + conditional: + if: Condition + then: ConditionMatch + else: ConditionNoMatch + AndMember3: + oneOf: + - OrMember1 + - OrMember2 + Condition: + mapping: + c1: + range: string + enum: + - something + ConditionMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.something + ConditionNoMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.no-something + OrMember1: + conditional: + if: InnerCondition + then: InnerConditionMatch + else: InnerConditionNoMatch + OrMember2: + oneOf: + - InnerOrMember1 + - InnerOrMember2 + InnerCondition: + mapping: + c2: + range: string + enum: + - other-something + InnerConditionMatch: + mapping: + c2: + range: string + propertyTerm: schema-org.other-something + InnerConditionNoMatch: + mapping: + c2: + range: string + propertyTerm: schema-org.no-other-something + InnerOrMember1: + mapping: + om11: + range: string + om12: + range: number + InnerOrMember2: + mapping: + om21: + range: boolean diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.cycled.yaml new file mode 100644 index 00000000..b189aba8 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.cycled.yaml @@ -0,0 +1,80 @@ +#%Dialect 1.0 +dialect: Mapping AllOf +version: "1.0" +external: + schema-org: https://schema.org/ +documents: + root: + encodes: Root +nodeMappings: + Root: + allOf: + - AndMember1 + - AndMember2 + - AndMember3 + AndMember1: + mapping: + am11: + range: string + am12: + range: string + AndMember2: + conditional: + if: Condition + then: ConditionMatch + else: ConditionNoMatch + AndMember3: + oneOf: + - OrMember1 + - OrMember2 + Condition: + mapping: + c1: + range: string + enum: + - something + ConditionMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.something + ConditionNoMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.no-something + OrMember1: + conditional: + if: InnerCondition + then: InnerConditionMatch + else: InnerConditionNoMatch + OrMember2: + oneOf: + - InnerOrMember1 + - InnerOrMember2 + InnerCondition: + mapping: + c2: + range: string + enum: + - other-something + InnerConditionMatch: + mapping: + c2: + range: string + propertyTerm: schema-org.other-something + InnerConditionNoMatch: + mapping: + c2: + range: string + propertyTerm: schema-org.no-other-something + InnerOrMember1: + mapping: + om11: + range: string + om12: + range: number + InnerOrMember2: + mapping: + om21: + range: boolean diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.expanded.jsonld new file mode 100644 index 00000000..8ef9bcbf --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.expanded.jsonld @@ -0,0 +1,2068 @@ +[ + { + "@id": "", + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": [ + { + "@value": "Mapping AllOf" + } + ], + "core:version": [ + { + "@value": "1.0" + } + ], + "meta:externals": [ + { + "@id": "/externals/schema-org", + "@type": [ + "owl:Ontology", + "meta:ExternalVocabulary", + "doc:DomainElement" + ], + "core:displayName": [ + { + "@value": "schema-org" + } + ], + "meta:base": [ + { + "@value": "https://schema.org/" + } + ], + "sourcemaps:sources": [ + { + "@id": "/externals/schema-org#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/externals/schema-org#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:displayName" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,2)-(6,12)]" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:base" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,14)-(6,33)]" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/externals/schema-org" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,2)-(8,0)]" + } + ] + } + ] + } + ] + } + ], + "meta:documents": [ + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": [ + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Mapping AllOf 1.0" + } + ], + "meta:encodedNode": [ + { + "@id": "#/declarations/Root" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/documents/root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,7)-(12,0)]" + } + ] + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:encodedNode" + } + ], + "sourcemaps:value": [ + { + "@value": "[(10,4)-(12,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,0)-(12,0)]" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:rootDocument" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,2)-(12,0)]" + } + ] + } + ] + } + ] + } + ], + "doc:location": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml" + } + ], + "doc:root": [ + { + "@value": true + } + ], + "doc:processingData": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": [ + { + "@value": false + } + ], + "doc:sourceSpec": [ + { + "@value": "AML 1.0" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_4", + "sourcemaps:element": [ + { + "@value": "meta:externals" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,0)-(8,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(81,22)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(8,0)-(12,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:version" + } + ], + "sourcemaps:value": [ + { + "@value": "[(3,0)-(5,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + } + ] + } + ], + "doc:declares": [ + { + "@id": "#/declarations/InnerCondition", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "InnerCondition" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/InnerCondition/property/c2", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#c2" + } + ], + "core:name": [ + { + "@value": "c2" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:in": [ + { + "@id": "#/declarations/InnerCondition/property/c2/list", + "@type": "rdfs:Seq", + "rdfs:_1": [ + { + "@value": "other-something", + "@type": "xsd:string" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerCondition/property/c2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(60,8)-(61,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(59,6)-(59,8)]" + } + ] + }, + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:in" + } + ], + "sourcemaps:value": [ + { + "@value": "[(61,8)-(62,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerCondition/property/c2" + } + ], + "sourcemaps:value": [ + { + "@value": "[(59,9)-(62,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerCondition/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerCondition/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(57,2)-(57,16)]" + } + ] + }, + { + "@id": "#/declarations/InnerCondition/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(58,4)-(62,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerCondition/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerCondition" + } + ], + "sourcemaps:value": [ + { + "@value": "[(57,2)-(62,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/AndMember3", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "AndMember3" + } + ], + "http://a.ml/vocabularies/amf/aml#or": [ + { + "@id": "#/declarations/OrMember1" + }, + { + "@id": "#/declarations/OrMember2" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember3/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember3/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember3" + } + ], + "sourcemaps:value": [ + { + "@value": "[(29,2)-(33,0)]" + } + ] + }, + { + "@id": "#/declarations/AndMember3/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(29,2)-(29,12)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/InnerConditionNoMatch", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "InnerConditionNoMatch" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/no-other-something" + } + ], + "core:name": [ + { + "@value": "c2" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(69,6)-(69,8)]" + } + ] + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "shacl:path" + } + ], + "sourcemaps:value": [ + { + "@value": "[(71,8)-(72,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(70,8)-(71,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch/property/c2" + } + ], + "sourcemaps:value": [ + { + "@value": "[(69,9)-(72,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerConditionNoMatch/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerConditionNoMatch/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(67,2)-(67,23)]" + } + ] + }, + { + "@id": "#/declarations/InnerConditionNoMatch/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(68,4)-(72,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerConditionNoMatch/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch" + } + ], + "sourcemaps:value": [ + { + "@value": "[(67,2)-(72,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Root", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Root" + } + ], + "http://a.ml/vocabularies/amf/aml#and": [ + { + "@id": "#/declarations/AndMember1" + }, + { + "@id": "#/declarations/AndMember2" + }, + { + "@id": "#/declarations/AndMember3" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/Root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(13,2)-(18,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(13,2)-(13,6)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Condition", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Condition" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Condition/property/c1", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#c1" + } + ], + "core:name": [ + { + "@value": "c1" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:in": [ + { + "@id": "#/declarations/Condition/property/c1/list", + "@type": "rdfs:Seq", + "rdfs:_1": [ + { + "@value": "something", + "@type": "xsd:string" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Condition/property/c1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(36,8)-(37,0)]" + } + ] + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(35,6)-(35,8)]" + } + ] + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:in" + } + ], + "sourcemaps:value": [ + { + "@value": "[(37,8)-(38,0)]" + } + ] + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/Condition/property/c1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(35,9)-(38,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Condition/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Condition/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(33,2)-(33,11)]" + } + ] + }, + { + "@id": "#/declarations/Condition/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(34,4)-(38,0)]" + } + ] + }, + { + "@id": "#/declarations/Condition/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/Condition" + } + ], + "sourcemaps:value": [ + { + "@value": "[(33,2)-(38,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "ConditionNoMatch" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/ConditionNoMatch/property/c1", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/no-something" + } + ], + "core:name": [ + { + "@value": "c1" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(45,6)-(45,8)]" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "shacl:path" + } + ], + "sourcemaps:value": [ + { + "@value": "[(47,8)-(48,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(46,8)-(47,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch/property/c1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(45,9)-(48,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionNoMatch/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(43,2)-(43,18)]" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(44,4)-(48,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch" + } + ], + "sourcemaps:value": [ + { + "@value": "[(43,2)-(48,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/OrMember2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "OrMember2" + } + ], + "http://a.ml/vocabularies/amf/aml#or": [ + { + "@id": "#/declarations/InnerOrMember1" + }, + { + "@id": "#/declarations/InnerOrMember2" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/OrMember2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/OrMember2/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/OrMember2" + } + ], + "sourcemaps:value": [ + { + "@value": "[(53,2)-(57,0)]" + } + ] + }, + { + "@id": "#/declarations/OrMember2/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(53,2)-(53,11)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/InnerConditionMatch", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "InnerConditionMatch" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/InnerConditionMatch/property/c2", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/other-something" + } + ], + "core:name": [ + { + "@value": "c2" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(64,6)-(64,8)]" + } + ] + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "shacl:path" + } + ], + "sourcemaps:value": [ + { + "@value": "[(66,8)-(67,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(65,8)-(66,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch/property/c2" + } + ], + "sourcemaps:value": [ + { + "@value": "[(64,9)-(67,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerConditionMatch/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerConditionMatch/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(62,2)-(62,21)]" + } + ] + }, + { + "@id": "#/declarations/InnerConditionMatch/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(63,4)-(67,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerConditionMatch/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch" + } + ], + "sourcemaps:value": [ + { + "@value": "[(62,2)-(67,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/AndMember1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "AndMember1" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/AndMember1/property/am12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am12" + } + ], + "core:name": [ + { + "@value": "am12" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember1/property/am12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(22,6)-(22,10)]" + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(23,8)-(24,0)]" + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am12" + } + ], + "sourcemaps:value": [ + { + "@value": "[(22,11)-(24,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am11" + } + ], + "core:name": [ + { + "@value": "am11" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember1/property/am11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(20,6)-(20,10)]" + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(21,8)-(22,0)]" + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am11" + } + ], + "sourcemaps:value": [ + { + "@value": "[(20,11)-(22,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(18,2)-(18,12)]" + } + ] + }, + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(19,4)-(24,0)]" + } + ] + }, + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(18,2)-(24,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "InnerOrMember1" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/InnerOrMember1/property/om12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#om12" + } + ], + "core:name": [ + { + "@value": "om12" + } + ], + "shacl:datatype": [ + { + "@id": "http://a.ml/vocabularies/shapes#number" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(76,6)-(76,10)]" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(77,8)-(78,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1/property/om12" + } + ], + "sourcemaps:value": [ + { + "@value": "[(76,11)-(78,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/property/om11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#om11" + } + ], + "core:name": [ + { + "@value": "om11" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(74,6)-(74,10)]" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(75,8)-(76,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1/property/om11" + } + ], + "sourcemaps:value": [ + { + "@value": "[(74,11)-(76,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerOrMember1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerOrMember1/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(72,2)-(72,16)]" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(73,4)-(78,0)]" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(72,2)-(78,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/OrMember1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "OrMember1" + } + ], + "http://a.ml/vocabularies/amf/aml#if": [ + { + "@id": "#/declarations/InnerCondition" + } + ], + "http://a.ml/vocabularies/amf/aml#then": [ + { + "@id": "#/declarations/InnerConditionMatch" + } + ], + "http://a.ml/vocabularies/amf/aml#else": [ + { + "@id": "#/declarations/InnerConditionNoMatch" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/OrMember1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/OrMember1/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/OrMember1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(48,2)-(53,0)]" + } + ] + }, + { + "@id": "#/declarations/OrMember1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(48,2)-(48,11)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/InnerOrMember2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "InnerOrMember2" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/InnerOrMember2/property/om21", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#om21" + } + ], + "core:name": [ + { + "@value": "om21" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#boolean" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(80,6)-(80,10)]" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(81,8)-(81,22)]" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2/property/om21" + } + ], + "sourcemaps:value": [ + { + "@value": "[(80,11)-(81,22)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerOrMember2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerOrMember2/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(78,2)-(78,16)]" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember2/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(79,4)-(81,22)]" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember2/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2" + } + ], + "sourcemaps:value": [ + { + "@value": "[(78,2)-(81,22)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/AndMember2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "AndMember2" + } + ], + "http://a.ml/vocabularies/amf/aml#if": [ + { + "@id": "#/declarations/Condition" + } + ], + "http://a.ml/vocabularies/amf/aml#then": [ + { + "@id": "#/declarations/ConditionMatch" + } + ], + "http://a.ml/vocabularies/amf/aml#else": [ + { + "@id": "#/declarations/ConditionNoMatch" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember2/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember2" + } + ], + "sourcemaps:value": [ + { + "@value": "[(24,2)-(29,0)]" + } + ] + }, + { + "@id": "#/declarations/AndMember2/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(24,2)-(24,12)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/ConditionMatch", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "ConditionMatch" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/ConditionMatch/property/c1", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/something" + } + ], + "core:name": [ + { + "@value": "c1" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(40,6)-(40,8)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "shacl:path" + } + ], + "sourcemaps:value": [ + { + "@value": "[(42,8)-(43,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(41,8)-(42,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch/property/c1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(40,9)-(43,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionMatch/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(38,2)-(38,16)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(39,4)-(43,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch" + } + ], + "sourcemaps:value": [ + { + "@value": "[(38,2)-(43,0)]" + } + ] + } + ] + } + ] + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "owl": "http://www.w3.org/2002/07/owl#", + "meta": "http://a.ml/vocabularies/meta#", + "xsd": "http://www.w3.org/2001/XMLSchema#" + } + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.flattened.jsonld new file mode 100644 index 00000000..78a7f5e1 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.flattened.jsonld @@ -0,0 +1,1660 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/externals/schema-org", + "@type": [ + "owl:Ontology", + "meta:ExternalVocabulary", + "doc:DomainElement" + ], + "core:displayName": "schema-org", + "meta:base": "https://schema.org/", + "sourcemaps:sources": [ + { + "@id": "/externals/schema-org#/source-map" + } + ] + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + }, + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/externals/schema-org#/source-map/lexical/element_2" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_0" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "Mapping AllOf 1.0", + "meta:encodedNode": [ + { + "@id": "#/declarations/Root" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map" + } + ] + }, + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1" + }, + { + "@id": "/documents#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_2", + "sourcemaps:element": "core:displayName", + "sourcemaps:value": "[(6,2)-(6,12)]" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_0", + "sourcemaps:element": "meta:base", + "sourcemaps:value": "[(6,14)-(6,33)]" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/externals/schema-org", + "sourcemaps:value": "[(6,2)-(8,0)]" + }, + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/documents", + "sourcemaps:value": "[(9,0)-(12,0)]" + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": "meta:rootDocument", + "sourcemaps:value": "[(9,2)-(12,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/documents/root", + "sourcemaps:value": "[(9,7)-(12,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": "meta:encodedNode", + "sourcemaps:value": "[(10,4)-(12,0)]" + }, + { + "@id": "", + "doc:declares": [ + { + "@id": "#/declarations/InnerCondition" + }, + { + "@id": "#/declarations/AndMember3" + }, + { + "@id": "#/declarations/InnerConditionNoMatch" + }, + { + "@id": "#/declarations/Root" + }, + { + "@id": "#/declarations/Condition" + }, + { + "@id": "#/declarations/ConditionNoMatch" + }, + { + "@id": "#/declarations/OrMember2" + }, + { + "@id": "#/declarations/InnerConditionMatch" + }, + { + "@id": "#/declarations/AndMember1" + }, + { + "@id": "#/declarations/InnerOrMember1" + }, + { + "@id": "#/declarations/OrMember1" + }, + { + "@id": "#/declarations/InnerOrMember2" + }, + { + "@id": "#/declarations/AndMember2" + }, + { + "@id": "#/declarations/ConditionMatch" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "Mapping AllOf", + "core:version": "1.0", + "meta:externals": [ + { + "@id": "/externals/schema-org" + } + ], + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + }, + "sourcemaps:sources": [ + { + "@id": "#/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerCondition", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "InnerCondition", + "shacl:property": [ + { + "@id": "#/declarations/InnerCondition/property/c2" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerCondition/source-map" + } + ] + }, + { + "@id": "#/declarations/AndMember3", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "AndMember3", + "http://a.ml/vocabularies/amf/aml#or": [ + { + "@id": "#/declarations/OrMember1" + }, + { + "@id": "#/declarations/OrMember2" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember3/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerConditionNoMatch", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "InnerConditionNoMatch", + "shacl:property": [ + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerConditionNoMatch/source-map" + } + ] + }, + { + "@id": "#/declarations/Root", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Root", + "http://a.ml/vocabularies/amf/aml#and": [ + { + "@id": "#/declarations/AndMember1" + }, + { + "@id": "#/declarations/AndMember2" + }, + { + "@id": "#/declarations/AndMember3" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/source-map" + } + ] + }, + { + "@id": "#/declarations/Condition", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Condition", + "shacl:property": [ + { + "@id": "#/declarations/Condition/property/c1" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Condition/source-map" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "ConditionNoMatch", + "shacl:property": [ + { + "@id": "#/declarations/ConditionNoMatch/property/c1" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionNoMatch/source-map" + } + ] + }, + { + "@id": "#/declarations/OrMember2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "OrMember2", + "http://a.ml/vocabularies/amf/aml#or": [ + { + "@id": "#/declarations/InnerOrMember1" + }, + { + "@id": "#/declarations/InnerOrMember2" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/OrMember2/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerConditionMatch", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "InnerConditionMatch", + "shacl:property": [ + { + "@id": "#/declarations/InnerConditionMatch/property/c2" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerConditionMatch/source-map" + } + ] + }, + { + "@id": "#/declarations/AndMember1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "AndMember1", + "shacl:property": [ + { + "@id": "#/declarations/AndMember1/property/am12" + }, + { + "@id": "#/declarations/AndMember1/property/am11" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember1/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "InnerOrMember1", + "shacl:property": [ + { + "@id": "#/declarations/InnerOrMember1/property/om12" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om11" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerOrMember1/source-map" + } + ] + }, + { + "@id": "#/declarations/OrMember1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "OrMember1", + "http://a.ml/vocabularies/amf/aml#if": [ + { + "@id": "#/declarations/InnerCondition" + } + ], + "http://a.ml/vocabularies/amf/aml#then": [ + { + "@id": "#/declarations/InnerConditionMatch" + } + ], + "http://a.ml/vocabularies/amf/aml#else": [ + { + "@id": "#/declarations/InnerConditionNoMatch" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/OrMember1/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "InnerOrMember2", + "shacl:property": [ + { + "@id": "#/declarations/InnerOrMember2/property/om21" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerOrMember2/source-map" + } + ] + }, + { + "@id": "#/declarations/AndMember2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "AndMember2", + "http://a.ml/vocabularies/amf/aml#if": [ + { + "@id": "#/declarations/Condition" + } + ], + "http://a.ml/vocabularies/amf/aml#then": [ + { + "@id": "#/declarations/ConditionMatch" + } + ], + "http://a.ml/vocabularies/amf/aml#else": [ + { + "@id": "#/declarations/ConditionNoMatch" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember2/source-map" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "ConditionMatch", + "shacl:property": [ + { + "@id": "#/declarations/ConditionMatch/property/c1" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionMatch/source-map" + } + ] + }, + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_4" + }, + { + "@id": "#/source-map/lexical/element_2" + }, + { + "@id": "#/source-map/lexical/element_0" + }, + { + "@id": "#/source-map/lexical/element_1" + }, + { + "@id": "#/source-map/lexical/element_3" + } + ] + }, + { + "@id": "#/declarations/InnerCondition/property/c2", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#c2" + } + ], + "core:name": "c2", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:in": { + "@id": "#/declarations/InnerCondition/property/c2/list" + }, + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerCondition/property/c2/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerCondition/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerCondition/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/InnerCondition/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/InnerCondition/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/AndMember3/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember3/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/AndMember3/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/no-other-something" + } + ], + "core:name": "c2", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerConditionNoMatch/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerConditionNoMatch/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/declarations/Condition/property/c1", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#c1" + } + ], + "core:name": "c1", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:in": { + "@id": "#/declarations/Condition/property/c1/list" + }, + "sourcemaps:sources": [ + { + "@id": "#/declarations/Condition/property/c1/source-map" + } + ] + }, + { + "@id": "#/declarations/Condition/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Condition/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Condition/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Condition/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/no-something" + } + ], + "core:name": "c1", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/OrMember2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/OrMember2/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/OrMember2/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/other-something" + } + ], + "core:name": "c2", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerConditionMatch/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerConditionMatch/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/InnerConditionMatch/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/InnerConditionMatch/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am12" + } + ], + "core:name": "am12", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember1/property/am12/source-map" + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am11" + } + ], + "core:name": "am11", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/AndMember1/property/am11/source-map" + } + ] + }, + { + "@id": "#/declarations/AndMember1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/property/om12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#om12" + } + ], + "core:name": "om12", + "shacl:datatype": [ + { + "@id": "http://a.ml/vocabularies/shapes#number" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/property/om11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#om11" + } + ], + "core:name": "om11", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerOrMember1/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/InnerOrMember1/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/InnerOrMember1/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/OrMember1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/OrMember1/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/OrMember1/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember2/property/om21", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#om21" + } + ], + "core:name": "om21", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#boolean" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerOrMember2/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/InnerOrMember2/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/InnerOrMember2/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/AndMember2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember2/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/AndMember2/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/property/c1", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/something" + } + ], + "core:name": "c1", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/source-map/lexical/element_4", + "sourcemaps:element": "meta:externals", + "sourcemaps:value": "[(5,0)-(8,0)]" + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml", + "sourcemaps:value": "[(2,0)-(81,22)]" + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": "meta:documents", + "sourcemaps:value": "[(8,0)-(12,0)]" + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": "core:version", + "sourcemaps:value": "[(3,0)-(5,0)]" + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(2,0)-(3,0)]" + }, + { + "@id": "#/declarations/InnerCondition/property/c2/list", + "@type": "rdfs:Seq", + "rdfs:_1": { + "@value": "other-something", + "@type": "xsd:string" + } + }, + { + "@id": "#/declarations/InnerCondition/property/c2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/InnerCondition/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(57,2)-(57,16)]" + }, + { + "@id": "#/declarations/InnerCondition/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(58,4)-(62,0)]" + }, + { + "@id": "#/declarations/InnerCondition/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerCondition", + "sourcemaps:value": "[(57,2)-(62,0)]" + }, + { + "@id": "#/declarations/AndMember3/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember3", + "sourcemaps:value": "[(29,2)-(33,0)]" + }, + { + "@id": "#/declarations/AndMember3/source-map/lexical/element_0", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(29,2)-(29,12)]" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/InnerConditionNoMatch/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(67,2)-(67,23)]" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(68,4)-(72,0)]" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch", + "sourcemaps:value": "[(67,2)-(72,0)]" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/Root", + "sourcemaps:value": "[(13,2)-(18,0)]" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(13,2)-(13,6)]" + }, + { + "@id": "#/declarations/Condition/property/c1/list", + "@type": "rdfs:Seq", + "rdfs:_1": { + "@value": "something", + "@type": "xsd:string" + } + }, + { + "@id": "#/declarations/Condition/property/c1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/Condition/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(33,2)-(33,11)]" + }, + { + "@id": "#/declarations/Condition/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(34,4)-(38,0)]" + }, + { + "@id": "#/declarations/Condition/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/Condition", + "sourcemaps:value": "[(33,2)-(38,0)]" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(43,2)-(43,18)]" + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(44,4)-(48,0)]" + }, + { + "@id": "#/declarations/ConditionNoMatch/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch", + "sourcemaps:value": "[(43,2)-(48,0)]" + }, + { + "@id": "#/declarations/OrMember2/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/OrMember2", + "sourcemaps:value": "[(53,2)-(57,0)]" + }, + { + "@id": "#/declarations/OrMember2/source-map/lexical/element_0", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(53,2)-(53,11)]" + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/InnerConditionMatch/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(62,2)-(62,21)]" + }, + { + "@id": "#/declarations/InnerConditionMatch/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(63,4)-(67,0)]" + }, + { + "@id": "#/declarations/InnerConditionMatch/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch", + "sourcemaps:value": "[(62,2)-(67,0)]" + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(18,2)-(18,12)]" + }, + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(19,4)-(24,0)]" + }, + { + "@id": "#/declarations/AndMember1/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1", + "sourcemaps:value": "[(18,2)-(24,0)]" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember1/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(72,2)-(72,16)]" + }, + { + "@id": "#/declarations/InnerOrMember1/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(73,4)-(78,0)]" + }, + { + "@id": "#/declarations/InnerOrMember1/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1", + "sourcemaps:value": "[(72,2)-(78,0)]" + }, + { + "@id": "#/declarations/OrMember1/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/OrMember1", + "sourcemaps:value": "[(48,2)-(53,0)]" + }, + { + "@id": "#/declarations/OrMember1/source-map/lexical/element_0", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(48,2)-(48,11)]" + }, + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/InnerOrMember2/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(78,2)-(78,16)]" + }, + { + "@id": "#/declarations/InnerOrMember2/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(79,4)-(81,22)]" + }, + { + "@id": "#/declarations/InnerOrMember2/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2", + "sourcemaps:value": "[(78,2)-(81,22)]" + }, + { + "@id": "#/declarations/AndMember2/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember2", + "sourcemaps:value": "[(24,2)-(29,0)]" + }, + { + "@id": "#/declarations/AndMember2/source-map/lexical/element_0", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(24,2)-(24,12)]" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(38,2)-(38,16)]" + }, + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(39,4)-(43,0)]" + }, + { + "@id": "#/declarations/ConditionMatch/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch", + "sourcemaps:value": "[(38,2)-(43,0)]" + }, + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_3", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(60,8)-(61,0)]" + }, + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_1", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(59,6)-(59,8)]" + }, + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_0", + "sourcemaps:element": "shacl:in", + "sourcemaps:value": "[(61,8)-(62,0)]" + }, + { + "@id": "#/declarations/InnerCondition/property/c2/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerCondition/property/c2", + "sourcemaps:value": "[(59,9)-(62,0)]" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(69,6)-(69,8)]" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_1", + "sourcemaps:element": "shacl:path", + "sourcemaps:value": "[(71,8)-(72,0)]" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(70,8)-(71,0)]" + }, + { + "@id": "#/declarations/InnerConditionNoMatch/property/c2/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch/property/c2", + "sourcemaps:value": "[(69,9)-(72,0)]" + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_3", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(36,8)-(37,0)]" + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_1", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(35,6)-(35,8)]" + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_0", + "sourcemaps:element": "shacl:in", + "sourcemaps:value": "[(37,8)-(38,0)]" + }, + { + "@id": "#/declarations/Condition/property/c1/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/Condition/property/c1", + "sourcemaps:value": "[(35,9)-(38,0)]" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(45,6)-(45,8)]" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_1", + "sourcemaps:element": "shacl:path", + "sourcemaps:value": "[(47,8)-(48,0)]" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(46,8)-(47,0)]" + }, + { + "@id": "#/declarations/ConditionNoMatch/property/c1/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch/property/c1", + "sourcemaps:value": "[(45,9)-(48,0)]" + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(64,6)-(64,8)]" + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_1", + "sourcemaps:element": "shacl:path", + "sourcemaps:value": "[(66,8)-(67,0)]" + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(65,8)-(66,0)]" + }, + { + "@id": "#/declarations/InnerConditionMatch/property/c2/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch/property/c2", + "sourcemaps:value": "[(64,9)-(67,0)]" + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(22,6)-(22,10)]" + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(23,8)-(24,0)]" + }, + { + "@id": "#/declarations/AndMember1/property/am12/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am12", + "sourcemaps:value": "[(22,11)-(24,0)]" + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(20,6)-(20,10)]" + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(21,8)-(22,0)]" + }, + { + "@id": "#/declarations/AndMember1/property/am11/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am11", + "sourcemaps:value": "[(20,11)-(22,0)]" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(76,6)-(76,10)]" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(77,8)-(78,0)]" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om12/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1/property/om12", + "sourcemaps:value": "[(76,11)-(78,0)]" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(74,6)-(74,10)]" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(75,8)-(76,0)]" + }, + { + "@id": "#/declarations/InnerOrMember1/property/om11/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1/property/om11", + "sourcemaps:value": "[(74,11)-(76,0)]" + }, + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(80,6)-(80,10)]" + }, + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(81,8)-(81,22)]" + }, + { + "@id": "#/declarations/InnerOrMember2/property/om21/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2/property/om21", + "sourcemaps:value": "[(80,11)-(81,22)]" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(40,6)-(40,8)]" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_1", + "sourcemaps:element": "shacl:path", + "sourcemaps:value": "[(42,8)-(43,0)]" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(41,8)-(42,0)]" + }, + { + "@id": "#/declarations/ConditionMatch/property/c1/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch/property/c1", + "sourcemaps:value": "[(40,9)-(43,0)]" + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#", + "owl": "http://www.w3.org/2002/07/owl#", + "xsd": "http://www.w3.org/2001/XMLSchema#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.resolved.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.resolved.expanded.jsonld new file mode 100644 index 00000000..445eb23c --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.resolved.expanded.jsonld @@ -0,0 +1,1703 @@ +[ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml", +"@type": [ +"http://a.ml/vocabularies/meta#Dialect", +"http://a.ml/vocabularies/document#Document", +"http://a.ml/vocabularies/document#Fragment", +"http://a.ml/vocabularies/document#Module", +"http://a.ml/vocabularies/document#Unit" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Mapping AllOf" +} +], +"http://a.ml/vocabularies/core#version": [ +{ +"@value": "1.0" +} +], +"http://a.ml/vocabularies/meta#extensions": [], +"http://a.ml/vocabularies/meta#externals": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/externals/schema-org", +"@type": [ +"http://www.w3.org/2002/07/owl#Ontology", +"http://a.ml/vocabularies/meta#ExternalVocabulary", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#displayName": [ +{ +"@value": "schema-org" +} +], +"http://a.ml/vocabularies/meta#base": [ +{ +"@value": "https://schema.org/" +} +] +} +], +"http://a.ml/vocabularies/meta#documents": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/documents", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentsModel", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/meta#rootDocument": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/documents/root", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Mapping AllOf 1.0" +} +], +"http://a.ml/vocabularies/meta#encodedNode": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/Root" +} +] +} +] +} +], +"http://a.ml/vocabularies/document#location": [ +{ +"@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml" +} +], +"http://a.ml/vocabularies/document#root": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/document#processingData": [ +{ +"@id": "null/BaseUnitProcessingData", +"@type": [ +"http://a.ml/vocabularies/document#BaseUnitProcessingData" +], +"http://a.ml/vocabularies/document#transformed": [ +{ +"@value": true +} +] +} +], +"http://a.ml/vocabularies/document#declares": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_3", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_3" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1/property/om12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://a.ml/vocabularies/shapes#number" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1/property/om11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "AndMember2" +} +], +"http://a.ml/vocabularies/amf/aml#if": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/Condition" +} +], +"http://a.ml/vocabularies/amf/aml#then": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch" +} +], +"http://a.ml/vocabularies/amf/aml#else": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_6", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_6" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/no-something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch/property/c2", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/no-other-something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c2" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/OrMember2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "OrMember2" +} +], +"http://a.ml/vocabularies/amf/aml#or": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "AndMember1" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_8", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_8" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/no-something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2/property/om21", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om21" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om21" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#boolean" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "ConditionMatch" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "InnerOrMember2" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2/property/om21", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om21" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om21" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#boolean" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_2" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch/property/c2", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/no-other-something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c2" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/Root", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Root" +} +], +"http://a.ml/vocabularies/amf/aml#and": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember3" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_5", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_5" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/no-something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch/property/c2", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/other-something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c2" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/OrMember1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "OrMember1" +} +], +"http://a.ml/vocabularies/amf/aml#if": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerCondition" +} +], +"http://a.ml/vocabularies/amf/aml#then": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch" +} +], +"http://a.ml/vocabularies/amf/aml#else": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "InnerConditionNoMatch" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch/property/c2", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/no-other-something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c2" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/Condition", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Condition" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/Condition/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#c1" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +], +"http://www.w3.org/ns/shacl#in": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/Condition/property/c1/list", +"@type": "http://www.w3.org/2000/01/rdf-schema#Seq", +"http://www.w3.org/2000/01/rdf-schema#_1": [ +{ +"@value": "something", +"@type": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "InnerConditionMatch" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch/property/c2", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/other-something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c2" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "ConditionNoMatch" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/no-something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_4", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_4" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2/property/om21", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om21" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om21" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#boolean" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember3", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "AndMember3" +} +], +"http://a.ml/vocabularies/amf/aml#or": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/OrMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/OrMember2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_7", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_7" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/no-something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1/property/om12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://a.ml/vocabularies/shapes#number" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1/property/om11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "InnerOrMember1" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1/property/om12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://a.ml/vocabularies/shapes#number" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1/property/om11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "om11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_1" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c1" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch/property/c2", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/other-something" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c2" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerCondition", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "InnerCondition" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerCondition/property/c2", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#c2" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "c2" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +], +"http://www.w3.org/ns/shacl#in": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerCondition/property/c2/list", +"@type": "http://www.w3.org/2000/01/rdf-schema#Seq", +"http://www.w3.org/2000/01/rdf-schema#_1": [ +{ +"@value": "other-something", +"@type": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +} +] +} +] +} +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.resolved.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.resolved.flattened.jsonld new file mode 100644 index 00000000..e35a2909 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.resolved.flattened.jsonld @@ -0,0 +1,966 @@ +{ +"@graph": [ +{ +"@id": "null/BaseUnitProcessingData", +"@type": [ +"http://a.ml/vocabularies/document#BaseUnitProcessingData" +], +"http://a.ml/vocabularies/document#transformed": true +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/documents", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentsModel", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/meta#rootDocument": { +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/documents/root" +} +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/externals/schema-org", +"@type": [ +"http://www.w3.org/2002/07/owl#Ontology", +"http://a.ml/vocabularies/meta#ExternalVocabulary", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#displayName": "schema-org", +"http://a.ml/vocabularies/meta#base": "https://schema.org/" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/documents/root", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "Mapping AllOf 1.0", +"http://a.ml/vocabularies/meta#encodedNode": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/Root" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml", +"http://a.ml/vocabularies/document#declares": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_3" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_6" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/OrMember2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_8" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/Root" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_5" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/OrMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/Condition" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_4" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember3" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_7" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerCondition" +} +], +"@type": [ +"http://a.ml/vocabularies/meta#Dialect", +"http://a.ml/vocabularies/document#Document", +"http://a.ml/vocabularies/document#Fragment", +"http://a.ml/vocabularies/document#Module", +"http://a.ml/vocabularies/document#Unit" +], +"http://a.ml/vocabularies/core#name": "Mapping AllOf", +"http://a.ml/vocabularies/core#version": "1.0", +"http://a.ml/vocabularies/meta#extensions": [], +"http://a.ml/vocabularies/meta#externals": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/externals/schema-org" +} +], +"http://a.ml/vocabularies/meta#documents": { +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/documents" +}, +"http://a.ml/vocabularies/document#location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml", +"http://a.ml/vocabularies/document#root": false, +"http://a.ml/vocabularies/document#processingData": { +"@id": "null/BaseUnitProcessingData" +} +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_3", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_3", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am11" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch/property/c1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1/property/om12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1/property/om11" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "AndMember2", +"http://a.ml/vocabularies/amf/aml#if": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/Condition" +} +], +"http://a.ml/vocabularies/amf/aml#then": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch" +} +], +"http://a.ml/vocabularies/amf/aml#else": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_6", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_6", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am11" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch/property/c1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch/property/c2" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/OrMember2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "OrMember2", +"http://a.ml/vocabularies/amf/aml#or": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "AndMember1", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am11" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_8", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_8", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am11" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch/property/c1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2/property/om21" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "ConditionMatch", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch/property/c1" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "InnerOrMember2", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2/property/om21" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_2", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am11" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch/property/c1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch/property/c2" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/Root", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "Root", +"http://a.ml/vocabularies/amf/aml#and": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember3" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_5", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_5", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am11" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch/property/c1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch/property/c2" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/OrMember1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "OrMember1", +"http://a.ml/vocabularies/amf/aml#if": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerCondition" +} +], +"http://a.ml/vocabularies/amf/aml#then": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch" +} +], +"http://a.ml/vocabularies/amf/aml#else": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "InnerConditionNoMatch", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch/property/c2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/Condition", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "Condition", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/Condition/property/c1" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "InnerConditionMatch", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch/property/c2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "ConditionNoMatch", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch/property/c1" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_4", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_4", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am11" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch/property/c1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2/property/om21" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember3", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "AndMember3", +"http://a.ml/vocabularies/amf/aml#or": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/OrMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/OrMember2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_7", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_7", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am11" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch/property/c1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1/property/om12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1/property/om11" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "InnerOrMember1", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1/property/om12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1/property/om11" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml/CombiningMapping_1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_1", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am11" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch/property/c1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch/property/c2" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerCondition", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "InnerCondition", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerCondition/property/c2" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": "am12", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/AndMember1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": "am11", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/something" +} +], +"http://a.ml/vocabularies/core#name": "c1", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1/property/om12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om12" +} +], +"http://a.ml/vocabularies/core#name": "om12", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://a.ml/vocabularies/shapes#number" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember1/property/om11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om11" +} +], +"http://a.ml/vocabularies/core#name": "om11", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/ConditionNoMatch/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/no-something" +} +], +"http://a.ml/vocabularies/core#name": "c1", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionNoMatch/property/c2", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/no-other-something" +} +], +"http://a.ml/vocabularies/core#name": "c2", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerOrMember2/property/om21", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#om21" +} +], +"http://a.ml/vocabularies/core#name": "om21", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#boolean" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerConditionMatch/property/c2", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/other-something" +} +], +"http://a.ml/vocabularies/core#name": "c2", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/Condition/property/c1", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#c1" +} +], +"http://a.ml/vocabularies/core#name": "c1", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +], +"http://www.w3.org/ns/shacl#in": { +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/Condition/property/c1/list" +} +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerCondition/property/c2", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#c2" +} +], +"http://a.ml/vocabularies/core#name": "c2", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +], +"http://www.w3.org/ns/shacl#in": { +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerCondition/property/c2/list" +} +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/Condition/property/c1/list", +"@type": "http://www.w3.org/2000/01/rdf-schema#Seq", +"http://www.w3.org/2000/01/rdf-schema#_1": { +"@value": "something", +"@type": "http://www.w3.org/2001/XMLSchema#string" +} +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml#/declarations/InnerCondition/property/c2/list", +"@type": "http://www.w3.org/2000/01/rdf-schema#Seq", +"http://www.w3.org/2000/01/rdf-schema#_1": { +"@value": "other-something", +"@type": "http://www.w3.org/2001/XMLSchema#string" +} +} +] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.resolved.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.resolved.yaml new file mode 100644 index 00000000..6a9cc852 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.resolved.yaml @@ -0,0 +1,216 @@ +#%Dialect 1.0 +external: + schema-org: https://schema.org/ +documents: + root: + encodes: Root +nodeMappings: + Root: + allOf: + - AndMember1 + - AndMember2 + - AndMember3 + AndMember1: + mapping: + am11: + range: string + am12: + range: string + AndMember2: + conditional: + if: Condition + then: ConditionMatch + else: ConditionNoMatch + AndMember3: + oneOf: + - OrMember1 + - OrMember2 + Condition: + mapping: + c1: + range: string + enum: + - something + ConditionMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.something + ConditionNoMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.no-something + OrMember1: + conditional: + if: InnerCondition + then: InnerConditionMatch + else: InnerConditionNoMatch + OrMember2: + oneOf: + - InnerOrMember1 + - InnerOrMember2 + InnerCondition: + mapping: + c2: + range: string + enum: + - other-something + InnerConditionMatch: + mapping: + c2: + range: string + propertyTerm: schema-org.other-something + InnerConditionNoMatch: + mapping: + c2: + range: string + propertyTerm: schema-org.no-other-something + InnerOrMember1: + mapping: + om11: + range: string + om12: + range: number + InnerOrMember2: + mapping: + om21: + range: boolean + CombiningMapping_3: + components: + - AndMember1 + - ConditionMatch + - InnerOrMember1 + mapping: + am11: + range: string + am12: + range: string + c1: + range: string + propertyTerm: schema-org.something + om11: + range: string + om12: + range: number + additionalProperties: true + CombiningMapping_6: + components: + - AndMember1 + - ConditionNoMatch + - InnerConditionNoMatch + mapping: + am11: + range: string + am12: + range: string + c1: + range: string + propertyTerm: schema-org.no-something + c2: + range: string + propertyTerm: schema-org.no-other-something + additionalProperties: true + CombiningMapping_8: + components: + - AndMember1 + - ConditionNoMatch + - InnerOrMember2 + mapping: + am11: + range: string + am12: + range: string + c1: + range: string + propertyTerm: schema-org.no-something + om21: + range: boolean + additionalProperties: true + CombiningMapping_2: + components: + - AndMember1 + - ConditionMatch + - InnerConditionNoMatch + mapping: + am11: + range: string + am12: + range: string + c1: + range: string + propertyTerm: schema-org.something + c2: + range: string + propertyTerm: schema-org.no-other-something + additionalProperties: true + CombiningMapping_5: + components: + - AndMember1 + - ConditionNoMatch + - InnerConditionMatch + mapping: + am11: + range: string + am12: + range: string + c1: + range: string + propertyTerm: schema-org.no-something + c2: + range: string + propertyTerm: schema-org.other-something + additionalProperties: true + CombiningMapping_4: + components: + - AndMember1 + - ConditionMatch + - InnerOrMember2 + mapping: + am11: + range: string + am12: + range: string + c1: + range: string + propertyTerm: schema-org.something + om21: + range: boolean + additionalProperties: true + CombiningMapping_7: + components: + - AndMember1 + - ConditionNoMatch + - InnerOrMember1 + mapping: + am11: + range: string + am12: + range: string + c1: + range: string + propertyTerm: schema-org.no-something + om11: + range: string + om12: + range: number + additionalProperties: true + CombiningMapping_1: + components: + - AndMember1 + - ConditionMatch + - InnerConditionMatch + mapping: + am11: + range: string + am12: + range: string + c1: + range: string + propertyTerm: schema-org.something + c2: + range: string + propertyTerm: schema-org.other-something + additionalProperties: true +dialect: Mapping AllOf +version: "1.0" diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml new file mode 100644 index 00000000..aebb1fda --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf-nested/dialect.yaml @@ -0,0 +1,81 @@ +#%Dialect 1.0 +dialect: Mapping AllOf +version: 1.0 + +external: + schema-org: https://schema.org/ + +documents: + root: + encodes: Root + +nodeMappings: + Root: + allOf: + - AndMember1 + - AndMember2 + - AndMember3 + AndMember1: + mapping: + am11: + range: string + am12: + range: string + AndMember2: + conditional: + if: Condition + then: ConditionMatch + else: ConditionNoMatch + AndMember3: + oneOf: + - OrMember1 + - OrMember2 + Condition: + mapping: + c1: + range: string + enum: ["something"] + ConditionMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.something + ConditionNoMatch: + mapping: + c1: + range: string + propertyTerm: schema-org.no-something + OrMember1: + conditional: + if: InnerCondition + then: InnerConditionMatch + else: InnerConditionNoMatch + OrMember2: + oneOf: + - InnerOrMember1 + - InnerOrMember2 + InnerCondition: + mapping: + c2: + range: string + enum: [ "other-something" ] + InnerConditionMatch: + mapping: + c2: + range: string + propertyTerm: schema-org.other-something + InnerConditionNoMatch: + mapping: + c2: + range: string + propertyTerm: schema-org.no-other-something + InnerOrMember1: + mapping: + om11: + range: string + om12: + range: number + InnerOrMember2: + mapping: + om21: + range: boolean \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.cycled.jsonld.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.cycled.jsonld.yaml new file mode 100644 index 00000000..0bfd036b --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.cycled.jsonld.yaml @@ -0,0 +1,23 @@ +#%Dialect 1.0 +dialect: Mapping AllOf +version: "1.0" +documents: + root: + encodes: Root +nodeMappings: + Root: + allOf: + - Member1 + - Member2 + Member1: + mapping: + m11: + range: string + m12: + range: string + Member2: + mapping: + m21: + range: string + m22: + range: string diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.cycled.yaml new file mode 100644 index 00000000..0bfd036b --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.cycled.yaml @@ -0,0 +1,23 @@ +#%Dialect 1.0 +dialect: Mapping AllOf +version: "1.0" +documents: + root: + encodes: Root +nodeMappings: + Root: + allOf: + - Member1 + - Member2 + Member1: + mapping: + m11: + range: string + m12: + range: string + Member2: + mapping: + m21: + range: string + m22: + range: string diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.expanded.jsonld new file mode 100644 index 00000000..4923f1e5 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.expanded.jsonld @@ -0,0 +1,691 @@ +[ + { + "@id": "", + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": [ + { + "@value": "Mapping AllOf" + } + ], + "core:version": [ + { + "@value": "1.0" + } + ], + "meta:documents": [ + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": [ + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Mapping AllOf 1.0" + } + ], + "meta:encodedNode": [ + { + "@id": "#/declarations/Root" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml#/documents/root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,7)-(9,0)]" + } + ] + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:encodedNode" + } + ], + "sourcemaps:value": [ + { + "@value": "[(7,4)-(9,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml/documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,0)-(9,0)]" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:rootDocument" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,2)-(9,0)]" + } + ] + } + ] + } + ] + } + ], + "doc:location": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml" + } + ], + "doc:root": [ + { + "@value": true + } + ], + "doc:processingData": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": [ + { + "@value": false + } + ], + "doc:sourceSpec": [ + { + "@value": "AML 1.0" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:version" + } + ], + "sourcemaps:value": [ + { + "@value": "[(3,0)-(5,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,0)-(9,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(25,21)]" + } + ] + } + ] + } + ], + "doc:declares": [ + { + "@id": "#/declarations/Root", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Root" + } + ], + "http://a.ml/vocabularies/amf/aml#and": [ + { + "@id": "#/declarations/Member1" + }, + { + "@id": "#/declarations/Member2" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml#/declarations/Root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(10,2)-(14,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(10,2)-(10,6)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Member1" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Member1/property/m12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m12" + } + ], + "core:name": [ + { + "@value": "m12" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/property/m12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(18,6)-(18,9)]" + } + ] + }, + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(19,8)-(20,0)]" + } + ] + }, + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml#/declarations/Member1/property/m12" + } + ], + "sourcemaps:value": [ + { + "@value": "[(18,10)-(20,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member1/property/m11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m11" + } + ], + "core:name": [ + { + "@value": "m11" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/property/m11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(16,6)-(16,9)]" + } + ] + }, + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(17,8)-(18,0)]" + } + ] + }, + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml#/declarations/Member1/property/m11" + } + ], + "sourcemaps:value": [ + { + "@value": "[(16,10)-(18,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(14,2)-(14,9)]" + } + ] + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(15,4)-(20,0)]" + } + ] + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml#/declarations/Member1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(14,2)-(20,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Member2" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Member2/property/m21", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m21" + } + ], + "core:name": [ + { + "@value": "m21" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/property/m21/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(22,6)-(22,9)]" + } + ] + }, + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(23,8)-(24,0)]" + } + ] + }, + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml#/declarations/Member2/property/m21" + } + ], + "sourcemaps:value": [ + { + "@value": "[(22,10)-(24,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member2/property/m22", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m22" + } + ], + "core:name": [ + { + "@value": "m22" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/property/m22/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(24,6)-(24,9)]" + } + ] + }, + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(25,8)-(25,21)]" + } + ] + }, + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml#/declarations/Member2/property/m22" + } + ], + "sourcemaps:value": [ + { + "@value": "[(24,10)-(25,21)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(20,2)-(20,9)]" + } + ] + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(21,4)-(25,21)]" + } + ] + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml#/declarations/Member2" + } + ], + "sourcemaps:value": [ + { + "@value": "[(20,2)-(25,21)]" + } + ] + } + ] + } + ] + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#" + } + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.flattened.jsonld new file mode 100644 index 00000000..3c1ddb3c --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.flattened.jsonld @@ -0,0 +1,551 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + }, + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map" + } + ] + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "Mapping AllOf 1.0", + "meta:encodedNode": [ + { + "@id": "#/declarations/Root" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map" + } + ] + }, + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1" + }, + { + "@id": "/documents#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml/documents", + "sourcemaps:value": "[(6,0)-(9,0)]" + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": "meta:rootDocument", + "sourcemaps:value": "[(6,2)-(9,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml#/documents/root", + "sourcemaps:value": "[(6,7)-(9,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": "meta:encodedNode", + "sourcemaps:value": "[(7,4)-(9,0)]" + }, + { + "@id": "", + "doc:declares": [ + { + "@id": "#/declarations/Root" + }, + { + "@id": "#/declarations/Member1" + }, + { + "@id": "#/declarations/Member2" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "Mapping AllOf", + "core:version": "1.0", + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + }, + "sourcemaps:sources": [ + { + "@id": "#/source-map" + } + ] + }, + { + "@id": "#/declarations/Root", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Root", + "http://a.ml/vocabularies/amf/aml#and": [ + { + "@id": "#/declarations/Member1" + }, + { + "@id": "#/declarations/Member2" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/source-map" + } + ] + }, + { + "@id": "#/declarations/Member1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Member1", + "shacl:property": [ + { + "@id": "#/declarations/Member1/property/m12" + }, + { + "@id": "#/declarations/Member1/property/m11" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/source-map" + } + ] + }, + { + "@id": "#/declarations/Member2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Member2", + "shacl:property": [ + { + "@id": "#/declarations/Member2/property/m21" + }, + { + "@id": "#/declarations/Member2/property/m22" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/source-map" + } + ] + }, + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_3" + }, + { + "@id": "#/source-map/lexical/element_1" + }, + { + "@id": "#/source-map/lexical/element_0" + }, + { + "@id": "#/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/Root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/declarations/Member1/property/m12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m12" + } + ], + "core:name": "m12", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/property/m12/source-map" + } + ] + }, + { + "@id": "#/declarations/Member1/property/m11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m11" + } + ], + "core:name": "m11", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/property/m11/source-map" + } + ] + }, + { + "@id": "#/declarations/Member1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member2/property/m21", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m21" + } + ], + "core:name": "m21", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/property/m21/source-map" + } + ] + }, + { + "@id": "#/declarations/Member2/property/m22", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m22" + } + ], + "core:name": "m22", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/property/m22/source-map" + } + ] + }, + { + "@id": "#/declarations/Member2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": "core:version", + "sourcemaps:value": "[(3,0)-(5,0)]" + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(2,0)-(3,0)]" + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": "meta:documents", + "sourcemaps:value": "[(5,0)-(9,0)]" + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml", + "sourcemaps:value": "[(2,0)-(25,21)]" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml#/declarations/Root", + "sourcemaps:value": "[(10,2)-(14,0)]" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(10,2)-(10,6)]" + }, + { + "@id": "#/declarations/Member1/property/m12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member1/property/m11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(14,2)-(14,9)]" + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(15,4)-(20,0)]" + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml#/declarations/Member1", + "sourcemaps:value": "[(14,2)-(20,0)]" + }, + { + "@id": "#/declarations/Member2/property/m21/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member2/property/m22/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(20,2)-(20,9)]" + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(21,4)-(25,21)]" + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml#/declarations/Member2", + "sourcemaps:value": "[(20,2)-(25,21)]" + }, + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(18,6)-(18,9)]" + }, + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(19,8)-(20,0)]" + }, + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml#/declarations/Member1/property/m12", + "sourcemaps:value": "[(18,10)-(20,0)]" + }, + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(16,6)-(16,9)]" + }, + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(17,8)-(18,0)]" + }, + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml#/declarations/Member1/property/m11", + "sourcemaps:value": "[(16,10)-(18,0)]" + }, + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(22,6)-(22,9)]" + }, + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(23,8)-(24,0)]" + }, + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml#/declarations/Member2/property/m21", + "sourcemaps:value": "[(22,10)-(24,0)]" + }, + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(24,6)-(24,9)]" + }, + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(25,8)-(25,21)]" + }, + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml#/declarations/Member2/property/m22", + "sourcemaps:value": "[(24,10)-(25,21)]" + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml new file mode 100644 index 00000000..ee197649 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/allOf/dialect.yaml @@ -0,0 +1,25 @@ +#%Dialect 1.0 +dialect: Mapping AllOf +version: 1.0 + +documents: + root: + encodes: Root + +nodeMappings: + Root: + allOf: + - Member1 + - Member2 + Member1: + mapping: + m11: + range: string + m12: + range: string + Member2: + mapping: + m21: + range: string + m22: + range: string \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.cycled.yaml new file mode 100644 index 00000000..30208363 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.cycled.yaml @@ -0,0 +1,33 @@ +#%Dialect 1.0 +dialect: Annotation mappings +version: "1.0" +external: + aml: http://a.ml/vocab# +documents: + root: + encodes: PersonNodeMapping +annotationMappings: + MaintainerAnnotationMapping: + domain: + - aml.API + - aml.WebAPI + propertyTerm: aml.maintainer + range: PersonNodeMapping + ContributorAnnotationMapping: + domain: aml.API + propertyTerm: github.contributor + range: PersonNodeMapping +nodeMappings: + PersonNodeMapping: + mapping: + name: + range: string + surname: + range: string + email: + range: string +extensions: + maintainer: MaintainerAnnotationMapping + contributor: ContributorAnnotationMapping +uses: + github: github.vocabulary.yaml diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.expanded.jsonld new file mode 100644 index 00000000..bee8bbbd --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.expanded.jsonld @@ -0,0 +1,1152 @@ +[ + { + "@id": "", + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": [ + { + "@value": "Annotation mappings" + } + ], + "core:version": [ + { + "@value": "1.0" + } + ], + "meta:extensions": [ + { + "@id": "/semantic-extensions/maintainer", + "@type": [ + "meta:ExtensionMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "maintainer" + } + ], + "meta:extensionMappingDefinition": [ + { + "@id": "#/declarations/MaintainerAnnotationMapping" + } + ], + "sourcemaps:sources": [ + { + "@id": "/semantic-extensions/maintainer#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/semantic-extensions/maintainer#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(39,2)-(39,12)]" + } + ] + }, + { + "@id": "/semantic-extensions/maintainer#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:extensionMappingDefinition" + } + ], + "sourcemaps:value": [ + { + "@value": "[(39,2)-(40,0)]" + } + ] + }, + { + "@id": "/semantic-extensions/maintainer#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml/semantic-extensions/maintainer" + } + ], + "sourcemaps:value": [ + { + "@value": "[(39,2)-(40,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "/semantic-extensions/contributor", + "@type": [ + "meta:ExtensionMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "contributor" + } + ], + "meta:extensionMappingDefinition": [ + { + "@id": "#/declarations/ContributorAnnotationMapping" + } + ], + "sourcemaps:sources": [ + { + "@id": "/semantic-extensions/contributor#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/semantic-extensions/contributor#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(40,2)-(40,13)]" + } + ] + }, + { + "@id": "/semantic-extensions/contributor#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:extensionMappingDefinition" + } + ], + "sourcemaps:value": [ + { + "@value": "[(40,2)-(41,0)]" + } + ] + }, + { + "@id": "/semantic-extensions/contributor#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml/semantic-extensions/contributor" + } + ], + "sourcemaps:value": [ + { + "@value": "[(40,2)-(41,0)]" + } + ] + } + ] + } + ] + } + ], + "meta:externals": [ + { + "@id": "/externals/aml", + "@type": [ + "owl:Ontology", + "meta:ExternalVocabulary", + "doc:DomainElement" + ], + "core:displayName": [ + { + "@value": "aml" + } + ], + "meta:base": [ + { + "@value": "http://a.ml/vocab#" + } + ], + "sourcemaps:sources": [ + { + "@id": "/externals/aml#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/externals/aml#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:displayName" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,2)-(9,5)]" + } + ] + }, + { + "@id": "/externals/aml#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:base" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,7)-(9,25)]" + } + ] + }, + { + "@id": "/externals/aml#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml/externals/aml" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,2)-(11,0)]" + } + ] + } + ] + } + ] + } + ], + "meta:documents": [ + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": [ + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Annotation mappings 1.0" + } + ], + "meta:encodedNode": [ + { + "@id": "#/declarations/PersonNodeMapping" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml#/documents/root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(12,7)-(15,0)]" + } + ] + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:encodedNode" + } + ], + "sourcemaps:value": [ + { + "@value": "[(13,4)-(15,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml/documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(12,0)-(15,0)]" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:rootDocument" + } + ], + "sourcemaps:value": [ + { + "@value": "[(12,2)-(15,0)]" + } + ] + } + ] + } + ] + } + ], + "doc:location": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml" + } + ], + "doc:root": [ + { + "@value": true + } + ], + "doc:processingData": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": [ + { + "@value": false + } + ], + "doc:sourceSpec": [ + { + "@value": "AML 1.0" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:virtual-element": [ + { + "@id": "#/source-map/virtual-element/element_0", + "sourcemaps:element": [ + { + "@value": "meta:extensions" + } + ], + "sourcemaps:value": [ + { + "@value": "true" + } + ] + } + ], + "sourcemaps:aliases-array": [ + { + "@id": "#/source-map/aliases-array/element_0", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml" + } + ], + "sourcemaps:value": [ + { + "@value": "github->http://github.org/vocabulary#::http://github.org/vocabulary#::github.vocabulary.yaml" + } + ] + } + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_5", + "sourcemaps:element": [ + { + "@value": "meta:externals" + } + ], + "sourcemaps:value": [ + { + "@value": "[(8,0)-(11,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(41,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "meta:extensions" + } + ], + "sourcemaps:value": [ + { + "@value": "[(38,0)-(41,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(11,0)-(15,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_4", + "sourcemaps:element": [ + { + "@value": "core:version" + } + ], + "sourcemaps:value": [ + { + "@value": "[(3,0)-(5,0)]" + } + ] + } + ] + } + ], + "doc:references": [ + { + "@id": "./github.vocabulary.yaml", + "@type": [ + "meta:Vocabulary", + "owl:Ontology", + "doc:Unit" + ], + "core:name": [ + { + "@value": "GitHub" + } + ], + "doc:declares": [ + { + "@id": "http://github.org/vocabulary#contributor", + "@type": [ + "owl:DatatypeProperty", + "meta:Property", + "doc:DomainElement" + ], + "core:displayName": [ + { + "@value": "Contributor" + } + ], + "core:description": [ + { + "@value": "Contributor for a github repository" + } + ], + "rdfs:range": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "http://github.org/vocabulary#contributor/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "http://github.org/vocabulary#contributor/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "http://github.org/vocabulary#contributor" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,2)-(9,17)]" + } + ] + }, + { + "@id": "http://github.org/vocabulary#contributor/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "rdfs:range" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,4)-(9,17)]" + } + ] + } + ] + } + ] + } + ], + "meta:base": [ + { + "@value": "http://github.org/vocabulary#" + } + ], + "doc:location": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/github.vocabulary.yaml" + } + ], + "doc:root": [ + { + "@value": false + } + ], + "doc:processingData": [ + { + "@id": "./github.vocabulary.yaml#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": [ + { + "@value": false + } + ], + "doc:sourceSpec": [ + { + "@value": "AML 1.0" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "./github.vocabulary.yaml#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:virtual-element": [ + { + "@id": "./github.vocabulary.yaml#/source-map/virtual-element/element_0", + "sourcemaps:element": [ + { + "@value": "doc:declares" + } + ], + "sourcemaps:value": [ + { + "@value": "true" + } + ] + } + ], + "sourcemaps:lexical": [ + { + "@id": "./github.vocabulary.yaml#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + }, + { + "@id": "./github.vocabulary.yaml#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:base" + } + ], + "sourcemaps:value": [ + { + "@value": "[(3,0)-(5,0)]" + } + ] + }, + { + "@id": "./github.vocabulary.yaml#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/github.vocabulary.yaml" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(9,17)]" + } + ] + } + ] + } + ] + } + ], + "doc:declares": [ + { + "@id": "#/declarations/PersonNodeMapping", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "PersonNodeMapping" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/PersonNodeMapping/property/surname", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#surname" + } + ], + "core:name": [ + { + "@value": "surname" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/PersonNodeMapping/property/surname/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/PersonNodeMapping/property/surname/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(33,6)-(33,13)]" + } + ] + }, + { + "@id": "#/declarations/PersonNodeMapping/property/surname/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(34,8)-(35,0)]" + } + ] + }, + { + "@id": "#/declarations/PersonNodeMapping/property/surname/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml#/declarations/PersonNodeMapping/property/surname" + } + ], + "sourcemaps:value": [ + { + "@value": "[(33,14)-(35,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/PersonNodeMapping/property/name", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#name" + } + ], + "core:name": [ + { + "@value": "name" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/PersonNodeMapping/property/name/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/PersonNodeMapping/property/name/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(31,6)-(31,10)]" + } + ] + }, + { + "@id": "#/declarations/PersonNodeMapping/property/name/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(32,8)-(33,0)]" + } + ] + }, + { + "@id": "#/declarations/PersonNodeMapping/property/name/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml#/declarations/PersonNodeMapping/property/name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(31,11)-(33,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/PersonNodeMapping/property/email", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#email" + } + ], + "core:name": [ + { + "@value": "email" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/PersonNodeMapping/property/email/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/PersonNodeMapping/property/email/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(35,6)-(35,11)]" + } + ] + }, + { + "@id": "#/declarations/PersonNodeMapping/property/email/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(36,8)-(38,0)]" + } + ] + }, + { + "@id": "#/declarations/PersonNodeMapping/property/email/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml#/declarations/PersonNodeMapping/property/email" + } + ], + "sourcemaps:value": [ + { + "@value": "[(35,12)-(38,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/PersonNodeMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/PersonNodeMapping/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(29,2)-(29,19)]" + } + ] + }, + { + "@id": "#/declarations/PersonNodeMapping/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(30,4)-(38,0)]" + } + ] + }, + { + "@id": "#/declarations/PersonNodeMapping/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml#/declarations/PersonNodeMapping" + } + ], + "sourcemaps:value": [ + { + "@value": "[(29,2)-(38,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/MaintainerAnnotationMapping", + "@type": [ + "meta:NodeAnnotationMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocab#maintainer" + } + ], + "core:name": [ + { + "@value": "MaintainerAnnotationMapping" + } + ], + "shacl:node": [ + { + "@id": "#/declarations/MaintainerAnnotationMapping/list", + "@type": "rdfs:Seq", + "rdfs:_1": [ + { + "@id": "#/declarations/PersonNodeMapping" + } + ] + } + ], + "http://a.ml/vocabularies/amf/aml#domain": [ + { + "@id": "http://a.ml/vocab#API" + }, + { + "@id": "http://a.ml/vocab#WebAPI" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/MaintainerAnnotationMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/MaintainerAnnotationMapping/source-map/lexical/element_4", + "sourcemaps:element": [ + { + "@value": "shacl:node" + } + ], + "sourcemaps:value": [ + { + "@value": "[(21,4)-(23,0)]" + } + ] + }, + { + "@id": "#/declarations/MaintainerAnnotationMapping/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml#/declarations/MaintainerAnnotationMapping" + } + ], + "sourcemaps:value": [ + { + "@value": "[(16,2)-(23,0)]" + } + ] + }, + { + "@id": "#/declarations/MaintainerAnnotationMapping/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "http://a.ml/vocabularies/amf/aml#domain" + } + ], + "sourcemaps:value": [ + { + "@value": "[(17,4)-(20,0)]" + } + ] + }, + { + "@id": "#/declarations/MaintainerAnnotationMapping/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(16,2)-(16,29)]" + } + ] + }, + { + "@id": "#/declarations/MaintainerAnnotationMapping/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "shacl:path" + } + ], + "sourcemaps:value": [ + { + "@value": "[(20,4)-(21,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/ContributorAnnotationMapping", + "@type": [ + "meta:NodeAnnotationMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://github.org/vocabulary#contributor" + } + ], + "core:name": [ + { + "@value": "ContributorAnnotationMapping" + } + ], + "shacl:node": [ + { + "@id": "#/declarations/ContributorAnnotationMapping/list", + "@type": "rdfs:Seq", + "rdfs:_1": [ + { + "@id": "#/declarations/PersonNodeMapping" + } + ] + } + ], + "http://a.ml/vocabularies/amf/aml#domain": [ + { + "@id": "http://a.ml/vocab#API" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ContributorAnnotationMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ContributorAnnotationMapping/source-map/lexical/element_4", + "sourcemaps:element": [ + { + "@value": "shacl:node" + } + ], + "sourcemaps:value": [ + { + "@value": "[(26,4)-(28,0)]" + } + ] + }, + { + "@id": "#/declarations/ContributorAnnotationMapping/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml#/declarations/ContributorAnnotationMapping" + } + ], + "sourcemaps:value": [ + { + "@value": "[(23,2)-(28,0)]" + } + ] + }, + { + "@id": "#/declarations/ContributorAnnotationMapping/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "http://a.ml/vocabularies/amf/aml#domain" + } + ], + "sourcemaps:value": [ + { + "@value": "[(24,4)-(25,0)]" + } + ] + }, + { + "@id": "#/declarations/ContributorAnnotationMapping/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(23,2)-(23,30)]" + } + ] + }, + { + "@id": "#/declarations/ContributorAnnotationMapping/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "shacl:path" + } + ], + "sourcemaps:value": [ + { + "@value": "[(25,4)-(26,0)]" + } + ] + } + ] + } + ] + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "owl": "http://www.w3.org/2002/07/owl#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#" + } + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.flattened.jsonld new file mode 100644 index 00000000..717adc35 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.flattened.jsonld @@ -0,0 +1,886 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/externals/aml", + "@type": [ + "owl:Ontology", + "meta:ExternalVocabulary", + "doc:DomainElement" + ], + "core:displayName": "aml", + "meta:base": "http://a.ml/vocab#", + "sourcemaps:sources": [ + { + "@id": "/externals/aml#/source-map" + } + ] + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + }, + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map" + } + ] + }, + { + "@id": "/semantic-extensions/maintainer", + "@type": [ + "meta:ExtensionMapping", + "doc:DomainElement" + ], + "core:name": "maintainer", + "meta:extensionMappingDefinition": [ + { + "@id": "#/declarations/MaintainerAnnotationMapping" + } + ], + "sourcemaps:sources": [ + { + "@id": "/semantic-extensions/maintainer#/source-map" + } + ] + }, + { + "@id": "/semantic-extensions/contributor", + "@type": [ + "meta:ExtensionMapping", + "doc:DomainElement" + ], + "core:name": "contributor", + "meta:extensionMappingDefinition": [ + { + "@id": "#/declarations/ContributorAnnotationMapping" + } + ], + "sourcemaps:sources": [ + { + "@id": "/semantic-extensions/contributor#/source-map" + } + ] + }, + { + "@id": "/externals/aml#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/externals/aml#/source-map/lexical/element_2" + }, + { + "@id": "/externals/aml#/source-map/lexical/element_0" + }, + { + "@id": "/externals/aml#/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "Annotation mappings 1.0", + "meta:encodedNode": [ + { + "@id": "#/declarations/PersonNodeMapping" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map" + } + ] + }, + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1" + }, + { + "@id": "/documents#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/semantic-extensions/maintainer#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/semantic-extensions/maintainer#/source-map/lexical/element_2" + }, + { + "@id": "/semantic-extensions/maintainer#/source-map/lexical/element_0" + }, + { + "@id": "/semantic-extensions/maintainer#/source-map/lexical/element_1" + } + ] + }, + { + "@id": "/semantic-extensions/contributor#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/semantic-extensions/contributor#/source-map/lexical/element_2" + }, + { + "@id": "/semantic-extensions/contributor#/source-map/lexical/element_0" + }, + { + "@id": "/semantic-extensions/contributor#/source-map/lexical/element_1" + } + ] + }, + { + "@id": "/externals/aml#/source-map/lexical/element_2", + "sourcemaps:element": "core:displayName", + "sourcemaps:value": "[(9,2)-(9,5)]" + }, + { + "@id": "/externals/aml#/source-map/lexical/element_0", + "sourcemaps:element": "meta:base", + "sourcemaps:value": "[(9,7)-(9,25)]" + }, + { + "@id": "/externals/aml#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml/externals/aml", + "sourcemaps:value": "[(9,2)-(11,0)]" + }, + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml/documents", + "sourcemaps:value": "[(12,0)-(15,0)]" + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": "meta:rootDocument", + "sourcemaps:value": "[(12,2)-(15,0)]" + }, + { + "@id": "/semantic-extensions/maintainer#/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(39,2)-(39,12)]" + }, + { + "@id": "/semantic-extensions/maintainer#/source-map/lexical/element_0", + "sourcemaps:element": "meta:extensionMappingDefinition", + "sourcemaps:value": "[(39,2)-(40,0)]" + }, + { + "@id": "/semantic-extensions/maintainer#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml/semantic-extensions/maintainer", + "sourcemaps:value": "[(39,2)-(40,0)]" + }, + { + "@id": "/semantic-extensions/contributor#/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(40,2)-(40,13)]" + }, + { + "@id": "/semantic-extensions/contributor#/source-map/lexical/element_0", + "sourcemaps:element": "meta:extensionMappingDefinition", + "sourcemaps:value": "[(40,2)-(41,0)]" + }, + { + "@id": "/semantic-extensions/contributor#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml/semantic-extensions/contributor", + "sourcemaps:value": "[(40,2)-(41,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml#/documents/root", + "sourcemaps:value": "[(12,7)-(15,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": "meta:encodedNode", + "sourcemaps:value": "[(13,4)-(15,0)]" + }, + { + "@id": "", + "doc:references": [ + { + "@id": "./github.vocabulary.yaml" + } + ], + "doc:declares": [ + { + "@id": "#/declarations/PersonNodeMapping" + }, + { + "@id": "#/declarations/MaintainerAnnotationMapping" + }, + { + "@id": "#/declarations/ContributorAnnotationMapping" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "Annotation mappings", + "core:version": "1.0", + "meta:extensions": [ + { + "@id": "/semantic-extensions/maintainer" + }, + { + "@id": "/semantic-extensions/contributor" + } + ], + "meta:externals": [ + { + "@id": "/externals/aml" + } + ], + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + }, + "sourcemaps:sources": [ + { + "@id": "#/source-map" + } + ] + }, + { + "@id": "./github.vocabulary.yaml", + "@type": [ + "meta:Vocabulary", + "owl:Ontology", + "doc:Unit" + ], + "core:name": "GitHub", + "doc:declares": [ + { + "@id": "http://github.org/vocabulary#contributor" + } + ], + "meta:base": "http://github.org/vocabulary#", + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/github.vocabulary.yaml", + "doc:root": false, + "doc:processingData": { + "@id": "./github.vocabulary.yaml#/BaseUnitProcessingData" + }, + "sourcemaps:sources": [ + { + "@id": "./github.vocabulary.yaml#/source-map" + } + ] + }, + { + "@id": "#/declarations/PersonNodeMapping", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "PersonNodeMapping", + "shacl:property": [ + { + "@id": "#/declarations/PersonNodeMapping/property/surname" + }, + { + "@id": "#/declarations/PersonNodeMapping/property/name" + }, + { + "@id": "#/declarations/PersonNodeMapping/property/email" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/PersonNodeMapping/source-map" + } + ] + }, + { + "@id": "#/declarations/MaintainerAnnotationMapping", + "@type": [ + "meta:NodeAnnotationMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocab#maintainer" + } + ], + "core:name": "MaintainerAnnotationMapping", + "shacl:node": { + "@id": "#/declarations/MaintainerAnnotationMapping/list" + }, + "http://a.ml/vocabularies/amf/aml#domain": [ + { + "@id": "http://a.ml/vocab#API" + }, + { + "@id": "http://a.ml/vocab#WebAPI" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/MaintainerAnnotationMapping/source-map" + } + ] + }, + { + "@id": "#/declarations/ContributorAnnotationMapping", + "@type": [ + "meta:NodeAnnotationMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://github.org/vocabulary#contributor" + } + ], + "core:name": "ContributorAnnotationMapping", + "shacl:node": { + "@id": "#/declarations/ContributorAnnotationMapping/list" + }, + "http://a.ml/vocabularies/amf/aml#domain": [ + { + "@id": "http://a.ml/vocab#API" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ContributorAnnotationMapping/source-map" + } + ] + }, + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:virtual-element": [ + { + "@id": "#/source-map/virtual-element/element_0" + } + ], + "sourcemaps:aliases-array": [ + { + "@id": "#/source-map/aliases-array/element_0" + } + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_5" + }, + { + "@id": "#/source-map/lexical/element_3" + }, + { + "@id": "#/source-map/lexical/element_1" + }, + { + "@id": "#/source-map/lexical/element_0" + }, + { + "@id": "#/source-map/lexical/element_2" + }, + { + "@id": "#/source-map/lexical/element_4" + } + ] + }, + { + "@id": "http://github.org/vocabulary#contributor", + "@type": [ + "owl:DatatypeProperty", + "meta:Property", + "doc:DomainElement" + ], + "core:displayName": "Contributor", + "core:description": "Contributor for a github repository", + "rdfs:range": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "http://github.org/vocabulary#contributor/source-map" + } + ] + }, + { + "@id": "./github.vocabulary.yaml#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "./github.vocabulary.yaml#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:virtual-element": [ + { + "@id": "./github.vocabulary.yaml#/source-map/virtual-element/element_0" + } + ], + "sourcemaps:lexical": [ + { + "@id": "./github.vocabulary.yaml#/source-map/lexical/element_2" + }, + { + "@id": "./github.vocabulary.yaml#/source-map/lexical/element_0" + }, + { + "@id": "./github.vocabulary.yaml#/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/PersonNodeMapping/property/surname", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#surname" + } + ], + "core:name": "surname", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/PersonNodeMapping/property/surname/source-map" + } + ] + }, + { + "@id": "#/declarations/PersonNodeMapping/property/name", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#name" + } + ], + "core:name": "name", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/PersonNodeMapping/property/name/source-map" + } + ] + }, + { + "@id": "#/declarations/PersonNodeMapping/property/email", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#email" + } + ], + "core:name": "email", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/PersonNodeMapping/property/email/source-map" + } + ] + }, + { + "@id": "#/declarations/PersonNodeMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/PersonNodeMapping/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/PersonNodeMapping/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/PersonNodeMapping/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/MaintainerAnnotationMapping/list", + "@type": "rdfs:Seq", + "rdfs:_1": { + "@id": "#/declarations/PersonNodeMapping" + } + }, + { + "@id": "#/declarations/MaintainerAnnotationMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/MaintainerAnnotationMapping/source-map/lexical/element_4" + }, + { + "@id": "#/declarations/MaintainerAnnotationMapping/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/MaintainerAnnotationMapping/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/MaintainerAnnotationMapping/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/MaintainerAnnotationMapping/source-map/lexical/element_3" + } + ] + }, + { + "@id": "#/declarations/ContributorAnnotationMapping/list", + "@type": "rdfs:Seq", + "rdfs:_1": { + "@id": "#/declarations/PersonNodeMapping" + } + }, + { + "@id": "#/declarations/ContributorAnnotationMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ContributorAnnotationMapping/source-map/lexical/element_4" + }, + { + "@id": "#/declarations/ContributorAnnotationMapping/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/ContributorAnnotationMapping/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ContributorAnnotationMapping/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/ContributorAnnotationMapping/source-map/lexical/element_3" + } + ] + }, + { + "@id": "#/source-map/virtual-element/element_0", + "sourcemaps:element": "meta:extensions", + "sourcemaps:value": "true" + }, + { + "@id": "#/source-map/aliases-array/element_0", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml", + "sourcemaps:value": "github->http://github.org/vocabulary#::http://github.org/vocabulary#::github.vocabulary.yaml" + }, + { + "@id": "#/source-map/lexical/element_5", + "sourcemaps:element": "meta:externals", + "sourcemaps:value": "[(8,0)-(11,0)]" + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml", + "sourcemaps:value": "[(2,0)-(41,0)]" + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": "meta:extensions", + "sourcemaps:value": "[(38,0)-(41,0)]" + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": "meta:documents", + "sourcemaps:value": "[(11,0)-(15,0)]" + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(2,0)-(3,0)]" + }, + { + "@id": "#/source-map/lexical/element_4", + "sourcemaps:element": "core:version", + "sourcemaps:value": "[(3,0)-(5,0)]" + }, + { + "@id": "http://github.org/vocabulary#contributor/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "http://github.org/vocabulary#contributor/source-map/lexical/element_1" + }, + { + "@id": "http://github.org/vocabulary#contributor/source-map/lexical/element_0" + } + ] + }, + { + "@id": "./github.vocabulary.yaml#/source-map/virtual-element/element_0", + "sourcemaps:element": "doc:declares", + "sourcemaps:value": "true" + }, + { + "@id": "./github.vocabulary.yaml#/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(2,0)-(3,0)]" + }, + { + "@id": "./github.vocabulary.yaml#/source-map/lexical/element_0", + "sourcemaps:element": "meta:base", + "sourcemaps:value": "[(3,0)-(5,0)]" + }, + { + "@id": "./github.vocabulary.yaml#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/github.vocabulary.yaml", + "sourcemaps:value": "[(2,0)-(9,17)]" + }, + { + "@id": "#/declarations/PersonNodeMapping/property/surname/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/PersonNodeMapping/property/surname/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/PersonNodeMapping/property/surname/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/PersonNodeMapping/property/surname/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/PersonNodeMapping/property/name/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/PersonNodeMapping/property/name/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/PersonNodeMapping/property/name/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/PersonNodeMapping/property/name/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/PersonNodeMapping/property/email/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/PersonNodeMapping/property/email/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/PersonNodeMapping/property/email/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/PersonNodeMapping/property/email/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/PersonNodeMapping/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(29,2)-(29,19)]" + }, + { + "@id": "#/declarations/PersonNodeMapping/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(30,4)-(38,0)]" + }, + { + "@id": "#/declarations/PersonNodeMapping/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml#/declarations/PersonNodeMapping", + "sourcemaps:value": "[(29,2)-(38,0)]" + }, + { + "@id": "#/declarations/MaintainerAnnotationMapping/source-map/lexical/element_4", + "sourcemaps:element": "shacl:node", + "sourcemaps:value": "[(21,4)-(23,0)]" + }, + { + "@id": "#/declarations/MaintainerAnnotationMapping/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml#/declarations/MaintainerAnnotationMapping", + "sourcemaps:value": "[(16,2)-(23,0)]" + }, + { + "@id": "#/declarations/MaintainerAnnotationMapping/source-map/lexical/element_0", + "sourcemaps:element": "http://a.ml/vocabularies/amf/aml#domain", + "sourcemaps:value": "[(17,4)-(20,0)]" + }, + { + "@id": "#/declarations/MaintainerAnnotationMapping/source-map/lexical/element_1", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(16,2)-(16,29)]" + }, + { + "@id": "#/declarations/MaintainerAnnotationMapping/source-map/lexical/element_3", + "sourcemaps:element": "shacl:path", + "sourcemaps:value": "[(20,4)-(21,0)]" + }, + { + "@id": "#/declarations/ContributorAnnotationMapping/source-map/lexical/element_4", + "sourcemaps:element": "shacl:node", + "sourcemaps:value": "[(26,4)-(28,0)]" + }, + { + "@id": "#/declarations/ContributorAnnotationMapping/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml#/declarations/ContributorAnnotationMapping", + "sourcemaps:value": "[(23,2)-(28,0)]" + }, + { + "@id": "#/declarations/ContributorAnnotationMapping/source-map/lexical/element_0", + "sourcemaps:element": "http://a.ml/vocabularies/amf/aml#domain", + "sourcemaps:value": "[(24,4)-(25,0)]" + }, + { + "@id": "#/declarations/ContributorAnnotationMapping/source-map/lexical/element_1", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(23,2)-(23,30)]" + }, + { + "@id": "#/declarations/ContributorAnnotationMapping/source-map/lexical/element_3", + "sourcemaps:element": "shacl:path", + "sourcemaps:value": "[(25,4)-(26,0)]" + }, + { + "@id": "http://github.org/vocabulary#contributor/source-map/lexical/element_1", + "sourcemaps:element": "http://github.org/vocabulary#contributor", + "sourcemaps:value": "[(6,2)-(9,17)]" + }, + { + "@id": "http://github.org/vocabulary#contributor/source-map/lexical/element_0", + "sourcemaps:element": "rdfs:range", + "sourcemaps:value": "[(9,4)-(9,17)]" + }, + { + "@id": "#/declarations/PersonNodeMapping/property/surname/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(33,6)-(33,13)]" + }, + { + "@id": "#/declarations/PersonNodeMapping/property/surname/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(34,8)-(35,0)]" + }, + { + "@id": "#/declarations/PersonNodeMapping/property/surname/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml#/declarations/PersonNodeMapping/property/surname", + "sourcemaps:value": "[(33,14)-(35,0)]" + }, + { + "@id": "#/declarations/PersonNodeMapping/property/name/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(31,6)-(31,10)]" + }, + { + "@id": "#/declarations/PersonNodeMapping/property/name/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(32,8)-(33,0)]" + }, + { + "@id": "#/declarations/PersonNodeMapping/property/name/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml#/declarations/PersonNodeMapping/property/name", + "sourcemaps:value": "[(31,11)-(33,0)]" + }, + { + "@id": "#/declarations/PersonNodeMapping/property/email/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(35,6)-(35,11)]" + }, + { + "@id": "#/declarations/PersonNodeMapping/property/email/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(36,8)-(38,0)]" + }, + { + "@id": "#/declarations/PersonNodeMapping/property/email/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml#/declarations/PersonNodeMapping/property/email", + "sourcemaps:value": "[(35,12)-(38,0)]" + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#", + "owl": "http://www.w3.org/2002/07/owl#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml new file mode 100644 index 00000000..4970c8dd --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/dialect.yaml @@ -0,0 +1,40 @@ +#%Dialect 1.0 +dialect: Annotation mappings +version: 1.0 + +uses: + github: github.vocabulary.yaml + +external: + aml: http://a.ml/vocab# + +documents: + root: + encodes: PersonNodeMapping + +annotationMappings: + MaintainerAnnotationMapping: + domain: + - aml.API + - aml.WebAPI + propertyTerm: aml.maintainer + range: PersonNodeMapping + + ContributorAnnotationMapping: + domain: aml.API + propertyTerm: github.contributor + range: PersonNodeMapping + +nodeMappings: + PersonNodeMapping: + mapping: + name: + range: string + surname: + range: string + email: + range: string + +extensions: + maintainer: MaintainerAnnotationMapping + contributor: ContributorAnnotationMapping diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/github.vocabulary.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/github.vocabulary.yaml new file mode 100644 index 00000000..76d8ec1f --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mapping-with-multiple-domains/github.vocabulary.yaml @@ -0,0 +1,9 @@ +#%Vocabulary 1.0 +vocabulary: GitHub +base: http://github.org/vocabulary# + +propertyTerms: + contributor: + displayName: Contributor + description: Contributor for a github repository + range: string \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.expanded.jsonld index 47e474e0..61ec2b79 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.expanded.jsonld @@ -42,6 +42,19 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/inexistent#/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/core#name" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(9,2)-(9,12)]" + } + ] + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/inexistent#/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ @@ -54,6 +67,67 @@ "@value": "[(9,2)-(10,0)]" } ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/inexistent#/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/inexistent" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(9,2)-(10,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/invalid", + "@type": [ + "http://a.ml/vocabularies/meta#ExtensionMapping", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "invalid" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/invalid#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/invalid#/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/invalid" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(10,2)-(13,19)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/invalid#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/core#name" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(10,2)-(10,9)]" + } + ] } ] } @@ -94,6 +168,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/meta#extensions" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml#/source-map/lexical/element_3", @@ -149,6 +238,56 @@ } ] } + ], + "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml#/declarations/InvalidAnnotationMapping", + "@type": [ + "http://a.ml/vocabularies/meta#NodeAnnotationMapping", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "InvalidAnnotationMapping" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml#/declarations/InvalidAnnotationMapping/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml#/declarations/InvalidAnnotationMapping/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml#/declarations/InvalidAnnotationMapping" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(6,2)-(8,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml#/declarations/InvalidAnnotationMapping/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/core#name" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(6,2)-(6,26)]" + } + ] + } + ] + } + ] + } ] } ] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.flattened.jsonld index 0054fe29..17c1c15f 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.flattened.jsonld @@ -26,24 +26,82 @@ } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/invalid", + "@type": [ + "http://a.ml/vocabularies/meta#ExtensionMapping", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": "invalid", + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/invalid#/source-map" + } + ] + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/inexistent#/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/inexistent#/source-map/lexical/element_2" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/inexistent#/source-map/lexical/element_0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/inexistent#/source-map/lexical/element_1" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/invalid#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/invalid#/source-map/lexical/element_1" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/invalid#/source-map/lexical/element_0" } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/inexistent#/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", + "http://a.ml/vocabularies/document-source-maps#value": "[(9,2)-(9,12)]" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/inexistent#/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#extensionMappingDefinition", "http://a.ml/vocabularies/document-source-maps#value": "[(9,2)-(10,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/inexistent#/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/inexistent", + "http://a.ml/vocabularies/document-source-maps#value": "[(9,2)-(10,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/invalid#/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/invalid", + "http://a.ml/vocabularies/document-source-maps#value": "[(10,2)-(13,19)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/invalid#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", + "http://a.ml/vocabularies/document-source-maps#value": "[(10,2)-(10,9)]" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml", + "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml#/declarations/InvalidAnnotationMapping" + } + ], "@type": [ "http://a.ml/vocabularies/meta#Dialect", "http://a.ml/vocabularies/document#Document", @@ -56,6 +114,9 @@ "http://a.ml/vocabularies/meta#extensions": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/inexistent" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml/semantic-extensions/invalid" } ], "http://a.ml/vocabularies/document#location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml", @@ -69,11 +130,29 @@ } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml#/declarations/InvalidAnnotationMapping", + "@type": [ + "http://a.ml/vocabularies/meta#NodeAnnotationMapping", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": "InvalidAnnotationMapping", + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml#/declarations/InvalidAnnotationMapping/source-map" + } + ] + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml#/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml#/source-map/lexical/element_3" @@ -89,6 +168,25 @@ } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml#/declarations/InvalidAnnotationMapping/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml#/declarations/InvalidAnnotationMapping/source-map/lexical/element_1" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml#/declarations/InvalidAnnotationMapping/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#extensions", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml#/source-map/lexical/element_3", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#version", @@ -108,6 +206,16 @@ "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml#/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(13,19)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml#/declarations/InvalidAnnotationMapping/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml#/declarations/InvalidAnnotationMapping", + "http://a.ml/vocabularies/document-source-maps#value": "[(6,2)-(8,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-inexistent-ref/dialect.yaml#/declarations/InvalidAnnotationMapping/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", + "http://a.ml/vocabularies/document-source-maps#value": "[(6,2)-(6,26)]" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.expanded.jsonld index 167a4fea..3daf92e0 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.expanded.jsonld @@ -42,6 +42,19 @@ "sourcemaps:SourceMap" ], "sourcemaps:lexical": [ + { + "@id": "/semantic-extensions/maintainer#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(78,2)-(78,12)]" + } + ] + }, { "@id": "/semantic-extensions/maintainer#/source-map/lexical/element_0", "sourcemaps:element": [ @@ -54,6 +67,19 @@ "@value": "[(78,2)-(79,0)]" } ] + }, + { + "@id": "/semantic-extensions/maintainer#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.yaml/semantic-extensions/maintainer" + } + ], + "sourcemaps:value": [ + { + "@value": "[(78,2)-(79,0)]" + } + ] } ] } @@ -82,6 +108,19 @@ "sourcemaps:SourceMap" ], "sourcemaps:lexical": [ + { + "@id": "/semantic-extensions/rateLimiting#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(79,2)-(79,14)]" + } + ] + }, { "@id": "/semantic-extensions/rateLimiting#/source-map/lexical/element_0", "sourcemaps:element": [ @@ -94,6 +133,19 @@ "@value": "[(79,2)-(80,0)]" } ] + }, + { + "@id": "/semantic-extensions/rateLimiting#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.yaml/semantic-extensions/rateLimiting" + } + ], + "sourcemaps:value": [ + { + "@value": "[(79,2)-(80,0)]" + } + ] } ] } @@ -122,6 +174,19 @@ "sourcemaps:SourceMap" ], "sourcemaps:lexical": [ + { + "@id": "/semantic-extensions/owner#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(80,2)-(80,7)]" + } + ] + }, { "@id": "/semantic-extensions/owner#/source-map/lexical/element_0", "sourcemaps:element": [ @@ -134,6 +199,19 @@ "@value": "[(80,2)-(81,0)]" } ] + }, + { + "@id": "/semantic-extensions/owner#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.yaml/semantic-extensions/owner" + } + ], + "sourcemaps:value": [ + { + "@value": "[(80,2)-(81,0)]" + } + ] } ] } @@ -162,6 +240,19 @@ "sourcemaps:SourceMap" ], "sourcemaps:lexical": [ + { + "@id": "/semantic-extensions/anypointId#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(81,2)-(81,12)]" + } + ] + }, { "@id": "/semantic-extensions/anypointId#/source-map/lexical/element_0", "sourcemaps:element": [ @@ -174,6 +265,19 @@ "@value": "[(81,2)-(82,0)]" } ] + }, + { + "@id": "/semantic-extensions/anypointId#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.yaml/semantic-extensions/anypointId" + } + ], + "sourcemaps:value": [ + { + "@value": "[(81,2)-(82,0)]" + } + ] } ] } @@ -202,6 +306,19 @@ "sourcemaps:SourceMap" ], "sourcemaps:lexical": [ + { + "@id": "/semantic-extensions/accountType#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(82,2)-(82,13)]" + } + ] + }, { "@id": "/semantic-extensions/accountType#/source-map/lexical/element_0", "sourcemaps:element": [ @@ -214,6 +331,19 @@ "@value": "[(82,2)-(83,0)]" } ] + }, + { + "@id": "/semantic-extensions/accountType#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.yaml/semantic-extensions/accountType" + } + ], + "sourcemaps:value": [ + { + "@value": "[(82,2)-(83,0)]" + } + ] } ] } @@ -242,6 +372,19 @@ "sourcemaps:SourceMap" ], "sourcemaps:lexical": [ + { + "@id": "/semantic-extensions/contactEmail#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(83,2)-(83,14)]" + } + ] + }, { "@id": "/semantic-extensions/contactEmail#/source-map/lexical/element_0", "sourcemaps:element": [ @@ -254,6 +397,19 @@ "@value": "[(83,2)-(84,0)]" } ] + }, + { + "@id": "/semantic-extensions/contactEmail#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.yaml/semantic-extensions/contactEmail" + } + ], + "sourcemaps:value": [ + { + "@value": "[(83,2)-(84,0)]" + } + ] } ] } @@ -282,6 +438,19 @@ "sourcemaps:SourceMap" ], "sourcemaps:lexical": [ + { + "@id": "/semantic-extensions/ldapReferences#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(84,2)-(84,16)]" + } + ] + }, { "@id": "/semantic-extensions/ldapReferences#/source-map/lexical/element_0", "sourcemaps:element": [ @@ -294,6 +463,19 @@ "@value": "[(84,2)-(85,0)]" } ] + }, + { + "@id": "/semantic-extensions/ldapReferences#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.yaml/semantic-extensions/ldapReferences" + } + ], + "sourcemaps:value": [ + { + "@value": "[(84,2)-(85,0)]" + } + ] } ] } @@ -403,6 +585,21 @@ "@type": [ "sourcemaps:SourceMap" ], + "sourcemaps:virtual-element": [ + { + "@id": "#/source-map/virtual-element/element_0", + "sourcemaps:element": [ + { + "@value": "meta:extensions" + } + ], + "sourcemaps:value": [ + { + "@value": "true" + } + ] + } + ], "sourcemaps:lexical": [ { "@id": "#/source-map/lexical/element_4", @@ -1008,7 +1205,7 @@ ], "sourcemaps:value": [ { - "@value": "[(18,0)-(24,0)]" + "@value": "[(17,2)-(24,0)]" } ] }, @@ -1100,7 +1297,7 @@ ], "sourcemaps:value": [ { - "@value": "[(56,0)-(62,0)]" + "@value": "[(55,2)-(62,0)]" } ] }, @@ -1215,7 +1412,7 @@ ], "sourcemaps:value": [ { - "@value": "[(50,0)-(55,0)]" + "@value": "[(49,2)-(55,0)]" } ] }, @@ -1397,7 +1594,7 @@ ], "sourcemaps:value": [ { - "@value": "[(10,0)-(17,0)]" + "@value": "[(9,2)-(17,0)]" } ] }, @@ -1546,7 +1743,7 @@ ], "sourcemaps:value": [ { - "@value": "[(25,0)-(33,0)]" + "@value": "[(24,2)-(33,0)]" } ] }, @@ -1652,7 +1849,7 @@ ], "sourcemaps:value": [ { - "@value": "[(40,0)-(49,0)]" + "@value": "[(39,2)-(49,0)]" } ] }, @@ -1772,7 +1969,7 @@ ], "sourcemaps:value": [ { - "@value": "[(34,0)-(39,0)]" + "@value": "[(33,2)-(39,0)]" } ] }, diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.flattened.jsonld index 956f0442..87c864c1 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.flattened.jsonld @@ -172,8 +172,14 @@ "sourcemaps:SourceMap" ], "sourcemaps:lexical": [ + { + "@id": "/semantic-extensions/maintainer#/source-map/lexical/element_2" + }, { "@id": "/semantic-extensions/maintainer#/source-map/lexical/element_0" + }, + { + "@id": "/semantic-extensions/maintainer#/source-map/lexical/element_1" } ] }, @@ -183,8 +189,14 @@ "sourcemaps:SourceMap" ], "sourcemaps:lexical": [ + { + "@id": "/semantic-extensions/rateLimiting#/source-map/lexical/element_2" + }, { "@id": "/semantic-extensions/rateLimiting#/source-map/lexical/element_0" + }, + { + "@id": "/semantic-extensions/rateLimiting#/source-map/lexical/element_1" } ] }, @@ -194,8 +206,14 @@ "sourcemaps:SourceMap" ], "sourcemaps:lexical": [ + { + "@id": "/semantic-extensions/owner#/source-map/lexical/element_2" + }, { "@id": "/semantic-extensions/owner#/source-map/lexical/element_0" + }, + { + "@id": "/semantic-extensions/owner#/source-map/lexical/element_1" } ] }, @@ -205,8 +223,14 @@ "sourcemaps:SourceMap" ], "sourcemaps:lexical": [ + { + "@id": "/semantic-extensions/anypointId#/source-map/lexical/element_2" + }, { "@id": "/semantic-extensions/anypointId#/source-map/lexical/element_0" + }, + { + "@id": "/semantic-extensions/anypointId#/source-map/lexical/element_1" } ] }, @@ -216,8 +240,14 @@ "sourcemaps:SourceMap" ], "sourcemaps:lexical": [ + { + "@id": "/semantic-extensions/accountType#/source-map/lexical/element_2" + }, { "@id": "/semantic-extensions/accountType#/source-map/lexical/element_0" + }, + { + "@id": "/semantic-extensions/accountType#/source-map/lexical/element_1" } ] }, @@ -227,8 +257,14 @@ "sourcemaps:SourceMap" ], "sourcemaps:lexical": [ + { + "@id": "/semantic-extensions/contactEmail#/source-map/lexical/element_2" + }, { "@id": "/semantic-extensions/contactEmail#/source-map/lexical/element_0" + }, + { + "@id": "/semantic-extensions/contactEmail#/source-map/lexical/element_1" } ] }, @@ -238,8 +274,14 @@ "sourcemaps:SourceMap" ], "sourcemaps:lexical": [ + { + "@id": "/semantic-extensions/ldapReferences#/source-map/lexical/element_2" + }, { "@id": "/semantic-extensions/ldapReferences#/source-map/lexical/element_0" + }, + { + "@id": "/semantic-extensions/ldapReferences#/source-map/lexical/element_1" } ] }, @@ -258,41 +300,111 @@ "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.yaml/externals/aml", "sourcemaps:value": "[(6,2)-(8,0)]" }, + { + "@id": "/semantic-extensions/maintainer#/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(78,2)-(78,12)]" + }, { "@id": "/semantic-extensions/maintainer#/source-map/lexical/element_0", "sourcemaps:element": "meta:extensionMappingDefinition", "sourcemaps:value": "[(78,2)-(79,0)]" }, + { + "@id": "/semantic-extensions/maintainer#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.yaml/semantic-extensions/maintainer", + "sourcemaps:value": "[(78,2)-(79,0)]" + }, + { + "@id": "/semantic-extensions/rateLimiting#/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(79,2)-(79,14)]" + }, { "@id": "/semantic-extensions/rateLimiting#/source-map/lexical/element_0", "sourcemaps:element": "meta:extensionMappingDefinition", "sourcemaps:value": "[(79,2)-(80,0)]" }, + { + "@id": "/semantic-extensions/rateLimiting#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.yaml/semantic-extensions/rateLimiting", + "sourcemaps:value": "[(79,2)-(80,0)]" + }, + { + "@id": "/semantic-extensions/owner#/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(80,2)-(80,7)]" + }, { "@id": "/semantic-extensions/owner#/source-map/lexical/element_0", "sourcemaps:element": "meta:extensionMappingDefinition", "sourcemaps:value": "[(80,2)-(81,0)]" }, + { + "@id": "/semantic-extensions/owner#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.yaml/semantic-extensions/owner", + "sourcemaps:value": "[(80,2)-(81,0)]" + }, + { + "@id": "/semantic-extensions/anypointId#/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(81,2)-(81,12)]" + }, { "@id": "/semantic-extensions/anypointId#/source-map/lexical/element_0", "sourcemaps:element": "meta:extensionMappingDefinition", "sourcemaps:value": "[(81,2)-(82,0)]" }, + { + "@id": "/semantic-extensions/anypointId#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.yaml/semantic-extensions/anypointId", + "sourcemaps:value": "[(81,2)-(82,0)]" + }, + { + "@id": "/semantic-extensions/accountType#/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(82,2)-(82,13)]" + }, { "@id": "/semantic-extensions/accountType#/source-map/lexical/element_0", "sourcemaps:element": "meta:extensionMappingDefinition", "sourcemaps:value": "[(82,2)-(83,0)]" }, + { + "@id": "/semantic-extensions/accountType#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.yaml/semantic-extensions/accountType", + "sourcemaps:value": "[(82,2)-(83,0)]" + }, + { + "@id": "/semantic-extensions/contactEmail#/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(83,2)-(83,14)]" + }, { "@id": "/semantic-extensions/contactEmail#/source-map/lexical/element_0", "sourcemaps:element": "meta:extensionMappingDefinition", "sourcemaps:value": "[(83,2)-(84,0)]" }, + { + "@id": "/semantic-extensions/contactEmail#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.yaml/semantic-extensions/contactEmail", + "sourcemaps:value": "[(83,2)-(84,0)]" + }, + { + "@id": "/semantic-extensions/ldapReferences#/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(84,2)-(84,16)]" + }, { "@id": "/semantic-extensions/ldapReferences#/source-map/lexical/element_0", "sourcemaps:element": "meta:extensionMappingDefinition", "sourcemaps:value": "[(84,2)-(85,0)]" }, + { + "@id": "/semantic-extensions/ldapReferences#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.yaml/semantic-extensions/ldapReferences", + "sourcemaps:value": "[(84,2)-(85,0)]" + }, { "@id": "", "doc:declares": [ @@ -620,6 +732,11 @@ "@type": [ "sourcemaps:SourceMap" ], + "sourcemaps:virtual-element": [ + { + "@id": "#/source-map/virtual-element/element_0" + } + ], "sourcemaps:lexical": [ { "@id": "#/source-map/lexical/element_4" @@ -999,6 +1116,11 @@ } ] }, + { + "@id": "#/source-map/virtual-element/element_0", + "sourcemaps:element": "meta:extensions", + "sourcemaps:value": "true" + }, { "@id": "#/source-map/lexical/element_4", "sourcemaps:element": "meta:extensions", @@ -1150,7 +1272,7 @@ { "@id": "#/declarations/MaintainerAnnotationMapping/source-map/lexical/element_3", "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.yaml#/declarations/MaintainerAnnotationMapping", - "sourcemaps:value": "[(18,0)-(24,0)]" + "sourcemaps:value": "[(17,2)-(24,0)]" }, { "@id": "#/declarations/MaintainerAnnotationMapping/source-map/lexical/element_5", @@ -1165,7 +1287,7 @@ { "@id": "#/declarations/LDAPReferencesAnnotationMapping/source-map/lexical/element_3", "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.yaml#/declarations/LDAPReferencesAnnotationMapping", - "sourcemaps:value": "[(56,0)-(62,0)]" + "sourcemaps:value": "[(55,2)-(62,0)]" }, { "@id": "#/declarations/LDAPReferencesAnnotationMapping/source-map/lexical/element_1", @@ -1195,7 +1317,7 @@ { "@id": "#/declarations/ContactEmailAnnotationMapping/source-map/lexical/element_2", "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.yaml#/declarations/ContactEmailAnnotationMapping", - "sourcemaps:value": "[(50,0)-(55,0)]" + "sourcemaps:value": "[(49,2)-(55,0)]" }, { "@id": "#/declarations/ContactEmailAnnotationMapping/source-map/lexical/element_0", @@ -1245,7 +1367,7 @@ { "@id": "#/declarations/RateLimitingAnnotationMapping/source-map/lexical/element_4", "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.yaml#/declarations/RateLimitingAnnotationMapping", - "sourcemaps:value": "[(10,0)-(17,0)]" + "sourcemaps:value": "[(9,2)-(17,0)]" }, { "@id": "#/declarations/RateLimitingAnnotationMapping/source-map/lexical/element_6", @@ -1280,7 +1402,7 @@ { "@id": "#/declarations/OwnerAnnotationMapping/source-map/lexical/element_3", "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.yaml#/declarations/OwnerAnnotationMapping", - "sourcemaps:value": "[(25,0)-(33,0)]" + "sourcemaps:value": "[(24,2)-(33,0)]" }, { "@id": "#/declarations/OwnerAnnotationMapping/source-map/lexical/element_5", @@ -1295,7 +1417,7 @@ { "@id": "#/declarations/AccountTypeAnnotationMapping/source-map/lexical/element_3", "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.yaml#/declarations/AccountTypeAnnotationMapping", - "sourcemaps:value": "[(40,0)-(49,0)]" + "sourcemaps:value": "[(39,2)-(49,0)]" }, { "@id": "#/declarations/AccountTypeAnnotationMapping/source-map/lexical/element_1", @@ -1325,7 +1447,7 @@ { "@id": "#/declarations/AnypointIdAnnotationMapping/source-map/lexical/element_3", "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings-with-extra-facets/dialect.yaml#/declarations/AnypointIdAnnotationMapping", - "sourcemaps:value": "[(34,0)-(39,0)]" + "sourcemaps:value": "[(33,2)-(39,0)]" }, { "@id": "#/declarations/AnypointIdAnnotationMapping/source-map/lexical/element_1", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.cycled.yaml index 2fa3e554..42a71863 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.cycled.yaml +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.cycled.yaml @@ -24,8 +24,8 @@ nodeMappings: range: string email: range: string -uses: - github: github.vocabulary.yaml extensions: maintainer: MaintainerAnnotationMapping contributor: ContributorAnnotationMapping +uses: + github: github.vocabulary.yaml diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.expanded.jsonld index b33b62e0..1bfeaa9b 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.expanded.jsonld @@ -42,6 +42,19 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml/semantic-extensions/maintainer#/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/core#name" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(37,2)-(37,12)]" + } + ] + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml/semantic-extensions/maintainer#/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ @@ -54,6 +67,19 @@ "@value": "[(37,2)-(38,0)]" } ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml/semantic-extensions/maintainer#/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml/semantic-extensions/maintainer" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(37,2)-(38,0)]" + } + ] } ] } @@ -82,6 +108,19 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml/semantic-extensions/contributor#/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/core#name" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(38,2)-(38,13)]" + } + ] + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml/semantic-extensions/contributor#/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ @@ -94,6 +133,19 @@ "@value": "[(38,2)-(39,0)]" } ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml/semantic-extensions/contributor#/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml/semantic-extensions/contributor" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(38,2)-(39,0)]" + } + ] } ] } @@ -303,6 +355,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/meta#extensions" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#aliases-array": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml#/source-map/aliases-array/element_0", @@ -444,7 +511,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://github.org/vocabulary#contributor/source-map/lexical/element_0", + "@id": "http://github.org/vocabulary#contributor/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://github.org/vocabulary#contributor" @@ -455,6 +522,19 @@ "@value": "[(6,2)-(9,17)]" } ] + }, + { + "@id": "http://github.org/vocabulary#contributor/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(9,4)-(9,17)]" + } + ] } ] } @@ -500,6 +580,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/github.vocabulary.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/github.vocabulary.yaml#/source-map/lexical/element_2", @@ -884,7 +979,7 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(17,0)-(21,0)]" + "@value": "[(16,2)-(21,0)]" } ] }, @@ -992,7 +1087,7 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(22,0)-(26,0)]" + "@value": "[(21,2)-(26,0)]" } ] }, diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.flattened.jsonld index 59aac5c7..4d4d1403 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.flattened.jsonld @@ -129,8 +129,14 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml/semantic-extensions/maintainer#/source-map/lexical/element_2" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml/semantic-extensions/maintainer#/source-map/lexical/element_0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml/semantic-extensions/maintainer#/source-map/lexical/element_1" } ] }, @@ -140,8 +146,14 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml/semantic-extensions/contributor#/source-map/lexical/element_2" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml/semantic-extensions/contributor#/source-map/lexical/element_0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml/semantic-extensions/contributor#/source-map/lexical/element_1" } ] }, @@ -184,16 +196,36 @@ "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#rootDocument", "http://a.ml/vocabularies/document-source-maps#value": "[(12,2)-(15,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml/semantic-extensions/maintainer#/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", + "http://a.ml/vocabularies/document-source-maps#value": "[(37,2)-(37,12)]" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml/semantic-extensions/maintainer#/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#extensionMappingDefinition", "http://a.ml/vocabularies/document-source-maps#value": "[(37,2)-(38,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml/semantic-extensions/maintainer#/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml/semantic-extensions/maintainer", + "http://a.ml/vocabularies/document-source-maps#value": "[(37,2)-(38,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml/semantic-extensions/contributor#/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", + "http://a.ml/vocabularies/document-source-maps#value": "[(38,2)-(38,13)]" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml/semantic-extensions/contributor#/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#extensionMappingDefinition", "http://a.ml/vocabularies/document-source-maps#value": "[(38,2)-(39,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml/semantic-extensions/contributor#/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml/semantic-extensions/contributor", + "http://a.ml/vocabularies/document-source-maps#value": "[(38,2)-(39,0)]" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml#/documents/root/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml#/documents/root", @@ -365,6 +397,11 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#aliases-array": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml#/source-map/aliases-array/element_0" @@ -424,6 +461,11 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/github.vocabulary.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/github.vocabulary.yaml#/source-map/lexical/element_2" @@ -582,6 +624,11 @@ } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#extensions", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml#/source-map/aliases-array/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml", @@ -623,11 +670,19 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://github.org/vocabulary#contributor/source-map/lexical/element_1" + }, { "@id": "http://github.org/vocabulary#contributor/source-map/lexical/element_0" } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/github.vocabulary.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#declares", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/github.vocabulary.yaml#/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", @@ -717,7 +772,7 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml#/declarations/MaintainerAnnotationMapping/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml#/declarations/MaintainerAnnotationMapping", - "http://a.ml/vocabularies/document-source-maps#value": "[(17,0)-(21,0)]" + "http://a.ml/vocabularies/document-source-maps#value": "[(16,2)-(21,0)]" }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml#/declarations/MaintainerAnnotationMapping/source-map/lexical/element_0", @@ -742,7 +797,7 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml#/declarations/ContributorAnnotationMapping/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml#/declarations/ContributorAnnotationMapping", - "http://a.ml/vocabularies/document-source-maps#value": "[(22,0)-(26,0)]" + "http://a.ml/vocabularies/document-source-maps#value": "[(21,2)-(26,0)]" }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml#/declarations/ContributorAnnotationMapping/source-map/lexical/element_0", @@ -760,10 +815,15 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(23,4)-(24,0)]" }, { - "@id": "http://github.org/vocabulary#contributor/source-map/lexical/element_0", + "@id": "http://github.org/vocabulary#contributor/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://github.org/vocabulary#contributor", "http://a.ml/vocabularies/document-source-maps#value": "[(6,2)-(9,17)]" }, + { + "@id": "http://github.org/vocabulary#contributor/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(9,4)-(9,17)]" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/annotation-mappings/dialect.yaml#/declarations/PersonNodeMapping/property/surname/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.cycled.jsonld.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.cycled.jsonld.yaml new file mode 100644 index 00000000..6d7b05a8 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.cycled.jsonld.yaml @@ -0,0 +1,32 @@ +#%Dialect 1.0 +dialect: Mapping AllOf +version: "1.0" +documents: + root: + encodes: Root +nodeMappings: + Root: + components: + - Member1 + - Member2 + mapping: + m11: + range: string + m12: + range: string + m21: + range: string + m22: + range: string + Member1: + mapping: + m11: + range: string + m12: + range: string + Member2: + mapping: + m21: + range: string + m22: + range: string diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.cycled.yaml new file mode 100644 index 00000000..6d7b05a8 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.cycled.yaml @@ -0,0 +1,32 @@ +#%Dialect 1.0 +dialect: Mapping AllOf +version: "1.0" +documents: + root: + encodes: Root +nodeMappings: + Root: + components: + - Member1 + - Member2 + mapping: + m11: + range: string + m12: + range: string + m21: + range: string + m22: + range: string + Member1: + mapping: + m11: + range: string + m12: + range: string + Member2: + mapping: + m21: + range: string + m22: + range: string diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.expanded.jsonld new file mode 100644 index 00000000..62ac2b61 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.expanded.jsonld @@ -0,0 +1,990 @@ +[ + { + "@id": "", + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": [ + { + "@value": "Mapping AllOf" + } + ], + "core:version": [ + { + "@value": "1.0" + } + ], + "meta:documents": [ + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": [ + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Mapping AllOf 1.0" + } + ], + "meta:encodedNode": [ + { + "@id": "#/declarations/Root" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/documents/root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,7)-(9,0)]" + } + ] + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:encodedNode" + } + ], + "sourcemaps:value": [ + { + "@value": "[(7,4)-(9,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml/documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,0)-(9,0)]" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:rootDocument" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,2)-(9,0)]" + } + ] + } + ] + } + ] + } + ], + "doc:location": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml" + } + ], + "doc:root": [ + { + "@value": true + } + ], + "doc:processingData": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": [ + { + "@value": false + } + ], + "doc:sourceSpec": [ + { + "@value": "AML 1.0" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:version" + } + ], + "sourcemaps:value": [ + { + "@value": "[(3,0)-(5,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,0)-(9,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(34,21)]" + } + ] + } + ] + } + ], + "doc:declares": [ + { + "@id": "#/declarations/Root", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Root" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Root/property/m21", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m21" + } + ], + "core:name": [ + { + "@value": "m21" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/m21/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/m21/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(16,6)-(16,9)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/m21/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(17,8)-(18,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/m21/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/declarations/Root/property/m21" + } + ], + "sourcemaps:value": [ + { + "@value": "[(16,10)-(18,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Root/property/m12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m12" + } + ], + "core:name": [ + { + "@value": "m12" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/m12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/m12/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(14,6)-(14,9)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/m12/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(15,8)-(16,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/m12/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/declarations/Root/property/m12" + } + ], + "sourcemaps:value": [ + { + "@value": "[(14,10)-(16,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Root/property/m11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m11" + } + ], + "core:name": [ + { + "@value": "m11" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/m11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/m11/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(12,6)-(12,9)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/m11/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(13,8)-(14,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/m11/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/declarations/Root/property/m11" + } + ], + "sourcemaps:value": [ + { + "@value": "[(12,10)-(14,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Root/property/m22", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m22" + } + ], + "core:name": [ + { + "@value": "m22" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/m22/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/m22/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(18,6)-(18,9)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/m22/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(19,8)-(20,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/m22/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/declarations/Root/property/m22" + } + ], + "sourcemaps:value": [ + { + "@value": "[(18,10)-(20,0)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/amf/aml#components": [ + { + "@id": "#/declarations/Member1" + }, + { + "@id": "#/declarations/Member2" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(10,2)-(10,6)]" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(11,4)-(20,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/declarations/Root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(10,2)-(23,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Member1" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Member1/property/m12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m12" + } + ], + "core:name": [ + { + "@value": "m12" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/property/m12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(27,6)-(27,9)]" + } + ] + }, + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(28,8)-(29,0)]" + } + ] + }, + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/declarations/Member1/property/m12" + } + ], + "sourcemaps:value": [ + { + "@value": "[(27,10)-(29,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member1/property/m11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m11" + } + ], + "core:name": [ + { + "@value": "m11" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/property/m11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(25,6)-(25,9)]" + } + ] + }, + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(26,8)-(27,0)]" + } + ] + }, + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/declarations/Member1/property/m11" + } + ], + "sourcemaps:value": [ + { + "@value": "[(25,10)-(27,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(23,2)-(23,9)]" + } + ] + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(24,4)-(29,0)]" + } + ] + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/declarations/Member1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(23,2)-(29,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Member2" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Member2/property/m21", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m21" + } + ], + "core:name": [ + { + "@value": "m21" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/property/m21/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(31,6)-(31,9)]" + } + ] + }, + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(32,8)-(33,0)]" + } + ] + }, + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/declarations/Member2/property/m21" + } + ], + "sourcemaps:value": [ + { + "@value": "[(31,10)-(33,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member2/property/m22", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m22" + } + ], + "core:name": [ + { + "@value": "m22" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/property/m22/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(33,6)-(33,9)]" + } + ] + }, + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(34,8)-(34,21)]" + } + ] + }, + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/declarations/Member2/property/m22" + } + ], + "sourcemaps:value": [ + { + "@value": "[(33,10)-(34,21)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(29,2)-(29,9)]" + } + ] + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(30,4)-(34,21)]" + } + ] + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/declarations/Member2" + } + ], + "sourcemaps:value": [ + { + "@value": "[(29,2)-(34,21)]" + } + ] + } + ] + } + ] + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#" + } + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.flattened.jsonld new file mode 100644 index 00000000..38125a2c --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.flattened.jsonld @@ -0,0 +1,793 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + }, + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map" + } + ] + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "Mapping AllOf 1.0", + "meta:encodedNode": [ + { + "@id": "#/declarations/Root" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map" + } + ] + }, + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1" + }, + { + "@id": "/documents#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml/documents", + "sourcemaps:value": "[(6,0)-(9,0)]" + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": "meta:rootDocument", + "sourcemaps:value": "[(6,2)-(9,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/documents/root", + "sourcemaps:value": "[(6,7)-(9,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": "meta:encodedNode", + "sourcemaps:value": "[(7,4)-(9,0)]" + }, + { + "@id": "", + "doc:declares": [ + { + "@id": "#/declarations/Root" + }, + { + "@id": "#/declarations/Member1" + }, + { + "@id": "#/declarations/Member2" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "Mapping AllOf", + "core:version": "1.0", + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + }, + "sourcemaps:sources": [ + { + "@id": "#/source-map" + } + ] + }, + { + "@id": "#/declarations/Root", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Root", + "shacl:property": [ + { + "@id": "#/declarations/Root/property/m21" + }, + { + "@id": "#/declarations/Root/property/m12" + }, + { + "@id": "#/declarations/Root/property/m11" + }, + { + "@id": "#/declarations/Root/property/m22" + } + ], + "http://a.ml/vocabularies/amf/aml#components": [ + { + "@id": "#/declarations/Member1" + }, + { + "@id": "#/declarations/Member2" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/source-map" + } + ] + }, + { + "@id": "#/declarations/Member1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Member1", + "shacl:property": [ + { + "@id": "#/declarations/Member1/property/m12" + }, + { + "@id": "#/declarations/Member1/property/m11" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/source-map" + } + ] + }, + { + "@id": "#/declarations/Member2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Member2", + "shacl:property": [ + { + "@id": "#/declarations/Member2/property/m21" + }, + { + "@id": "#/declarations/Member2/property/m22" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/source-map" + } + ] + }, + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_3" + }, + { + "@id": "#/source-map/lexical/element_1" + }, + { + "@id": "#/source-map/lexical/element_0" + }, + { + "@id": "#/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/Root/property/m21", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m21" + } + ], + "core:name": "m21", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/m21/source-map" + } + ] + }, + { + "@id": "#/declarations/Root/property/m12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m12" + } + ], + "core:name": "m12", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/m12/source-map" + } + ] + }, + { + "@id": "#/declarations/Root/property/m11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m11" + } + ], + "core:name": "m11", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/m11/source-map" + } + ] + }, + { + "@id": "#/declarations/Root/property/m22", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m22" + } + ], + "core:name": "m22", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/m22/source-map" + } + ] + }, + { + "@id": "#/declarations/Root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member1/property/m12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m12" + } + ], + "core:name": "m12", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/property/m12/source-map" + } + ] + }, + { + "@id": "#/declarations/Member1/property/m11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m11" + } + ], + "core:name": "m11", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/property/m11/source-map" + } + ] + }, + { + "@id": "#/declarations/Member1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member2/property/m21", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m21" + } + ], + "core:name": "m21", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/property/m21/source-map" + } + ] + }, + { + "@id": "#/declarations/Member2/property/m22", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m22" + } + ], + "core:name": "m22", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/property/m22/source-map" + } + ] + }, + { + "@id": "#/declarations/Member2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": "core:version", + "sourcemaps:value": "[(3,0)-(5,0)]" + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(2,0)-(3,0)]" + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": "meta:documents", + "sourcemaps:value": "[(5,0)-(9,0)]" + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml", + "sourcemaps:value": "[(2,0)-(34,21)]" + }, + { + "@id": "#/declarations/Root/property/m21/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/m21/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Root/property/m21/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Root/property/m21/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Root/property/m12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/m12/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Root/property/m12/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Root/property/m12/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Root/property/m11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/m11/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Root/property/m11/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Root/property/m11/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Root/property/m22/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/m22/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Root/property/m22/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Root/property/m22/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(10,2)-(10,6)]" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(11,4)-(20,0)]" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/declarations/Root", + "sourcemaps:value": "[(10,2)-(23,0)]" + }, + { + "@id": "#/declarations/Member1/property/m12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member1/property/m11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(23,2)-(23,9)]" + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(24,4)-(29,0)]" + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/declarations/Member1", + "sourcemaps:value": "[(23,2)-(29,0)]" + }, + { + "@id": "#/declarations/Member2/property/m21/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member2/property/m22/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(29,2)-(29,9)]" + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(30,4)-(34,21)]" + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/declarations/Member2", + "sourcemaps:value": "[(29,2)-(34,21)]" + }, + { + "@id": "#/declarations/Root/property/m21/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(16,6)-(16,9)]" + }, + { + "@id": "#/declarations/Root/property/m21/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(17,8)-(18,0)]" + }, + { + "@id": "#/declarations/Root/property/m21/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/declarations/Root/property/m21", + "sourcemaps:value": "[(16,10)-(18,0)]" + }, + { + "@id": "#/declarations/Root/property/m12/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(14,6)-(14,9)]" + }, + { + "@id": "#/declarations/Root/property/m12/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(15,8)-(16,0)]" + }, + { + "@id": "#/declarations/Root/property/m12/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/declarations/Root/property/m12", + "sourcemaps:value": "[(14,10)-(16,0)]" + }, + { + "@id": "#/declarations/Root/property/m11/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(12,6)-(12,9)]" + }, + { + "@id": "#/declarations/Root/property/m11/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(13,8)-(14,0)]" + }, + { + "@id": "#/declarations/Root/property/m11/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/declarations/Root/property/m11", + "sourcemaps:value": "[(12,10)-(14,0)]" + }, + { + "@id": "#/declarations/Root/property/m22/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(18,6)-(18,9)]" + }, + { + "@id": "#/declarations/Root/property/m22/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(19,8)-(20,0)]" + }, + { + "@id": "#/declarations/Root/property/m22/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/declarations/Root/property/m22", + "sourcemaps:value": "[(18,10)-(20,0)]" + }, + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(27,6)-(27,9)]" + }, + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(28,8)-(29,0)]" + }, + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/declarations/Member1/property/m12", + "sourcemaps:value": "[(27,10)-(29,0)]" + }, + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(25,6)-(25,9)]" + }, + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(26,8)-(27,0)]" + }, + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/declarations/Member1/property/m11", + "sourcemaps:value": "[(25,10)-(27,0)]" + }, + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(31,6)-(31,9)]" + }, + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(32,8)-(33,0)]" + }, + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/declarations/Member2/property/m21", + "sourcemaps:value": "[(31,10)-(33,0)]" + }, + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(33,6)-(33,9)]" + }, + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(34,8)-(34,21)]" + }, + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml#/declarations/Member2/property/m22", + "sourcemaps:value": "[(33,10)-(34,21)]" + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml new file mode 100644 index 00000000..68b5c8ae --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/components/dialect.yaml @@ -0,0 +1,34 @@ +#%Dialect 1.0 +dialect: Mapping AllOf +version: 1.0 + +documents: + root: + encodes: Root + +nodeMappings: + Root: + mapping: + m11: + range: string + m12: + range: string + m21: + range: string + m22: + range: string + components: + - Member1 + - Member2 + Member1: + mapping: + m11: + range: string + m12: + range: string + Member2: + mapping: + m21: + range: string + m22: + range: string \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect-with-invalid-references.report.json b/amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect-with-invalid-references.report.json new file mode 100644 index 00000000..f77a3bb6 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect-with-invalid-references.report.json @@ -0,0 +1,93 @@ +{ + "@type": "http://www.w3.org/ns/shacl#ValidationReport", + "http://www.w3.org/ns/shacl#conforms": false, + "http://www.w3.org/ns/shacl#result": [ + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect-with-invalid-references.yaml#/declarations/RootMapping" + }, + "http://www.w3.org/ns/shacl#resultPath": { + "@id": "http://www.w3.org/ns/shacl#node" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Cannot find property range term NotExists", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "http://a.ml/vocabularies/amf/aml#missing-node-mapping-range-term" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 15, + "http://a.ml/vocabularies/amf/parser#column": 12 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 15, + "http://a.ml/vocabularies/amf/parser#column": 21 + } + } + }, + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect-with-invalid-references.yaml#/declarations/RootMapping" + }, + "http://www.w3.org/ns/shacl#resultPath": { + "@id": "http://www.w3.org/ns/shacl#node" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Cannot find property range term NotExists_1", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "http://a.ml/vocabularies/amf/aml#missing-node-mapping-range-term" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 16, + "http://a.ml/vocabularies/amf/parser#column": 14 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 16, + "http://a.ml/vocabularies/amf/parser#column": 25 + } + } + }, + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect-with-invalid-references.yaml#/declarations/RootMapping" + }, + "http://www.w3.org/ns/shacl#resultPath": { + "@id": "http://www.w3.org/ns/shacl#node" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Cannot find property range term NotExists_2", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "http://a.ml/vocabularies/amf/aml#missing-node-mapping-range-term" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 17, + "http://a.ml/vocabularies/amf/parser#column": 14 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 17, + "http://a.ml/vocabularies/amf/parser#column": 25 + } + } + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect-with-invalid-references.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect-with-invalid-references.yaml new file mode 100644 index 00000000..e437b4b7 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect-with-invalid-references.yaml @@ -0,0 +1,34 @@ +#%Dialect 1.0 +dialect: Test +version: "1.0" + +external: + schema-org: https://schema.org/ + +documents: + root: + encodes: RootMapping + +nodeMappings: + RootMapping: + conditional: + if: NotExists + then: NotExists_1 + else: NotExists_2 + ConditionMapping: + mapping: + someField: + range: string + enum: [ "conditional-value" ] + mandatory: true + ThenMapping: + mapping: + someField: + range: string + propertyTerm: schema-org.name + ElseMapping: + mapping: + someOtherField: + range: string + propertyTerm: schema-org.description + diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.cycled.jsonld.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.cycled.jsonld.yaml new file mode 100644 index 00000000..9f1ef3af --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.cycled.jsonld.yaml @@ -0,0 +1,31 @@ +#%Dialect 1.0 +dialect: Test +version: "1.0" +external: + schema-org: https://schema.org/ +documents: + root: + encodes: RootMapping +nodeMappings: + RootMapping: + conditional: + if: ConditionMapping + then: ThenMapping + else: ElseMapping + ConditionMapping: + mapping: + someField: + range: string + enum: + - conditional-value + mandatory: true + ThenMapping: + mapping: + someField: + range: string + propertyTerm: schema-org.name + ElseMapping: + mapping: + someOtherField: + range: string + propertyTerm: schema-org.description diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.cycled.yaml new file mode 100644 index 00000000..9f1ef3af --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.cycled.yaml @@ -0,0 +1,31 @@ +#%Dialect 1.0 +dialect: Test +version: "1.0" +external: + schema-org: https://schema.org/ +documents: + root: + encodes: RootMapping +nodeMappings: + RootMapping: + conditional: + if: ConditionMapping + then: ThenMapping + else: ElseMapping + ConditionMapping: + mapping: + someField: + range: string + enum: + - conditional-value + mandatory: true + ThenMapping: + mapping: + someField: + range: string + propertyTerm: schema-org.name + ElseMapping: + mapping: + someOtherField: + range: string + propertyTerm: schema-org.description diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.expanded.jsonld new file mode 100644 index 00000000..01809cfc --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.expanded.jsonld @@ -0,0 +1,845 @@ +[ + { + "@id": "", + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": [ + { + "@value": "Test" + } + ], + "core:version": [ + { + "@value": "1.0" + } + ], + "meta:externals": [ + { + "@id": "/externals/schema-org", + "@type": [ + "owl:Ontology", + "meta:ExternalVocabulary", + "doc:DomainElement" + ], + "core:displayName": [ + { + "@value": "schema-org" + } + ], + "meta:base": [ + { + "@value": "https://schema.org/" + } + ], + "sourcemaps:sources": [ + { + "@id": "/externals/schema-org#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/externals/schema-org#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:displayName" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,2)-(6,12)]" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:base" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,14)-(6,33)]" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml/externals/schema-org" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,2)-(8,0)]" + } + ] + } + ] + } + ] + } + ], + "meta:documents": [ + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": [ + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Test 1.0" + } + ], + "meta:encodedNode": [ + { + "@id": "#/declarations/RootMapping" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml#/documents/root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,7)-(12,0)]" + } + ] + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:encodedNode" + } + ], + "sourcemaps:value": [ + { + "@value": "[(10,4)-(12,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml/documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,0)-(12,0)]" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:rootDocument" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,2)-(12,0)]" + } + ] + } + ] + } + ] + } + ], + "doc:location": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml" + } + ], + "doc:root": [ + { + "@value": true + } + ], + "doc:processingData": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": [ + { + "@value": false + } + ], + "doc:sourceSpec": [ + { + "@value": "AML 1.0" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_4", + "sourcemaps:element": [ + { + "@value": "meta:externals" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,0)-(8,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(35,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(8,0)-(12,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:version" + } + ], + "sourcemaps:value": [ + { + "@value": "[(3,0)-(5,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + } + ] + } + ], + "doc:declares": [ + { + "@id": "#/declarations/RootMapping", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "RootMapping" + } + ], + "http://a.ml/vocabularies/amf/aml#if": [ + { + "@id": "#/declarations/ConditionMapping" + } + ], + "http://a.ml/vocabularies/amf/aml#then": [ + { + "@id": "#/declarations/ThenMapping" + } + ], + "http://a.ml/vocabularies/amf/aml#else": [ + { + "@id": "#/declarations/ElseMapping" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/RootMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/RootMapping/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml#/declarations/RootMapping" + } + ], + "sourcemaps:value": [ + { + "@value": "[(13,2)-(18,0)]" + } + ] + }, + { + "@id": "#/declarations/RootMapping/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(13,2)-(13,13)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/ConditionMapping", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "ConditionMapping" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/ConditionMapping/property/someField", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#someField" + } + ], + "core:name": [ + { + "@value": "someField" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:minCount": [ + { + "@value": 1 + } + ], + "shacl:in": [ + { + "@id": "#/declarations/ConditionMapping/property/someField/list", + "@type": "rdfs:Seq", + "rdfs:_1": [ + { + "@value": "conditional-value", + "@type": "xsd:string" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_4", + "sourcemaps:element": [ + { + "@value": "shacl:minCount" + } + ], + "sourcemaps:value": [ + { + "@value": "[(23,8)-(24,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml#/declarations/ConditionMapping/property/someField" + } + ], + "sourcemaps:value": [ + { + "@value": "[(20,16)-(24,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:in" + } + ], + "sourcemaps:value": [ + { + "@value": "[(22,8)-(23,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(21,8)-(22,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(20,6)-(20,15)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionMapping/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(18,2)-(18,18)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMapping/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(19,4)-(24,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMapping/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml#/declarations/ConditionMapping" + } + ], + "sourcemaps:value": [ + { + "@value": "[(18,2)-(24,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/ThenMapping", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "ThenMapping" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/ThenMapping/property/someField", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/name" + } + ], + "core:name": [ + { + "@value": "someField" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ThenMapping/property/someField/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(26,6)-(26,15)]" + } + ] + }, + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "shacl:path" + } + ], + "sourcemaps:value": [ + { + "@value": "[(28,8)-(29,0)]" + } + ] + }, + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(27,8)-(28,0)]" + } + ] + }, + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml#/declarations/ThenMapping/property/someField" + } + ], + "sourcemaps:value": [ + { + "@value": "[(26,16)-(29,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ThenMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ThenMapping/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(24,2)-(24,13)]" + } + ] + }, + { + "@id": "#/declarations/ThenMapping/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(25,4)-(29,0)]" + } + ] + }, + { + "@id": "#/declarations/ThenMapping/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml#/declarations/ThenMapping" + } + ], + "sourcemaps:value": [ + { + "@value": "[(24,2)-(29,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/ElseMapping", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "ElseMapping" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/ElseMapping/property/someOtherField", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/description" + } + ], + "core:name": [ + { + "@value": "someOtherField" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(31,6)-(31,20)]" + } + ] + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "shacl:path" + } + ], + "sourcemaps:value": [ + { + "@value": "[(33,8)-(35,0)]" + } + ] + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(32,8)-(33,0)]" + } + ] + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml#/declarations/ElseMapping/property/someOtherField" + } + ], + "sourcemaps:value": [ + { + "@value": "[(31,21)-(35,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ElseMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ElseMapping/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(29,2)-(29,13)]" + } + ] + }, + { + "@id": "#/declarations/ElseMapping/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(30,4)-(35,0)]" + } + ] + }, + { + "@id": "#/declarations/ElseMapping/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml#/declarations/ElseMapping" + } + ], + "sourcemaps:value": [ + { + "@value": "[(29,2)-(35,0)]" + } + ] + } + ] + } + ] + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "owl": "http://www.w3.org/2002/07/owl#", + "meta": "http://a.ml/vocabularies/meta#", + "xsd": "http://www.w3.org/2001/XMLSchema#" + } + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.flattened.jsonld new file mode 100644 index 00000000..cb48abcb --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.flattened.jsonld @@ -0,0 +1,658 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/externals/schema-org", + "@type": [ + "owl:Ontology", + "meta:ExternalVocabulary", + "doc:DomainElement" + ], + "core:displayName": "schema-org", + "meta:base": "https://schema.org/", + "sourcemaps:sources": [ + { + "@id": "/externals/schema-org#/source-map" + } + ] + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + }, + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/externals/schema-org#/source-map/lexical/element_2" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_0" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "Test 1.0", + "meta:encodedNode": [ + { + "@id": "#/declarations/RootMapping" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map" + } + ] + }, + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1" + }, + { + "@id": "/documents#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_2", + "sourcemaps:element": "core:displayName", + "sourcemaps:value": "[(6,2)-(6,12)]" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_0", + "sourcemaps:element": "meta:base", + "sourcemaps:value": "[(6,14)-(6,33)]" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml/externals/schema-org", + "sourcemaps:value": "[(6,2)-(8,0)]" + }, + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml/documents", + "sourcemaps:value": "[(9,0)-(12,0)]" + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": "meta:rootDocument", + "sourcemaps:value": "[(9,2)-(12,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml#/documents/root", + "sourcemaps:value": "[(9,7)-(12,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": "meta:encodedNode", + "sourcemaps:value": "[(10,4)-(12,0)]" + }, + { + "@id": "", + "doc:declares": [ + { + "@id": "#/declarations/RootMapping" + }, + { + "@id": "#/declarations/ConditionMapping" + }, + { + "@id": "#/declarations/ThenMapping" + }, + { + "@id": "#/declarations/ElseMapping" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "Test", + "core:version": "1.0", + "meta:externals": [ + { + "@id": "/externals/schema-org" + } + ], + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + }, + "sourcemaps:sources": [ + { + "@id": "#/source-map" + } + ] + }, + { + "@id": "#/declarations/RootMapping", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "RootMapping", + "http://a.ml/vocabularies/amf/aml#if": [ + { + "@id": "#/declarations/ConditionMapping" + } + ], + "http://a.ml/vocabularies/amf/aml#then": [ + { + "@id": "#/declarations/ThenMapping" + } + ], + "http://a.ml/vocabularies/amf/aml#else": [ + { + "@id": "#/declarations/ElseMapping" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/RootMapping/source-map" + } + ] + }, + { + "@id": "#/declarations/ConditionMapping", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "ConditionMapping", + "shacl:property": [ + { + "@id": "#/declarations/ConditionMapping/property/someField" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionMapping/source-map" + } + ] + }, + { + "@id": "#/declarations/ThenMapping", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "ThenMapping", + "shacl:property": [ + { + "@id": "#/declarations/ThenMapping/property/someField" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ThenMapping/source-map" + } + ] + }, + { + "@id": "#/declarations/ElseMapping", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "ElseMapping", + "shacl:property": [ + { + "@id": "#/declarations/ElseMapping/property/someOtherField" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ElseMapping/source-map" + } + ] + }, + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_4" + }, + { + "@id": "#/source-map/lexical/element_2" + }, + { + "@id": "#/source-map/lexical/element_0" + }, + { + "@id": "#/source-map/lexical/element_1" + }, + { + "@id": "#/source-map/lexical/element_3" + } + ] + }, + { + "@id": "#/declarations/RootMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/RootMapping/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/RootMapping/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/declarations/ConditionMapping/property/someField", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#someField" + } + ], + "core:name": "someField", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:minCount": 1, + "shacl:in": { + "@id": "#/declarations/ConditionMapping/property/someField/list" + }, + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map" + } + ] + }, + { + "@id": "#/declarations/ConditionMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionMapping/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/ConditionMapping/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ConditionMapping/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/ThenMapping/property/someField", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/name" + } + ], + "core:name": "someField", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ThenMapping/property/someField/source-map" + } + ] + }, + { + "@id": "#/declarations/ThenMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ThenMapping/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/ThenMapping/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ThenMapping/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/description" + } + ], + "core:name": "someOtherField", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map" + } + ] + }, + { + "@id": "#/declarations/ElseMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ElseMapping/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/ElseMapping/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ElseMapping/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/source-map/lexical/element_4", + "sourcemaps:element": "meta:externals", + "sourcemaps:value": "[(5,0)-(8,0)]" + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml", + "sourcemaps:value": "[(2,0)-(35,0)]" + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": "meta:documents", + "sourcemaps:value": "[(8,0)-(12,0)]" + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": "core:version", + "sourcemaps:value": "[(3,0)-(5,0)]" + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(2,0)-(3,0)]" + }, + { + "@id": "#/declarations/RootMapping/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml#/declarations/RootMapping", + "sourcemaps:value": "[(13,2)-(18,0)]" + }, + { + "@id": "#/declarations/RootMapping/source-map/lexical/element_0", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(13,2)-(13,13)]" + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/list", + "@type": "rdfs:Seq", + "rdfs:_1": { + "@value": "conditional-value", + "@type": "xsd:string" + } + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_4" + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_3" + } + ] + }, + { + "@id": "#/declarations/ConditionMapping/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(18,2)-(18,18)]" + }, + { + "@id": "#/declarations/ConditionMapping/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(19,4)-(24,0)]" + }, + { + "@id": "#/declarations/ConditionMapping/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml#/declarations/ConditionMapping", + "sourcemaps:value": "[(18,2)-(24,0)]" + }, + { + "@id": "#/declarations/ThenMapping/property/someField/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/ThenMapping/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(24,2)-(24,13)]" + }, + { + "@id": "#/declarations/ThenMapping/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(25,4)-(29,0)]" + }, + { + "@id": "#/declarations/ThenMapping/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml#/declarations/ThenMapping", + "sourcemaps:value": "[(24,2)-(29,0)]" + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/ElseMapping/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(29,2)-(29,13)]" + }, + { + "@id": "#/declarations/ElseMapping/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(30,4)-(35,0)]" + }, + { + "@id": "#/declarations/ElseMapping/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml#/declarations/ElseMapping", + "sourcemaps:value": "[(29,2)-(35,0)]" + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_4", + "sourcemaps:element": "shacl:minCount", + "sourcemaps:value": "[(23,8)-(24,0)]" + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml#/declarations/ConditionMapping/property/someField", + "sourcemaps:value": "[(20,16)-(24,0)]" + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_0", + "sourcemaps:element": "shacl:in", + "sourcemaps:value": "[(22,8)-(23,0)]" + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_1", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(21,8)-(22,0)]" + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(20,6)-(20,15)]" + }, + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(26,6)-(26,15)]" + }, + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_1", + "sourcemaps:element": "shacl:path", + "sourcemaps:value": "[(28,8)-(29,0)]" + }, + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(27,8)-(28,0)]" + }, + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml#/declarations/ThenMapping/property/someField", + "sourcemaps:value": "[(26,16)-(29,0)]" + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(31,6)-(31,20)]" + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_1", + "sourcemaps:element": "shacl:path", + "sourcemaps:value": "[(33,8)-(35,0)]" + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(32,8)-(33,0)]" + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml#/declarations/ElseMapping/property/someOtherField", + "sourcemaps:value": "[(31,21)-(35,0)]" + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#", + "owl": "http://www.w3.org/2002/07/owl#", + "xsd": "http://www.w3.org/2001/XMLSchema#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml new file mode 100644 index 00000000..00db345e --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/conditional/dialect.yaml @@ -0,0 +1,34 @@ +#%Dialect 1.0 +dialect: Test +version: "1.0" + +external: + schema-org: https://schema.org/ + +documents: + root: + encodes: RootMapping + +nodeMappings: + RootMapping: + conditional: + if: ConditionMapping + then: ThenMapping + else: ElseMapping + ConditionMapping: + mapping: + someField: + range: string + enum: [ "conditional-value" ] + mandatory: true + ThenMapping: + mapping: + someField: + range: string + propertyTerm: schema-org.name + ElseMapping: + mapping: + someOtherField: + range: string + propertyTerm: schema-org.description + diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.cycled.yaml new file mode 100644 index 00000000..2402d39d --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.cycled.yaml @@ -0,0 +1,11 @@ +#%Dialect 1.0 +dialect: Test +version: "1.0" +nodeMappings: + Person: + mapping: + name: + range: string +documents: + root: + encodes: Person diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.expanded.jsonld new file mode 100644 index 00000000..4c69de53 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.expanded.jsonld @@ -0,0 +1,447 @@ +[ + { + "@id": "", + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": [ + { + "@value": "Test" + } + ], + "core:version": [ + { + "@value": "1.0" + } + ], + "meta:documents": [ + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": [ + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Test 1.0" + } + ], + "meta:encodedNode": [ + { + "@id": "#/declarations/Person" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.yaml#/documents/root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(11,7)-(13,0)]" + } + ] + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:encodedNode" + } + ], + "sourcemaps:value": [ + { + "@value": "[(12,4)-(13,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.yaml/documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(11,0)-(13,0)]" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:rootDocument" + } + ], + "sourcemaps:value": [ + { + "@value": "[(11,2)-(13,0)]" + } + ] + } + ] + } + ] + } + ], + "doc:location": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.yaml" + } + ], + "doc:root": [ + { + "@value": true + } + ], + "doc:processingData": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": [ + { + "@value": false + } + ], + "doc:sourceSpec": [ + { + "@value": "AML 1.0" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:version" + } + ], + "sourcemaps:value": [ + { + "@value": "[(3,0)-(4,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(10,0)-(13,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.yaml" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(13,0)]" + } + ] + } + ] + } + ], + "doc:declares": [ + { + "@id": "#/declarations/Person", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Person" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Person/property/name", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#name" + } + ], + "core:name": [ + { + "@value": "name" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:defaultValue": [ + { + "@id": "#/declarations/Person/property/name/scalar_1", + "@type": [ + "data:Scalar", + "data:Node", + "doc:DomainElement" + ], + "data:value": [ + { + "@value": "Adam Bareiro" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "core:name": [ + { + "@value": "scalar_1" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Person/property/name/scalar_1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:synthesized-field": [ + { + "@id": "#/declarations/Person/property/name/scalar_1/source-map/synthesized-field/element_1", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "true" + } + ] + }, + { + "@id": "#/declarations/Person/property/name/scalar_1/source-map/synthesized-field/element_0", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "true" + } + ] + } + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Person/property/name/scalar_1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.yaml#/declarations/Person/property/name/scalar_1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,17)-(9,29)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Person/property/name/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Person/property/name/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(8,8)-(9,0)]" + } + ] + }, + { + "@id": "#/declarations/Person/property/name/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(7,6)-(7,10)]" + } + ] + }, + { + "@id": "#/declarations/Person/property/name/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:defaultValue" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,8)-(10,0)]" + } + ] + }, + { + "@id": "#/declarations/Person/property/name/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.yaml#/declarations/Person/property/name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(7,11)-(10,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Person/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Person/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,2)-(5,8)]" + } + ] + }, + { + "@id": "#/declarations/Person/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,4)-(10,0)]" + } + ] + }, + { + "@id": "#/declarations/Person/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.yaml#/declarations/Person" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,2)-(10,0)]" + } + ] + } + ] + } + ] + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "data": "http://a.ml/vocabularies/data#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#" + } + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.flattened.jsonld new file mode 100644 index 00000000..87f2f5c6 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.flattened.jsonld @@ -0,0 +1,343 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + }, + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map" + } + ] + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "Test 1.0", + "meta:encodedNode": [ + { + "@id": "#/declarations/Person" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map" + } + ] + }, + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1" + }, + { + "@id": "/documents#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.yaml/documents", + "sourcemaps:value": "[(11,0)-(13,0)]" + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": "meta:rootDocument", + "sourcemaps:value": "[(11,2)-(13,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.yaml#/documents/root", + "sourcemaps:value": "[(11,7)-(13,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": "meta:encodedNode", + "sourcemaps:value": "[(12,4)-(13,0)]" + }, + { + "@id": "", + "doc:declares": [ + { + "@id": "#/declarations/Person" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "Test", + "core:version": "1.0", + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.yaml", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + }, + "sourcemaps:sources": [ + { + "@id": "#/source-map" + } + ] + }, + { + "@id": "#/declarations/Person", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Person", + "shacl:property": [ + { + "@id": "#/declarations/Person/property/name" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Person/source-map" + } + ] + }, + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_3" + }, + { + "@id": "#/source-map/lexical/element_1" + }, + { + "@id": "#/source-map/lexical/element_0" + }, + { + "@id": "#/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/Person/property/name", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#name" + } + ], + "core:name": "name", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:defaultValue": { + "@id": "#/declarations/Person/property/name/scalar_1" + }, + "sourcemaps:sources": [ + { + "@id": "#/declarations/Person/property/name/source-map" + } + ] + }, + { + "@id": "#/declarations/Person/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Person/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Person/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Person/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": "core:version", + "sourcemaps:value": "[(3,0)-(4,0)]" + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(2,0)-(3,0)]" + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": "meta:documents", + "sourcemaps:value": "[(10,0)-(13,0)]" + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.yaml", + "sourcemaps:value": "[(2,0)-(13,0)]" + }, + { + "@id": "#/declarations/Person/property/name/scalar_1", + "@type": [ + "data:Scalar", + "data:Node", + "doc:DomainElement" + ], + "data:value": "Adam Bareiro", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "core:name": "scalar_1", + "sourcemaps:sources": [ + { + "@id": "#/declarations/Person/property/name/scalar_1/source-map" + } + ] + }, + { + "@id": "#/declarations/Person/property/name/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Person/property/name/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/Person/property/name/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/Person/property/name/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Person/property/name/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/Person/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(5,2)-(5,8)]" + }, + { + "@id": "#/declarations/Person/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(6,4)-(10,0)]" + }, + { + "@id": "#/declarations/Person/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.yaml#/declarations/Person", + "sourcemaps:value": "[(5,2)-(10,0)]" + }, + { + "@id": "#/declarations/Person/property/name/scalar_1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:synthesized-field": [ + { + "@id": "#/declarations/Person/property/name/scalar_1/source-map/synthesized-field/element_1" + }, + { + "@id": "#/declarations/Person/property/name/scalar_1/source-map/synthesized-field/element_0" + } + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Person/property/name/scalar_1/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/declarations/Person/property/name/source-map/lexical/element_3", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(8,8)-(9,0)]" + }, + { + "@id": "#/declarations/Person/property/name/source-map/lexical/element_1", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(7,6)-(7,10)]" + }, + { + "@id": "#/declarations/Person/property/name/source-map/lexical/element_0", + "sourcemaps:element": "shacl:defaultValue", + "sourcemaps:value": "[(9,8)-(10,0)]" + }, + { + "@id": "#/declarations/Person/property/name/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.yaml#/declarations/Person/property/name", + "sourcemaps:value": "[(7,11)-(10,0)]" + }, + { + "@id": "#/declarations/Person/property/name/scalar_1/source-map/synthesized-field/element_1", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "true" + }, + { + "@id": "#/declarations/Person/property/name/scalar_1/source-map/synthesized-field/element_0", + "sourcemaps:element": "core:name", + "sourcemaps:value": "true" + }, + { + "@id": "#/declarations/Person/property/name/scalar_1/source-map/lexical/element_0", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.yaml#/declarations/Person/property/name/scalar_1", + "sourcemaps:value": "[(9,17)-(9,29)]" + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "data": "http://a.ml/vocabularies/data#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.yaml new file mode 100644 index 00000000..93bde765 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/default-facet/dialect.yaml @@ -0,0 +1,12 @@ +#%Dialect 1.0 +dialect: Test +version: "1.0" +nodeMappings: + Person: + mapping: + name: + range: string + default: Adam Bareiro +documents: + root: + encodes: Person diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.expanded.jsonld index c56ce81b..1d275762 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.expanded.jsonld @@ -152,21 +152,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.yaml" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/library.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/library.yaml::library.yaml" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.yaml#/source-map/lexical/element_3", @@ -220,6 +205,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/library.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/library.yaml::library.yaml" + } + ] + } ] } ], @@ -405,6 +405,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/library.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/library.yaml#/source-map/lexical/element_0", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.flattened.jsonld index aaa29515..baf7bd0f 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.flattened.jsonld @@ -197,11 +197,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.yaml#/source-map/aliases-array/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.yaml#/source-map/lexical/element_3" @@ -215,6 +210,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.yaml#/source-map/lexical/element_2" } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.yaml#/source-map/aliases-array/element_0" + } ] }, { @@ -249,6 +249,11 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/library.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/library.yaml#/source-map/lexical/element_0" @@ -307,11 +312,6 @@ } ] }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.yaml", - "http://a.ml/vocabularies/document-source-maps#value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/library.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/library.yaml::library.yaml" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.yaml#/source-map/lexical/element_3", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#version", @@ -332,6 +332,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.yaml", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(14,21)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/dialect.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/library.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/library.yaml::library.yaml" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/library.yaml#/declarations/AnotherNode/property/anotherProperty", "@type": [ @@ -372,6 +377,11 @@ } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/library.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#declares", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/library.yaml#/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/dialect-library/library.yaml", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.cycled.yaml new file mode 100644 index 00000000..4ec20cb8 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.cycled.yaml @@ -0,0 +1,8 @@ +#%Dialect 1.0 +dialect: Annotation mappings +version: "1.0" +documents: + root: + encodes: {} +annotationMappings: + aMapping: diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.expanded.jsonld new file mode 100644 index 00000000..9ec76349 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.expanded.jsonld @@ -0,0 +1,269 @@ +[ + { + "@id": "", + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": [ + { + "@value": "Annotation mappings" + } + ], + "core:version": [ + { + "@value": "1.0" + } + ], + "meta:documents": [ + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": [ + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Annotation mappings 1.0" + } + ], + "meta:encodedNode": [ + { + "@id": "http://amferror.com/#errorNodeMappable/null" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.yaml#/documents/root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,7)-(7,0)]" + } + ] + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:encodedNode" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,4)-(7,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.yaml/documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,0)-(7,0)]" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:rootDocument" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,2)-(7,0)]" + } + ] + } + ] + } + ] + } + ], + "doc:location": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.yaml" + } + ], + "doc:root": [ + { + "@value": true + } + ], + "doc:processingData": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": [ + { + "@value": false + } + ], + "doc:sourceSpec": [ + { + "@value": "AML 1.0" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:version" + } + ], + "sourcemaps:value": [ + { + "@value": "[(3,0)-(4,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(4,0)-(7,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.yaml" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(9,0)]" + } + ] + } + ] + } + ], + "doc:declares": [ + { + "@id": "#/declarations/aMapping", + "@type": [ + "meta:NodeAnnotationMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "aMapping" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/aMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/aMapping/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.yaml#/declarations/aMapping" + } + ], + "sourcemaps:value": [ + { + "@value": "[(8,2)-(9,0)]" + } + ] + }, + { + "@id": "#/declarations/aMapping/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(8,2)-(8,10)]" + } + ] + } + ] + } + ] + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.yaml", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#" + } + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.flattened.jsonld new file mode 100644 index 00000000..8c02728a --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.flattened.jsonld @@ -0,0 +1,207 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + }, + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map" + } + ] + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "Annotation mappings 1.0", + "meta:encodedNode": [ + { + "@id": "http://amferror.com/#errorNodeMappable/null" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map" + } + ] + }, + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1" + }, + { + "@id": "/documents#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.yaml/documents", + "sourcemaps:value": "[(5,0)-(7,0)]" + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": "meta:rootDocument", + "sourcemaps:value": "[(5,2)-(7,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.yaml#/documents/root", + "sourcemaps:value": "[(5,7)-(7,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": "meta:encodedNode", + "sourcemaps:value": "[(6,4)-(7,0)]" + }, + { + "@id": "", + "doc:declares": [ + { + "@id": "#/declarations/aMapping" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "Annotation mappings", + "core:version": "1.0", + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.yaml", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + }, + "sourcemaps:sources": [ + { + "@id": "#/source-map" + } + ] + }, + { + "@id": "#/declarations/aMapping", + "@type": [ + "meta:NodeAnnotationMapping", + "doc:DomainElement" + ], + "core:name": "aMapping", + "sourcemaps:sources": [ + { + "@id": "#/declarations/aMapping/source-map" + } + ] + }, + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_3" + }, + { + "@id": "#/source-map/lexical/element_1" + }, + { + "@id": "#/source-map/lexical/element_0" + }, + { + "@id": "#/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/aMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/aMapping/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/aMapping/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": "core:version", + "sourcemaps:value": "[(3,0)-(4,0)]" + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(2,0)-(3,0)]" + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": "meta:documents", + "sourcemaps:value": "[(4,0)-(7,0)]" + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.yaml", + "sourcemaps:value": "[(2,0)-(9,0)]" + }, + { + "@id": "#/declarations/aMapping/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.yaml#/declarations/aMapping", + "sourcemaps:value": "[(8,2)-(9,0)]" + }, + { + "@id": "#/declarations/aMapping/source-map/lexical/element_0", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(8,2)-(8,10)]" + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.yaml", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.yaml new file mode 100644 index 00000000..4ec20cb8 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-annotation-mapping/dialect.yaml @@ -0,0 +1,8 @@ +#%Dialect 1.0 +dialect: Annotation mappings +version: "1.0" +documents: + root: + encodes: {} +annotationMappings: + aMapping: diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-extends-on-node-mapping.validation.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-extends-on-node-mapping.validation.jsonld new file mode 100644 index 00000000..3dfdc56c --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-extends-on-node-mapping.validation.jsonld @@ -0,0 +1,136 @@ +{ + "@type": "http://www.w3.org/ns/shacl#ValidationReport", + "http://www.w3.org/ns/shacl#conforms": false, + "http://www.w3.org/ns/shacl#result": [ + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-extends-on-node-mapping.yaml" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Property: 'dialect' mandatory in a dialect node", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "http://a.ml/vocabularies/amf/aml#mandatory-property-shape" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 3, + "http://a.ml/vocabularies/amf/parser#column": 0 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 11, + "http://a.ml/vocabularies/amf/parser#column": 12 + } + } + }, + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-extends-on-node-mapping.yaml" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Property: 'version' mandatory in a dialect node", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "http://a.ml/vocabularies/amf/aml#mandatory-property-shape" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 3, + "http://a.ml/vocabularies/amf/parser#column": 0 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 11, + "http://a.ml/vocabularies/amf/parser#column": 12 + } + } + }, + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-extends-on-node-mapping.yaml#/declarations/otherMapping" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Property: 'propertyTerm' not supported in a nodeMapping node", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "http://a.ml/vocabularies/amf/aml#closed-shape" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 8, + "http://a.ml/vocabularies/amf/parser#column": 0 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 9, + "http://a.ml/vocabularies/amf/parser#column": 0 + } + } + }, + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-extends-on-node-mapping.yaml#/declarations/myNodeMapping" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Property: 'propertyTerm' not supported in a nodeMapping node", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "http://a.ml/vocabularies/amf/aml#closed-shape" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 10, + "http://a.ml/vocabularies/amf/parser#column": 0 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 11, + "http://a.ml/vocabularies/amf/parser#column": 12 + } + } + }, + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "" + }, + "http://www.w3.org/ns/shacl#resultMessage": "!!seq or !!str expected in 'extends', found [!!null]", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "http://a.ml/vocabularies/amf/core#syaml-error" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 11, + "http://a.ml/vocabularies/amf/parser#column": 12 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 11, + "http://a.ml/vocabularies/amf/parser#column": 12 + } + } + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-extends-on-node-mapping.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-extends-on-node-mapping.yaml new file mode 100644 index 00000000..7d6c104d --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-extends-on-node-mapping.yaml @@ -0,0 +1,11 @@ +#%Dialect 1.0 + +external: + schema-org: http://schema-org.com + +nodeMappings: + otherMapping: + propertyTerm: schema-org.other + myNodeMapping: + propertyTerm: schema-org.unreal + extends: \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.cycled.yaml new file mode 100644 index 00000000..a654d276 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.cycled.yaml @@ -0,0 +1,15 @@ +#%Dialect 1.0 +dialect: SemEx +version: "1.0" +documents: + root: + encodes: {} + +annotationMappings: + myNodeMapping: + propertyTerm: term + range: string + +extensions: + myExtension: myNodeMapping + otherExtension: diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.expanded.jsonld new file mode 100644 index 00000000..da1ea7e5 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.expanded.jsonld @@ -0,0 +1,432 @@ +[ + { + "@id": "", + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": [ + { + "@value": "SemEx" + } + ], + "core:version": [ + { + "@value": "1.0" + } + ], + "meta:extensions": [ + { + "@id": "/semantic-extensions/myExtension", + "@type": [ + "meta:ExtensionMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "myExtension" + } + ], + "meta:extensionMappingDefinition": [ + { + "@id": "#/declarations/myNodeMapping" + } + ], + "sourcemaps:sources": [ + { + "@id": "/semantic-extensions/myExtension#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/semantic-extensions/myExtension#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(14,2)-(14,13)]" + } + ] + }, + { + "@id": "/semantic-extensions/myExtension#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:extensionMappingDefinition" + } + ], + "sourcemaps:value": [ + { + "@value": "[(14,2)-(15,0)]" + } + ] + }, + { + "@id": "/semantic-extensions/myExtension#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.yaml/semantic-extensions/myExtension" + } + ], + "sourcemaps:value": [ + { + "@value": "[(14,2)-(15,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "/semantic-extensions/otherExtension", + "@type": [ + "meta:ExtensionMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "otherExtension" + } + ], + "sourcemaps:sources": [ + { + "@id": "/semantic-extensions/otherExtension#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/semantic-extensions/otherExtension#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.yaml/semantic-extensions/otherExtension" + } + ], + "sourcemaps:value": [ + { + "@value": "[(15,2)-(16,0)]" + } + ] + }, + { + "@id": "/semantic-extensions/otherExtension#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(15,2)-(15,16)]" + } + ] + } + ] + } + ] + } + ], + "meta:documents": [ + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": [ + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "SemEx 1.0" + } + ], + "meta:encodedNode": [ + { + "@id": "http://amferror.com/#errorNodeMappable/null" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.yaml#/documents/root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,7)-(8,0)]" + } + ] + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:encodedNode" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,4)-(8,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.yaml/documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,0)-(8,0)]" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:rootDocument" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,2)-(8,0)]" + } + ] + } + ] + } + ] + } + ], + "doc:location": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.yaml" + } + ], + "doc:root": [ + { + "@value": true + } + ], + "doc:processingData": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": [ + { + "@value": false + } + ], + "doc:sourceSpec": [ + { + "@value": "AML 1.0" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:virtual-element": [ + { + "@id": "#/source-map/virtual-element/element_0", + "sourcemaps:element": [ + { + "@value": "meta:extensions" + } + ], + "sourcemaps:value": [ + { + "@value": "true" + } + ] + } + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_4", + "sourcemaps:element": [ + { + "@value": "meta:extensions" + } + ], + "sourcemaps:value": [ + { + "@value": "[(13,0)-(16,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.yaml" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(16,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(4,0)-(8,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:version" + } + ], + "sourcemaps:value": [ + { + "@value": "[(3,0)-(4,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + } + ] + } + ], + "doc:declares": [ + { + "@id": "#/declarations/myNodeMapping", + "@type": [ + "meta:NodeAnnotationMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "myNodeMapping" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/myNodeMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/myNodeMapping/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,2)-(9,15)]" + } + ] + }, + { + "@id": "#/declarations/myNodeMapping/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(11,4)-(13,0)]" + } + ] + }, + { + "@id": "#/declarations/myNodeMapping/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.yaml#/declarations/myNodeMapping" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,2)-(13,0)]" + } + ] + } + ] + } + ] + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#" + } + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.flattened.jsonld new file mode 100644 index 00000000..98261cd4 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.flattened.jsonld @@ -0,0 +1,334 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + }, + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map" + } + ] + }, + { + "@id": "/semantic-extensions/myExtension", + "@type": [ + "meta:ExtensionMapping", + "doc:DomainElement" + ], + "core:name": "myExtension", + "meta:extensionMappingDefinition": [ + { + "@id": "#/declarations/myNodeMapping" + } + ], + "sourcemaps:sources": [ + { + "@id": "/semantic-extensions/myExtension#/source-map" + } + ] + }, + { + "@id": "/semantic-extensions/otherExtension", + "@type": [ + "meta:ExtensionMapping", + "doc:DomainElement" + ], + "core:name": "otherExtension", + "sourcemaps:sources": [ + { + "@id": "/semantic-extensions/otherExtension#/source-map" + } + ] + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "SemEx 1.0", + "meta:encodedNode": [ + { + "@id": "http://amferror.com/#errorNodeMappable/null" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map" + } + ] + }, + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1" + }, + { + "@id": "/documents#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/semantic-extensions/myExtension#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/semantic-extensions/myExtension#/source-map/lexical/element_2" + }, + { + "@id": "/semantic-extensions/myExtension#/source-map/lexical/element_0" + }, + { + "@id": "/semantic-extensions/myExtension#/source-map/lexical/element_1" + } + ] + }, + { + "@id": "/semantic-extensions/otherExtension#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/semantic-extensions/otherExtension#/source-map/lexical/element_1" + }, + { + "@id": "/semantic-extensions/otherExtension#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.yaml/documents", + "sourcemaps:value": "[(5,0)-(8,0)]" + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": "meta:rootDocument", + "sourcemaps:value": "[(5,2)-(8,0)]" + }, + { + "@id": "/semantic-extensions/myExtension#/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(14,2)-(14,13)]" + }, + { + "@id": "/semantic-extensions/myExtension#/source-map/lexical/element_0", + "sourcemaps:element": "meta:extensionMappingDefinition", + "sourcemaps:value": "[(14,2)-(15,0)]" + }, + { + "@id": "/semantic-extensions/myExtension#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.yaml/semantic-extensions/myExtension", + "sourcemaps:value": "[(14,2)-(15,0)]" + }, + { + "@id": "/semantic-extensions/otherExtension#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.yaml/semantic-extensions/otherExtension", + "sourcemaps:value": "[(15,2)-(16,0)]" + }, + { + "@id": "/semantic-extensions/otherExtension#/source-map/lexical/element_0", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(15,2)-(15,16)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.yaml#/documents/root", + "sourcemaps:value": "[(5,7)-(8,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": "meta:encodedNode", + "sourcemaps:value": "[(6,4)-(8,0)]" + }, + { + "@id": "", + "doc:declares": [ + { + "@id": "#/declarations/myNodeMapping" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "SemEx", + "core:version": "1.0", + "meta:extensions": [ + { + "@id": "/semantic-extensions/myExtension" + }, + { + "@id": "/semantic-extensions/otherExtension" + } + ], + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.yaml", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + }, + "sourcemaps:sources": [ + { + "@id": "#/source-map" + } + ] + }, + { + "@id": "#/declarations/myNodeMapping", + "@type": [ + "meta:NodeAnnotationMapping", + "doc:DomainElement" + ], + "core:name": "myNodeMapping", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/myNodeMapping/source-map" + } + ] + }, + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:virtual-element": [ + { + "@id": "#/source-map/virtual-element/element_0" + } + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_4" + }, + { + "@id": "#/source-map/lexical/element_2" + }, + { + "@id": "#/source-map/lexical/element_0" + }, + { + "@id": "#/source-map/lexical/element_1" + }, + { + "@id": "#/source-map/lexical/element_3" + } + ] + }, + { + "@id": "#/declarations/myNodeMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/myNodeMapping/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/myNodeMapping/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/myNodeMapping/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/source-map/virtual-element/element_0", + "sourcemaps:element": "meta:extensions", + "sourcemaps:value": "true" + }, + { + "@id": "#/source-map/lexical/element_4", + "sourcemaps:element": "meta:extensions", + "sourcemaps:value": "[(13,0)-(16,0)]" + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.yaml", + "sourcemaps:value": "[(2,0)-(16,0)]" + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": "meta:documents", + "sourcemaps:value": "[(4,0)-(8,0)]" + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": "core:version", + "sourcemaps:value": "[(3,0)-(4,0)]" + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(2,0)-(3,0)]" + }, + { + "@id": "#/declarations/myNodeMapping/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(9,2)-(9,15)]" + }, + { + "@id": "#/declarations/myNodeMapping/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(11,4)-(13,0)]" + }, + { + "@id": "#/declarations/myNodeMapping/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.yaml#/declarations/myNodeMapping", + "sourcemaps:value": "[(9,2)-(13,0)]" + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.yaml new file mode 100644 index 00000000..a654d276 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/empty-semantic-extensions/dialect.yaml @@ -0,0 +1,15 @@ +#%Dialect 1.0 +dialect: SemEx +version: "1.0" +documents: + root: + encodes: {} + +annotationMappings: + myNodeMapping: + propertyTerm: term + range: string + +extensions: + myExtension: myNodeMapping + otherExtension: diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-dialect-validation-incorrect-type/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-dialect-validation-incorrect-type/dialect.yaml new file mode 100644 index 00000000..8c9f1221 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-dialect-validation-incorrect-type/dialect.yaml @@ -0,0 +1,16 @@ +#%Dialect 1.0 +dialect: SemEx +version: "1.0" +documents: + root: + encodes: MultipleEnums + +nodeMappings: + MultipleEnums: + mapping: + a: + range: number + enum: + - 2.0 + - Pepito + diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-dialect-validation-incorrect-type/report.json b/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-dialect-validation-incorrect-type/report.json new file mode 100644 index 00000000..4c5fc7c2 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-dialect-validation-incorrect-type/report.json @@ -0,0 +1,64 @@ +{ + "@type": "http://www.w3.org/ns/shacl#ValidationReport", + "http://www.w3.org/ns/shacl#conforms": false, + "http://www.w3.org/ns/shacl#result": [ + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "anId" + }, + "http://www.w3.org/ns/shacl#resultPath": { + "@id": "http://a.ml/vocabularies/data#a" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Cannot find expected range for property http://a.ml/vocabularies/data#a (a). Found 'http://www.w3.org/2001/XMLSchema#string', expected 'http://a.ml/vocabularies/shapes#number'", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "http://a.ml/vocabularies/amf/aml#inconsistent-property-range-value" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 15, + "http://a.ml/vocabularies/amf/parser#column": 12 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 15, + "http://a.ml/vocabularies/amf/parser#column": 18 + } + } + }, + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-dialect-validation-incorrect-type/dialect.yaml" + }, + "http://www.w3.org/ns/shacl#resultPath": { + "@id": "http://a.ml/vocabularies/data#a" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Property 'a' value must be of type http://www.w3.org/2001/XMLSchema#integer or http://www.w3.org/2001/XMLSchema#float", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-dialect-validation-incorrect-type/dialect.yaml#/declarations/MultipleEnums_a_dialectRange_validation" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 15, + "http://a.ml/vocabularies/amf/parser#column": 12 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 15, + "http://a.ml/vocabularies/amf/parser#column": 18 + } + } + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-dialect-validation/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-dialect-validation/dialect.yaml new file mode 100644 index 00000000..5cdb6016 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-dialect-validation/dialect.yaml @@ -0,0 +1,19 @@ +#%Dialect 1.0 +dialect: SemEx +version: "1.0" +documents: + root: + encodes: MultipleEnums + +nodeMappings: + MultipleEnums: + mapping: + a: + range: number + minimum: 3.01 + maximum: 8.01 + enum: + - 2.0 + - 7.0 + - 10.0 + diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-dialect-validation/report.json b/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-dialect-validation/report.json new file mode 100644 index 00000000..7c67ba14 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-dialect-validation/report.json @@ -0,0 +1,64 @@ +{ + "@type": "http://www.w3.org/ns/shacl#ValidationReport", + "http://www.w3.org/ns/shacl#conforms": false, + "http://www.w3.org/ns/shacl#result": [ + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-dialect-validation/dialect.yaml" + }, + "http://www.w3.org/ns/shacl#resultPath": { + "@id": "http://a.ml/vocabularies/data#a" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Property 'a' minimum inclusive value is 3.01", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-dialect-validation/dialect.yaml#/declarations/MultipleEnums_a_minimum_validation" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 16, + "http://a.ml/vocabularies/amf/parser#column": 12 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 16, + "http://a.ml/vocabularies/amf/parser#column": 15 + } + } + }, + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-dialect-validation/dialect.yaml" + }, + "http://www.w3.org/ns/shacl#resultPath": { + "@id": "http://a.ml/vocabularies/data#a" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Property 'a' maximum inclusive value is 8.01", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-dialect-validation/dialect.yaml#/declarations/MultipleEnums_a_maximum_validation" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 18, + "http://a.ml/vocabularies/amf/parser#column": 12 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 18, + "http://a.ml/vocabularies/amf/parser#column": 16 + } + } + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.cycled.yaml new file mode 100644 index 00000000..0bd7f2b2 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.cycled.yaml @@ -0,0 +1,16 @@ +#%Dialect 1.0 +dialect: SemEx +version: "1.0" +documents: + root: + encodes: MultipleEnums +nodeMappings: + MultipleEnums: + mapping: + a: + range: any + enum: + - a + - true + - 5 + - 18.623 diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.expanded.jsonld new file mode 100644 index 00000000..d676b7a3 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.expanded.jsonld @@ -0,0 +1,402 @@ +[ + { + "@id": "", + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": [ + { + "@value": "SemEx" + } + ], + "core:version": [ + { + "@value": "1.0" + } + ], + "meta:documents": [ + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": [ + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "SemEx 1.0" + } + ], + "meta:encodedNode": [ + { + "@id": "#/declarations/MultipleEnums" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.yaml#/documents/root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,7)-(8,0)]" + } + ] + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:encodedNode" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,4)-(8,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.yaml/documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,0)-(8,0)]" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:rootDocument" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,2)-(8,0)]" + } + ] + } + ] + } + ] + } + ], + "doc:location": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.yaml" + } + ], + "doc:root": [ + { + "@value": true + } + ], + "doc:processingData": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": [ + { + "@value": false + } + ], + "doc:sourceSpec": [ + { + "@value": "AML 1.0" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:version" + } + ], + "sourcemaps:value": [ + { + "@value": "[(3,0)-(4,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(4,0)-(8,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.yaml" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(18,0)]" + } + ] + } + ] + } + ], + "doc:declares": [ + { + "@id": "#/declarations/MultipleEnums", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "MultipleEnums" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/MultipleEnums/property/a", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#a" + } + ], + "core:name": [ + { + "@value": "a" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "shacl:in": [ + { + "@id": "#/declarations/MultipleEnums/property/a/list", + "@type": "rdfs:Seq", + "rdfs:_1": [ + { + "@value": "a", + "@type": "xsd:string" + } + ], + "rdfs:_2": [ + { + "@value": "true", + "@type": "xsd:boolean" + } + ], + "rdfs:_3": [ + { + "@value": "5", + "@type": "xsd:integer" + } + ], + "rdfs:_4": [ + { + "@value": "18.623", + "@type": "xsd:double" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/MultipleEnums/property/a/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/MultipleEnums/property/a/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(12,8)-(13,0)]" + } + ] + }, + { + "@id": "#/declarations/MultipleEnums/property/a/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(11,6)-(11,7)]" + } + ] + }, + { + "@id": "#/declarations/MultipleEnums/property/a/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:in" + } + ], + "sourcemaps:value": [ + { + "@value": "[(13,8)-(18,0)]" + } + ] + }, + { + "@id": "#/declarations/MultipleEnums/property/a/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.yaml#/declarations/MultipleEnums/property/a" + } + ], + "sourcemaps:value": [ + { + "@value": "[(11,8)-(18,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/MultipleEnums/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/MultipleEnums/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,2)-(9,15)]" + } + ] + }, + { + "@id": "#/declarations/MultipleEnums/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(10,4)-(18,0)]" + } + ] + }, + { + "@id": "#/declarations/MultipleEnums/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.yaml#/declarations/MultipleEnums" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,2)-(18,0)]" + } + ] + } + ] + } + ] + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#", + "xsd": "http://www.w3.org/2001/XMLSchema#" + } + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.flattened.jsonld new file mode 100644 index 00000000..1e27907d --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.flattened.jsonld @@ -0,0 +1,310 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + }, + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map" + } + ] + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "SemEx 1.0", + "meta:encodedNode": [ + { + "@id": "#/declarations/MultipleEnums" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map" + } + ] + }, + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1" + }, + { + "@id": "/documents#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.yaml/documents", + "sourcemaps:value": "[(5,0)-(8,0)]" + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": "meta:rootDocument", + "sourcemaps:value": "[(5,2)-(8,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.yaml#/documents/root", + "sourcemaps:value": "[(5,7)-(8,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": "meta:encodedNode", + "sourcemaps:value": "[(6,4)-(8,0)]" + }, + { + "@id": "", + "doc:declares": [ + { + "@id": "#/declarations/MultipleEnums" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "SemEx", + "core:version": "1.0", + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.yaml", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + }, + "sourcemaps:sources": [ + { + "@id": "#/source-map" + } + ] + }, + { + "@id": "#/declarations/MultipleEnums", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "MultipleEnums", + "shacl:property": [ + { + "@id": "#/declarations/MultipleEnums/property/a" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/MultipleEnums/source-map" + } + ] + }, + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_3" + }, + { + "@id": "#/source-map/lexical/element_1" + }, + { + "@id": "#/source-map/lexical/element_0" + }, + { + "@id": "#/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/MultipleEnums/property/a", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#a" + } + ], + "core:name": "a", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "shacl:in": { + "@id": "#/declarations/MultipleEnums/property/a/list" + }, + "sourcemaps:sources": [ + { + "@id": "#/declarations/MultipleEnums/property/a/source-map" + } + ] + }, + { + "@id": "#/declarations/MultipleEnums/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/MultipleEnums/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/MultipleEnums/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/MultipleEnums/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": "core:version", + "sourcemaps:value": "[(3,0)-(4,0)]" + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(2,0)-(3,0)]" + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": "meta:documents", + "sourcemaps:value": "[(4,0)-(8,0)]" + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.yaml", + "sourcemaps:value": "[(2,0)-(18,0)]" + }, + { + "@id": "#/declarations/MultipleEnums/property/a/list", + "@type": "rdfs:Seq", + "rdfs:_1": { + "@value": "a", + "@type": "xsd:string" + }, + "rdfs:_2": { + "@value": "true", + "@type": "xsd:boolean" + }, + "rdfs:_3": { + "@value": "5", + "@type": "xsd:integer" + }, + "rdfs:_4": { + "@value": "18.623", + "@type": "xsd:double" + } + }, + { + "@id": "#/declarations/MultipleEnums/property/a/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/MultipleEnums/property/a/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/MultipleEnums/property/a/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/MultipleEnums/property/a/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/MultipleEnums/property/a/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/MultipleEnums/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(9,2)-(9,15)]" + }, + { + "@id": "#/declarations/MultipleEnums/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(10,4)-(18,0)]" + }, + { + "@id": "#/declarations/MultipleEnums/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.yaml#/declarations/MultipleEnums", + "sourcemaps:value": "[(9,2)-(18,0)]" + }, + { + "@id": "#/declarations/MultipleEnums/property/a/source-map/lexical/element_3", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(12,8)-(13,0)]" + }, + { + "@id": "#/declarations/MultipleEnums/property/a/source-map/lexical/element_1", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(11,6)-(11,7)]" + }, + { + "@id": "#/declarations/MultipleEnums/property/a/source-map/lexical/element_0", + "sourcemaps:element": "shacl:in", + "sourcemaps:value": "[(13,8)-(18,0)]" + }, + { + "@id": "#/declarations/MultipleEnums/property/a/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.yaml#/declarations/MultipleEnums/property/a", + "sourcemaps:value": "[(11,8)-(18,0)]" + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#", + "xsd": "http://www.w3.org/2001/XMLSchema#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.yaml new file mode 100644 index 00000000..f4a47015 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/enum-scalars/dialect.yaml @@ -0,0 +1,17 @@ +#%Dialect 1.0 +dialect: SemEx +version: "1.0" +documents: + root: + encodes: MultipleEnums + +nodeMappings: + MultipleEnums: + mapping: + a: + range: any + enum: + - "a" + - true + - 5 + - 18.623 diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.expanded.jsonld index 04cda70d..2cd09e8e 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.expanded.jsonld @@ -233,21 +233,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.yaml" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "vocab2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.yaml#/source-map/lexical/element_3", @@ -301,6 +286,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "vocab2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" + } + ] + } ] } ], @@ -424,6 +424,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/lexical/element_2", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.flattened.jsonld index cc5331cc..8302230c 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.flattened.jsonld @@ -271,11 +271,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.yaml#/source-map/aliases-array/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.yaml#/source-map/lexical/element_3" @@ -289,6 +284,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.yaml#/source-map/lexical/element_2" } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.yaml#/source-map/aliases-array/element_0" + } ] }, { @@ -330,6 +330,11 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/lexical/element_2" @@ -422,11 +427,6 @@ } ] }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.yaml", - "http://a.ml/vocabularies/document-source-maps#value": "vocab2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.yaml#/source-map/lexical/element_3", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#version", @@ -447,6 +447,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.yaml", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(24,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "vocab2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" + }, { "@id": "http://a.ml/vocabularies/vocab2#A/source-map", "@type": [ @@ -469,6 +474,11 @@ } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#declares", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.expanded.jsonld index 6df7ebf2..3df0bd11 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.expanded.jsonld @@ -221,21 +221,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.yaml" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::mappings_lib.yaml" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.yaml#/source-map/lexical/element_4", @@ -302,6 +287,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::mappings_lib.yaml" + } + ] + } ] } ], @@ -574,6 +574,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/lexical/element_0", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.flattened.jsonld index 15e73473..ee58172f 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.flattened.jsonld @@ -236,11 +236,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.yaml#/source-map/aliases-array/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.yaml#/source-map/lexical/element_4" @@ -257,6 +252,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.yaml#/source-map/lexical/element_3" } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.yaml#/source-map/aliases-array/element_0" + } ] }, { @@ -311,6 +311,11 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/lexical/element_0" @@ -355,11 +360,6 @@ } ] }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.yaml", - "http://a.ml/vocabularies/document-source-maps#value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::mappings_lib.yaml" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.yaml#/source-map/lexical/element_4", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#externals", @@ -385,6 +385,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(3,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::mappings_lib.yaml" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml/externals/v2#/source-map", "@type": [ @@ -442,6 +447,11 @@ } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#declares", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.rdf-cycled.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.rdf-cycled.expanded.jsonld index 1166da8e..c216a301 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.rdf-cycled.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.rdf-cycled.expanded.jsonld @@ -573,6 +573,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/lexical/element_0", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.rdf-cycled.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.rdf-cycled.flattened.jsonld index 34179a17..3507f8af 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.rdf-cycled.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example13.rdf-cycled.flattened.jsonld @@ -310,6 +310,11 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/lexical/element_0" @@ -441,6 +446,11 @@ } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#declares", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.expanded.jsonld index 4a6b2236..caee8ec0 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.expanded.jsonld @@ -302,21 +302,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "vocab2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/source-map/lexical/element_4", @@ -383,6 +368,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "vocab2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" + } + ] + } ] } ], @@ -506,6 +506,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/lexical/element_2", @@ -592,7 +607,7 @@ "@value": "(schema-org.za)" } ], - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeB/property/zaschema-org/AnnotationInfo((schema-org.za),schema-org.za,Some(schema-org),za,(schema-org.za): 101).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeB/property/zaschema-org/za/scalar_1", "@type": [ "http://a.ml/vocabularies/data#Scalar", "http://a.ml/vocabularies/data#Node", @@ -615,16 +630,16 @@ ], "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeB/property/zaschema-org/AnnotationInfo((schema-org.za),schema-org.za,Some(schema-org),za,(schema-org.za): 101).suffix/scalar_1/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeB/property/zaschema-org/za/scalar_1/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeB/property/zaschema-org/AnnotationInfo((schema-org.za),schema-org.za,Some(schema-org),za,(schema-org.za): 101).suffix/scalar_1/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeB/property/zaschema-org/za/scalar_1/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeB/property/zaschema-org/AnnotationInfo((schema-org.za),schema-org.za,Some(schema-org),za,(schema-org.za): 101).suffix/scalar_1" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeB/property/zaschema-org/za/scalar_1" } ], "http://a.ml/vocabularies/document-source-maps#value": [ @@ -699,7 +714,7 @@ "@value": "(schema-org.nodeB)" } ], - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeBschema-org/AnnotationInfo((schema-org.nodeB),schema-org.nodeB,Some(schema-org),nodeB,(schema-org.nodeB): true).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeBschema-org/nodeB/scalar_1", "@type": [ "http://a.ml/vocabularies/data#Scalar", "http://a.ml/vocabularies/data#Node", @@ -722,16 +737,16 @@ ], "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeBschema-org/AnnotationInfo((schema-org.nodeB),schema-org.nodeB,Some(schema-org),nodeB,(schema-org.nodeB): true).suffix/scalar_1/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeBschema-org/nodeB/scalar_1/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeBschema-org/AnnotationInfo((schema-org.nodeB),schema-org.nodeB,Some(schema-org),nodeB,(schema-org.nodeB): true).suffix/scalar_1/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeBschema-org/nodeB/scalar_1/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeBschema-org/AnnotationInfo((schema-org.nodeB),schema-org.nodeB,Some(schema-org),nodeB,(schema-org.nodeB): true).suffix/scalar_1" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeBschema-org/nodeB/scalar_1" } ], "http://a.ml/vocabularies/document-source-maps#value": [ @@ -844,7 +859,7 @@ "@value": "vocab2.a" } ], - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeA/property/a/vocab2/AnnotationInfo((vocab2.a),vocab2.a,Some(vocab2),a,(vocab2.a): true).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeA/property/a/vocab2/a/scalar_1", "@type": [ "http://a.ml/vocabularies/data#Scalar", "http://a.ml/vocabularies/data#Node", @@ -867,16 +882,16 @@ ], "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeA/property/a/vocab2/AnnotationInfo((vocab2.a),vocab2.a,Some(vocab2),a,(vocab2.a): true).suffix/scalar_1/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeA/property/a/vocab2/a/scalar_1/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeA/property/a/vocab2/AnnotationInfo((vocab2.a),vocab2.a,Some(vocab2),a,(vocab2.a): true).suffix/scalar_1/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeA/property/a/vocab2/a/scalar_1/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeA/property/a/vocab2/AnnotationInfo((vocab2.a),vocab2.a,Some(vocab2),a,(vocab2.a): true).suffix/scalar_1" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeA/property/a/vocab2/a/scalar_1" } ], "http://a.ml/vocabularies/document-source-maps#value": [ diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.flattened.jsonld index 61524a32..e8c69ced 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.flattened.jsonld @@ -289,7 +289,7 @@ } ], "http://schema.org/nodeB": { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeBschema-org/AnnotationInfo((schema-org.nodeB),schema-org.nodeB,Some(schema-org),nodeB,(schema-org.nodeB): true).suffix/scalar_1" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeBschema-org/nodeB/scalar_1" }, "http://a.ml/vocabularies/document#customDomainProperties": [ { @@ -331,11 +331,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/source-map/aliases-array/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/source-map/lexical/element_4" @@ -352,6 +347,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/source-map/lexical/element_3" } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/source-map/aliases-array/element_0" + } ] }, { @@ -393,6 +393,11 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/lexical/element_2" @@ -418,7 +423,7 @@ ], "http://a.ml/vocabularies/core#name": "za", "http://schema.org/za": { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeB/property/zaschema-org/AnnotationInfo((schema-org.za),schema-org.za,Some(schema-org),za,(schema-org.za): 101).suffix/scalar_1" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeB/property/zaschema-org/za/scalar_1" }, "http://a.ml/vocabularies/document#customDomainProperties": [ { @@ -433,7 +438,7 @@ }, { "http://a.ml/vocabularies/core#extensionName": "(schema-org.nodeB)", - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeBschema-org/AnnotationInfo((schema-org.nodeB),schema-org.nodeB,Some(schema-org),nodeB,(schema-org.nodeB): true).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeBschema-org/nodeB/scalar_1", "@type": [ "http://a.ml/vocabularies/data#Scalar", "http://a.ml/vocabularies/data#Node", @@ -448,7 +453,7 @@ "http://a.ml/vocabularies/core#name": "scalar_1", "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeBschema-org/AnnotationInfo((schema-org.nodeB),schema-org.nodeB,Some(schema-org),nodeB,(schema-org.nodeB): true).suffix/scalar_1/source-map" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeBschema-org/nodeB/scalar_1/source-map" } ] }, @@ -487,7 +492,7 @@ } ], "http://a.ml/vocabularies/vocab2#a": { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeA/property/a/vocab2/AnnotationInfo((vocab2.a),vocab2.a,Some(vocab2),a,(vocab2.a): true).suffix/scalar_1" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeA/property/a/vocab2/a/scalar_1" }, "http://a.ml/vocabularies/document#customDomainProperties": [ { @@ -517,11 +522,6 @@ } ] }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml", - "http://a.ml/vocabularies/document-source-maps#value": "vocab2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/source-map/lexical/element_4", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#externals", @@ -547,6 +547,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(3,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "vocab2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" + }, { "@id": "http://a.ml/vocabularies/vocab2#A/source-map", "@type": [ @@ -569,6 +574,11 @@ } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#declares", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", @@ -586,7 +596,7 @@ }, { "http://a.ml/vocabularies/core#extensionName": "(schema-org.za)", - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeB/property/zaschema-org/AnnotationInfo((schema-org.za),schema-org.za,Some(schema-org),za,(schema-org.za): 101).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeB/property/zaschema-org/za/scalar_1", "@type": [ "http://a.ml/vocabularies/data#Scalar", "http://a.ml/vocabularies/data#Node", @@ -601,7 +611,7 @@ "http://a.ml/vocabularies/core#name": "scalar_1", "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeB/property/zaschema-org/AnnotationInfo((schema-org.za),schema-org.za,Some(schema-org),za,(schema-org.za): 101).suffix/scalar_1/source-map" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeB/property/zaschema-org/za/scalar_1/source-map" } ] }, @@ -623,13 +633,13 @@ ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeBschema-org/AnnotationInfo((schema-org.nodeB),schema-org.nodeB,Some(schema-org),nodeB,(schema-org.nodeB): true).suffix/scalar_1/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeBschema-org/nodeB/scalar_1/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeBschema-org/AnnotationInfo((schema-org.nodeB),schema-org.nodeB,Some(schema-org),nodeB,(schema-org.nodeB): true).suffix/scalar_1/source-map/lexical/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeBschema-org/nodeB/scalar_1/source-map/lexical/element_0" } ] }, @@ -650,7 +660,7 @@ }, { "http://a.ml/vocabularies/core#extensionName": "vocab2.a", - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeA/property/a/vocab2/AnnotationInfo((vocab2.a),vocab2.a,Some(vocab2),a,(vocab2.a): true).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeA/property/a/vocab2/a/scalar_1", "@type": [ "http://a.ml/vocabularies/data#Scalar", "http://a.ml/vocabularies/data#Node", @@ -665,7 +675,7 @@ "http://a.ml/vocabularies/core#name": "scalar_1", "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeA/property/a/vocab2/AnnotationInfo((vocab2.a),vocab2.a,Some(vocab2),a,(vocab2.a): true).suffix/scalar_1/source-map" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeA/property/a/vocab2/a/scalar_1/source-map" } ] }, @@ -715,13 +725,13 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(8,2)-(8,4)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeB/property/zaschema-org/AnnotationInfo((schema-org.za),schema-org.za,Some(schema-org),za,(schema-org.za): 101).suffix/scalar_1/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeB/property/zaschema-org/za/scalar_1/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeB/property/zaschema-org/AnnotationInfo((schema-org.za),schema-org.za,Some(schema-org),za,(schema-org.za): 101).suffix/scalar_1/source-map/lexical/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeB/property/zaschema-org/za/scalar_1/source-map/lexical/element_0" } ] }, @@ -741,18 +751,18 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(10,9)-(13,0)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeBschema-org/AnnotationInfo((schema-org.nodeB),schema-org.nodeB,Some(schema-org),nodeB,(schema-org.nodeB): true).suffix/scalar_1/source-map/lexical/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeBschema-org/AnnotationInfo((schema-org.nodeB),schema-org.nodeB,Some(schema-org),nodeB,(schema-org.nodeB): true).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeBschema-org/nodeB/scalar_1/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeBschema-org/nodeB/scalar_1", "http://a.ml/vocabularies/document-source-maps#value": "[(7,24)-(7,28)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeA/property/a/vocab2/AnnotationInfo((vocab2.a),vocab2.a,Some(vocab2),a,(vocab2.a): true).suffix/scalar_1/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeA/property/a/vocab2/a/scalar_1/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeA/property/a/vocab2/AnnotationInfo((vocab2.a),vocab2.a,Some(vocab2),a,(vocab2.a): true).suffix/scalar_1/source-map/lexical/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeA/property/a/vocab2/a/scalar_1/source-map/lexical/element_0" } ] }, @@ -777,13 +787,13 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(16,8)-(20,0)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeB/property/zaschema-org/AnnotationInfo((schema-org.za),schema-org.za,Some(schema-org),za,(schema-org.za): 101).suffix/scalar_1/source-map/lexical/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeB/property/zaschema-org/AnnotationInfo((schema-org.za),schema-org.za,Some(schema-org),za,(schema-org.za): 101).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeB/property/zaschema-org/za/scalar_1/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeB/property/zaschema-org/za/scalar_1", "http://a.ml/vocabularies/document-source-maps#value": "[(11,25)-(11,28)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeA/property/a/vocab2/AnnotationInfo((vocab2.a),vocab2.a,Some(vocab2),a,(vocab2.a): true).suffix/scalar_1/source-map/lexical/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeA/property/a/vocab2/AnnotationInfo((vocab2.a),vocab2.a,Some(vocab2),a,(vocab2.a): true).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeA/property/a/vocab2/a/scalar_1/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example1b.yaml#/declarations/nodeA/property/a/vocab2/a/scalar_1", "http://a.ml/vocabularies/document-source-maps#value": "[(17,20)-(17,24)]" } ] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.expanded.jsonld index cd25c4d7..76d89332 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.expanded.jsonld @@ -205,21 +205,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.yaml" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "vocab2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.yaml#/source-map/lexical/element_3", @@ -273,6 +258,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "vocab2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" + } + ] + } ] } ], @@ -396,6 +396,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/lexical/element_2", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.flattened.jsonld index d9da944a..30b687cf 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.flattened.jsonld @@ -255,11 +255,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.yaml#/source-map/aliases-array/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.yaml#/source-map/lexical/element_3" @@ -273,6 +268,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.yaml#/source-map/lexical/element_2" } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.yaml#/source-map/aliases-array/element_0" + } ] }, { @@ -314,6 +314,11 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/lexical/element_2" @@ -404,11 +409,6 @@ } ] }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.yaml", - "http://a.ml/vocabularies/document-source-maps#value": "vocab2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.yaml#/source-map/lexical/element_3", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#version", @@ -429,6 +429,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.yaml", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(24,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example2.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "vocab2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" + }, { "@id": "http://a.ml/vocabularies/vocab2#A/source-map", "@type": [ @@ -451,6 +456,11 @@ } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#declares", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.expanded.jsonld index d50837f3..3f23a21e 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.expanded.jsonld @@ -396,7 +396,7 @@ ], "http://a.ml/vocabularies/document#extends": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Other/Other", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Other/Other-link-extends-0", "@type": [ "http://a.ml/vocabularies/meta#NodeMapping", "http://www.w3.org/ns/shacl#Shape", @@ -419,16 +419,16 @@ ], "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Other/Other/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Other/Other-link-extends-0/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Other/Other/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Other/Other-link-extends-0/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Other/Other" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Other/Other-link-extends-0" } ], "http://a.ml/vocabularies/document-source-maps#value": [ @@ -681,7 +681,7 @@ ], "http://a.ml/vocabularies/document#extends": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root-link-extends-0", "@type": [ "http://a.ml/vocabularies/meta#NodeMapping", "http://www.w3.org/ns/shacl#Shape", @@ -704,16 +704,16 @@ ], "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root-link-extends-0/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root/source-map/lexical/element_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root-link-extends-0/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root-link-extends-0" } ], "http://a.ml/vocabularies/document-source-maps#value": [ @@ -723,7 +723,7 @@ ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root-link-extends-0/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/core#name" @@ -1201,7 +1201,7 @@ ], "http://a.ml/vocabularies/document#extends": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base-link-extends-0", "@type": [ "http://a.ml/vocabularies/meta#NodeMapping", "http://www.w3.org/ns/shacl#Shape", @@ -1224,16 +1224,16 @@ ], "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base-link-extends-0/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base/source-map/lexical/element_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base-link-extends-0/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base-link-extends-0" } ], "http://a.ml/vocabularies/document-source-maps#value": [ @@ -1243,7 +1243,7 @@ ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base-link-extends-0/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/core#name" diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.flattened.jsonld index ba2fd37d..188383f9 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.flattened.jsonld @@ -203,7 +203,7 @@ ], "http://a.ml/vocabularies/document#extends": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Other/Other" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Other/Other-link-extends-0" } ], "http://a.ml/vocabularies/document-source-maps#sources": [ @@ -235,7 +235,7 @@ ], "http://a.ml/vocabularies/document#extends": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root-link-extends-0" } ], "http://a.ml/vocabularies/document-source-maps#sources": [ @@ -312,7 +312,7 @@ ], "http://a.ml/vocabularies/document#extends": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base-link-extends-0" } ], "http://a.ml/vocabularies/document-source-maps#sources": [ @@ -368,7 +368,7 @@ ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Other/Other", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Other/Other-link-extends-0", "@type": [ "http://a.ml/vocabularies/meta#NodeMapping", "http://www.w3.org/ns/shacl#Shape", @@ -383,7 +383,7 @@ "http://a.ml/vocabularies/document#link-label": "Forward", "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Other/Other/source-map" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Other/Other-link-extends-0/source-map" } ] }, @@ -451,7 +451,7 @@ ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root-link-extends-0", "@type": [ "http://a.ml/vocabularies/meta#NodeMapping", "http://www.w3.org/ns/shacl#Shape", @@ -466,7 +466,7 @@ "http://a.ml/vocabularies/document#link-label": "Base", "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root/source-map" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root-link-extends-0/source-map" } ] }, @@ -591,7 +591,7 @@ ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base-link-extends-0", "@type": [ "http://a.ml/vocabularies/meta#NodeMapping", "http://www.w3.org/ns/shacl#Shape", @@ -606,7 +606,7 @@ "http://a.ml/vocabularies/document#link-label": "Simple", "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base/source-map" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base-link-extends-0/source-map" } ] }, @@ -673,13 +673,13 @@ ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Other/Other/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Other/Other-link-extends-0/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Other/Other/source-map/lexical/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Other/Other-link-extends-0/source-map/lexical/element_0" } ] }, @@ -739,16 +739,16 @@ ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root-link-extends-0/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root/source-map/lexical/element_1" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root-link-extends-0/source-map/lexical/element_1" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root/source-map/lexical/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root-link-extends-0/source-map/lexical/element_0" } ] }, @@ -858,16 +858,16 @@ ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base-link-extends-0/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base/source-map/lexical/element_1" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base-link-extends-0/source-map/lexical/element_1" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base/source-map/lexical/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base-link-extends-0/source-map/lexical/element_0" } ] }, @@ -907,8 +907,8 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(31,8)-(34,0)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Other/Other/source-map/lexical/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Other/Other", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Other/Other-link-extends-0/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Other/Other-link-extends-0", "http://a.ml/vocabularies/document-source-maps#value": "[(28,2)-(35,0)]" }, { @@ -952,12 +952,12 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(24,8)-(27,0)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root/source-map/lexical/element_1", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root-link-extends-0/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root-link-extends-0", "http://a.ml/vocabularies/document-source-maps#value": "[(18,2)-(28,0)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Root/Root-link-extends-0/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", "http://a.ml/vocabularies/document-source-maps#value": "[(18,2)-(18,6)]" }, @@ -1022,12 +1022,12 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(14,8)-(17,0)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base/source-map/lexical/element_1", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base-link-extends-0/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base-link-extends-0", "http://a.ml/vocabularies/document-source-maps#value": "[(11,2)-(18,0)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example21.yaml#/declarations/Base/Base-link-extends-0/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", "http://a.ml/vocabularies/document-source-maps#value": "[(11,2)-(11,6)]" } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.expanded.jsonld index 757a2064..e3b7bed5 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.expanded.jsonld @@ -221,21 +221,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "bis->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml::example23b.yaml" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/source-map/lexical/element_4", @@ -302,6 +287,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "bis->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml::example23b.yaml" + } + ] + } ] } ], @@ -818,6 +818,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml#/source-map/lexical/element_4", @@ -1325,7 +1340,7 @@ ], "http://a.ml/vocabularies/document#extends": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0", "@type": [ "http://a.ml/vocabularies/meta#NodeMapping", "http://www.w3.org/ns/shacl#Shape", @@ -1348,16 +1363,16 @@ ], "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple/source-map/lexical/element_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0" } ], "http://a.ml/vocabularies/document-source-maps#value": [ @@ -1367,7 +1382,7 @@ ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/core#name" diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.flattened.jsonld index ed6cc34f..74a87d07 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.flattened.jsonld @@ -290,7 +290,7 @@ ], "http://a.ml/vocabularies/document#extends": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0" } ], "http://a.ml/vocabularies/document-source-maps#sources": [ @@ -304,11 +304,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/source-map/aliases-array/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/source-map/lexical/element_4" @@ -325,6 +320,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/source-map/lexical/element_3" } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/source-map/aliases-array/element_0" + } ] }, { @@ -408,6 +408,11 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml#/source-map/lexical/element_4" @@ -529,7 +534,7 @@ ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0", "@type": [ "http://a.ml/vocabularies/meta#NodeMapping", "http://www.w3.org/ns/shacl#Shape", @@ -544,7 +549,7 @@ "http://a.ml/vocabularies/document#link-label": "Base", "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple/source-map" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0/source-map" } ] }, @@ -565,11 +570,6 @@ } ] }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml", - "http://a.ml/vocabularies/document-source-maps#value": "bis->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml::example23b.yaml" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/source-map/lexical/element_4", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#externals", @@ -595,6 +595,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(3,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "bis->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml::example23b.yaml" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml/externals/v3#/source-map", "@type": [ @@ -713,6 +718,11 @@ ], "http://a.ml/vocabularies/document#transformed": false }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#declares", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml#/source-map/lexical/element_4", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#externals", @@ -839,16 +849,16 @@ ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple/source-map/lexical/element_1" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0/source-map/lexical/element_1" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple/source-map/lexical/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0/source-map/lexical/element_0" } ] }, @@ -1037,12 +1047,12 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(21,8)-(24,0)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple/source-map/lexical/element_1", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0", "http://a.ml/vocabularies/document-source-maps#value": "[(18,2)-(25,0)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", "http://a.ml/vocabularies/document-source-maps#value": "[(18,2)-(18,8)]" }, diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.expanded.jsonld index 2238cac6..ed513c4a 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.expanded.jsonld @@ -221,21 +221,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "parent->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml::example23a.yaml" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml#/source-map/lexical/element_4", @@ -302,6 +287,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "parent->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml::example23a.yaml" + } + ] + } ] } ], @@ -935,7 +935,7 @@ ], "http://a.ml/vocabularies/document#extends": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0", "@type": [ "http://a.ml/vocabularies/meta#NodeMapping", "http://www.w3.org/ns/shacl#Shape", @@ -958,16 +958,16 @@ ], "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple/source-map/lexical/element_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0" } ], "http://a.ml/vocabularies/document-source-maps#value": [ @@ -977,7 +977,7 @@ ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/core#name" @@ -1101,6 +1101,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/source-map/lexical/element_4", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.flattened.jsonld index 20a3b499..601162ec 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.flattened.jsonld @@ -254,11 +254,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml#/source-map/aliases-array/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml#/source-map/lexical/element_4" @@ -275,6 +270,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml#/source-map/lexical/element_3" } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml#/source-map/aliases-array/element_0" + } ] }, { @@ -375,7 +375,7 @@ ], "http://a.ml/vocabularies/document#extends": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0" } ], "http://a.ml/vocabularies/document-source-maps#sources": [ @@ -408,6 +408,11 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/source-map/lexical/element_4" @@ -488,11 +493,6 @@ } ] }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml", - "http://a.ml/vocabularies/document-source-maps#value": "parent->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml::example23a.yaml" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml#/source-map/lexical/element_4", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#externals", @@ -518,6 +518,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(3,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23b.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "parent->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml::example23a.yaml" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml/externals/v3#/source-map", "@type": [ @@ -670,7 +675,7 @@ ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0", "@type": [ "http://a.ml/vocabularies/meta#NodeMapping", "http://www.w3.org/ns/shacl#Shape", @@ -685,7 +690,7 @@ "http://a.ml/vocabularies/document#link-label": "Base", "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple/source-map" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0/source-map" } ] }, @@ -713,6 +718,11 @@ ], "http://a.ml/vocabularies/document#transformed": false }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#declares", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/source-map/lexical/element_4", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#externals", @@ -943,16 +953,16 @@ ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple/source-map/lexical/element_1" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0/source-map/lexical/element_1" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple/source-map/lexical/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0/source-map/lexical/element_0" } ] }, @@ -1092,12 +1102,12 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(21,8)-(24,0)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple/source-map/lexical/element_1", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0", "http://a.ml/vocabularies/document-source-maps#value": "[(18,2)-(25,0)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example23a.yaml#/declarations/Simple/Simple-link-extends-0/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", "http://a.ml/vocabularies/document-source-maps#value": "[(18,2)-(18,8)]" } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.expanded.jsonld new file mode 100644 index 00000000..e4f8f2ac --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.expanded.jsonld @@ -0,0 +1,951 @@ +[ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml", + "@type": [ + "http://a.ml/vocabularies/meta#Dialect", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "example" + } + ], + "http://a.ml/vocabularies/core#version": [ + { + "@value": "1.23b" + } + ], + "http://a.ml/vocabularies/meta#externals": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/externals/v3", + "@type": [ + "http://www.w3.org/2002/07/owl#Ontology", + "http://a.ml/vocabularies/meta#ExternalVocabulary", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#displayName": [ + { + "@value": "v3" + } + ], + "http://a.ml/vocabularies/meta#base": [ + { + "@value": "http://test.com/v3#" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/externals/v3#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/externals/v3#/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/core#displayName" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(32,2)-(32,4)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/externals/v3#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/meta#base" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(32,6)-(32,25)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/externals/v3#/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/externals/v3" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(32,2)-(33,0)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/meta#documents": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/documents", + "@type": [ + "http://a.ml/vocabularies/meta#DocumentsModel", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/meta#rootDocument": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/documents/root", + "@type": [ + "http://a.ml/vocabularies/meta#DocumentMapping", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "example 1.23b" + } + ], + "http://a.ml/vocabularies/meta#encodedNode": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/documents/root/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/documents/root/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/documents/root" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(29,7)-(31,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/documents/root/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/meta#encodedNode" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(30,4)-(31,0)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/documents#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/documents#/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/documents" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(29,0)-(31,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/documents#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/meta#rootDocument" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(29,2)-(31,0)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document#location": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml" + } + ], + "http://a.ml/vocabularies/document#root": [ + { + "@value": true + } + ], + "http://a.ml/vocabularies/document#processingData": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#BaseUnitProcessingData" + ], + "http://a.ml/vocabularies/document#transformed": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/document#sourceSpec": [ + { + "@value": "AML 1.0" + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/source-map/lexical/element_4", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/meta#externals" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(31,0)-(33,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(33,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/meta#documents" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(28,0)-(31,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/core#version" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(3,0)-(4,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/source-map/lexical/element_3", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/core#name" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B", + "@type": [ + "http://a.ml/vocabularies/meta#NodeMapping", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#targetClass": [ + { + "@id": "http://test.com/v3#B" + } + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "B" + } + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/property/zb", + "@type": [ + "http://a.ml/vocabularies/meta#NodePropertyMapping", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://a.ml/vocabularies/data#zb" + } + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "zb" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/property/zb/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/property/zb/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/core#name" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(8,6)-(8,8)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/property/zb/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/ns/shacl#datatype" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(9,8)-(10,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/property/zb/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/property/zb" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(8,9)-(10,0)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/core#name" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(5,2)-(5,3)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/ns/shacl#property" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(7,4)-(10,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(5,2)-(10,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A", + "@type": [ + "http://a.ml/vocabularies/meta#NodeMapping", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#targetClass": [ + { + "@id": "http://test.com/v3#A" + } + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "A" + } + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/property/za", + "@type": [ + "http://a.ml/vocabularies/meta#NodePropertyMapping", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://a.ml/vocabularies/data#za" + } + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "za" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/property/za/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/property/za/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/core#name" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(13,6)-(13,8)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/property/za/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/ns/shacl#datatype" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(14,8)-(15,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/property/za/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/property/za" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(13,9)-(15,0)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/core#name" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(10,2)-(10,3)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/ns/shacl#property" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(12,4)-(15,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(10,2)-(15,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other", + "@type": [ + "http://a.ml/vocabularies/meta#NodeMapping", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#targetClass": [ + { + "@id": "http://test.com/v3#Simple" + } + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "Other" + } + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/ho", + "@type": [ + "http://a.ml/vocabularies/meta#NodePropertyMapping", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://test.com/v3#ho" + } + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "ho" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/ho/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/ho/source-map/lexical/element_3", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/core#name" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(22,6)-(22,8)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/ho/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/ns/shacl#path" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(24,8)-(25,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/ho/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/ns/shacl#datatype" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(23,8)-(24,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/ho/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/ho" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(22,9)-(25,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a", + "@type": [ + "http://a.ml/vocabularies/meta#NodePropertyMapping", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://test.com/v3#a" + } + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "a" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://a.ml/vocabularies/meta#unique": [ + { + "@value": true + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a/source-map/lexical/element_4", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/ns/shacl#datatype" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(20,8)-(21,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(18,8)-(22,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/meta#unique" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(19,8)-(20,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/core#name" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(18,6)-(18,7)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a/source-map/lexical/element_3", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/ns/shacl#path" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(21,8)-(22,0)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document#extends": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-0", + "@type": [ + "http://a.ml/vocabularies/meta#NodeMapping", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "Other" + } + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "A" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-0/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-0/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-0" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(15,2)-(28,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-0/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/core#name" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(15,2)-(15,7)]" + } + ] + } + ] + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-1", + "@type": [ + "http://a.ml/vocabularies/meta#NodeMapping", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "Other" + } + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "B" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-1/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-1/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-1" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(15,2)-(28,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-1/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/core#name" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(15,2)-(15,7)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/core#name" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(15,2)-(15,7)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/ns/shacl#property" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(17,4)-(25,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(15,2)-(28,0)]" + } + ] + } + ] + } + ] + } + ] + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.flattened.jsonld new file mode 100644 index 00000000..22377a03 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.flattened.jsonld @@ -0,0 +1,741 @@ +{ + "@graph": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#BaseUnitProcessingData" + ], + "http://a.ml/vocabularies/document#transformed": false, + "http://a.ml/vocabularies/document#sourceSpec": "AML 1.0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/externals/v3", + "@type": [ + "http://www.w3.org/2002/07/owl#Ontology", + "http://a.ml/vocabularies/meta#ExternalVocabulary", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#displayName": "v3", + "http://a.ml/vocabularies/meta#base": "http://test.com/v3#", + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/externals/v3#/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/documents", + "@type": [ + "http://a.ml/vocabularies/meta#DocumentsModel", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/meta#rootDocument": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/documents/root" + }, + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/documents#/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/externals/v3#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/externals/v3#/source-map/lexical/element_2" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/externals/v3#/source-map/lexical/element_0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/externals/v3#/source-map/lexical/element_1" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/documents/root", + "@type": [ + "http://a.ml/vocabularies/meta#DocumentMapping", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": "example 1.23b", + "http://a.ml/vocabularies/meta#encodedNode": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/documents/root/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/documents#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/documents#/source-map/lexical/element_1" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/documents#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/externals/v3#/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#displayName", + "http://a.ml/vocabularies/document-source-maps#value": "[(32,2)-(32,4)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/externals/v3#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#base", + "http://a.ml/vocabularies/document-source-maps#value": "[(32,6)-(32,25)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/externals/v3#/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/externals/v3", + "http://a.ml/vocabularies/document-source-maps#value": "[(32,2)-(33,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/documents/root/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/documents/root/source-map/lexical/element_1" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/documents/root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/documents#/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/documents", + "http://a.ml/vocabularies/document-source-maps#value": "[(29,0)-(31,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/documents#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#rootDocument", + "http://a.ml/vocabularies/document-source-maps#value": "[(29,2)-(31,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/documents/root/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/documents/root", + "http://a.ml/vocabularies/document-source-maps#value": "[(29,7)-(31,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/documents/root/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#encodedNode", + "http://a.ml/vocabularies/document-source-maps#value": "[(30,4)-(31,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml", + "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other" + } + ], + "@type": [ + "http://a.ml/vocabularies/meta#Dialect", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/core#name": "example", + "http://a.ml/vocabularies/core#version": "1.23b", + "http://a.ml/vocabularies/meta#externals": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/externals/v3" + } + ], + "http://a.ml/vocabularies/meta#documents": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml/documents" + }, + "http://a.ml/vocabularies/document#location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml", + "http://a.ml/vocabularies/document#root": true, + "http://a.ml/vocabularies/document#processingData": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/BaseUnitProcessingData" + }, + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B", + "@type": [ + "http://a.ml/vocabularies/meta#NodeMapping", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#targetClass": [ + { + "@id": "http://test.com/v3#B" + } + ], + "http://a.ml/vocabularies/core#name": "B", + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/property/zb" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A", + "@type": [ + "http://a.ml/vocabularies/meta#NodeMapping", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#targetClass": [ + { + "@id": "http://test.com/v3#A" + } + ], + "http://a.ml/vocabularies/core#name": "A", + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/property/za" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other", + "@type": [ + "http://a.ml/vocabularies/meta#NodeMapping", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#targetClass": [ + { + "@id": "http://test.com/v3#Simple" + } + ], + "http://a.ml/vocabularies/core#name": "Other", + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/ho" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a" + } + ], + "http://a.ml/vocabularies/document#extends": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-1" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/source-map/lexical/element_4" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/source-map/lexical/element_2" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/source-map/lexical/element_0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/source-map/lexical/element_1" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/source-map/lexical/element_3" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/property/zb", + "@type": [ + "http://a.ml/vocabularies/meta#NodePropertyMapping", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://a.ml/vocabularies/data#zb" + } + ], + "http://a.ml/vocabularies/core#name": "zb", + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/property/zb/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/source-map/lexical/element_2" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/source-map/lexical/element_0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/source-map/lexical/element_1" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/property/za", + "@type": [ + "http://a.ml/vocabularies/meta#NodePropertyMapping", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://a.ml/vocabularies/data#za" + } + ], + "http://a.ml/vocabularies/core#name": "za", + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/property/za/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/source-map/lexical/element_2" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/source-map/lexical/element_0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/source-map/lexical/element_1" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/ho", + "@type": [ + "http://a.ml/vocabularies/meta#NodePropertyMapping", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://test.com/v3#ho" + } + ], + "http://a.ml/vocabularies/core#name": "ho", + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/ho/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a", + "@type": [ + "http://a.ml/vocabularies/meta#NodePropertyMapping", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://test.com/v3#a" + } + ], + "http://a.ml/vocabularies/core#name": "a", + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://a.ml/vocabularies/meta#unique": true, + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-0", + "@type": [ + "http://a.ml/vocabularies/meta#NodeMapping", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": "Other", + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A" + } + ], + "http://a.ml/vocabularies/document#link-label": "A", + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-0/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-1", + "@type": [ + "http://a.ml/vocabularies/meta#NodeMapping", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": "Other", + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B" + } + ], + "http://a.ml/vocabularies/document#link-label": "B", + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-1/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/source-map/lexical/element_2" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/source-map/lexical/element_0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/source-map/lexical/element_1" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/source-map/lexical/element_4", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#externals", + "http://a.ml/vocabularies/document-source-maps#value": "[(31,0)-(33,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(33,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#documents", + "http://a.ml/vocabularies/document-source-maps#value": "[(28,0)-(31,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#version", + "http://a.ml/vocabularies/document-source-maps#value": "[(3,0)-(4,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/source-map/lexical/element_3", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(3,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/property/zb/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/property/zb/source-map/lexical/element_2" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/property/zb/source-map/lexical/element_0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/property/zb/source-map/lexical/element_1" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", + "http://a.ml/vocabularies/document-source-maps#value": "[(5,2)-(5,3)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/ns/shacl#property", + "http://a.ml/vocabularies/document-source-maps#value": "[(7,4)-(10,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B", + "http://a.ml/vocabularies/document-source-maps#value": "[(5,2)-(10,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/property/za/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/property/za/source-map/lexical/element_2" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/property/za/source-map/lexical/element_0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/property/za/source-map/lexical/element_1" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", + "http://a.ml/vocabularies/document-source-maps#value": "[(10,2)-(10,3)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/ns/shacl#property", + "http://a.ml/vocabularies/document-source-maps#value": "[(12,4)-(15,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A", + "http://a.ml/vocabularies/document-source-maps#value": "[(10,2)-(15,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/ho/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/ho/source-map/lexical/element_3" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/ho/source-map/lexical/element_1" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/ho/source-map/lexical/element_0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/ho/source-map/lexical/element_2" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a/source-map/lexical/element_4" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a/source-map/lexical/element_2" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a/source-map/lexical/element_0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a/source-map/lexical/element_1" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a/source-map/lexical/element_3" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-0/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-0/source-map/lexical/element_1" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-0/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-1/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-1/source-map/lexical/element_1" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-1/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", + "http://a.ml/vocabularies/document-source-maps#value": "[(15,2)-(15,7)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/ns/shacl#property", + "http://a.ml/vocabularies/document-source-maps#value": "[(17,4)-(25,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other", + "http://a.ml/vocabularies/document-source-maps#value": "[(15,2)-(28,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/property/zb/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", + "http://a.ml/vocabularies/document-source-maps#value": "[(8,6)-(8,8)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/property/zb/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/ns/shacl#datatype", + "http://a.ml/vocabularies/document-source-maps#value": "[(9,8)-(10,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/property/zb/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/B/property/zb", + "http://a.ml/vocabularies/document-source-maps#value": "[(8,9)-(10,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/property/za/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", + "http://a.ml/vocabularies/document-source-maps#value": "[(13,6)-(13,8)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/property/za/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/ns/shacl#datatype", + "http://a.ml/vocabularies/document-source-maps#value": "[(14,8)-(15,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/property/za/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/A/property/za", + "http://a.ml/vocabularies/document-source-maps#value": "[(13,9)-(15,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/ho/source-map/lexical/element_3", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", + "http://a.ml/vocabularies/document-source-maps#value": "[(22,6)-(22,8)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/ho/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/ns/shacl#path", + "http://a.ml/vocabularies/document-source-maps#value": "[(24,8)-(25,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/ho/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/ns/shacl#datatype", + "http://a.ml/vocabularies/document-source-maps#value": "[(23,8)-(24,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/ho/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/ho", + "http://a.ml/vocabularies/document-source-maps#value": "[(22,9)-(25,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a/source-map/lexical/element_4", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/ns/shacl#datatype", + "http://a.ml/vocabularies/document-source-maps#value": "[(20,8)-(21,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a", + "http://a.ml/vocabularies/document-source-maps#value": "[(18,8)-(22,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#unique", + "http://a.ml/vocabularies/document-source-maps#value": "[(19,8)-(20,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", + "http://a.ml/vocabularies/document-source-maps#value": "[(18,6)-(18,7)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/property/a/source-map/lexical/element_3", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/ns/shacl#path", + "http://a.ml/vocabularies/document-source-maps#value": "[(21,8)-(22,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-0/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-0", + "http://a.ml/vocabularies/document-source-maps#value": "[(15,2)-(28,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-0/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", + "http://a.ml/vocabularies/document-source-maps#value": "[(15,2)-(15,7)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-1/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-1", + "http://a.ml/vocabularies/document-source-maps#value": "[(15,2)-(28,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml#/declarations/Other/Other-link-extends-1/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", + "http://a.ml/vocabularies/document-source-maps#value": "[(15,2)-(15,7)]" + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml new file mode 100644 index 00000000..5c0254e4 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example24.yaml @@ -0,0 +1,32 @@ +#%Dialect 1.0 +dialect: example +version: 1.23b +nodeMappings: + B: + classTerm: v3.B + mapping: + zb: + range: string + A: + classTerm: v3.A + mapping: + za: + range: string + Other: + classTerm: v3.Simple + mapping: + a: + unique: true + range: string + propertyTerm: v3.a + ho: + range: string + propertyTerm: v3.ho + extends: + - A + - B +documents: + root: + encodes: Other +external: + v3: http://test.com/v3# diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.expanded.jsonld index aec585f2..de5f048d 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.expanded.jsonld @@ -281,21 +281,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.yaml" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "v2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.yaml#/source-map/lexical/element_3", @@ -349,6 +334,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "v2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" + } + ] + } ] } ], @@ -472,6 +472,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/lexical/element_2", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.flattened.jsonld index 6d14c23b..cefb4d10 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.flattened.jsonld @@ -311,11 +311,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.yaml#/source-map/aliases-array/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.yaml#/source-map/lexical/element_3" @@ -329,6 +324,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.yaml#/source-map/lexical/element_2" } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.yaml#/source-map/aliases-array/element_0" + } ] }, { @@ -370,6 +370,11 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/lexical/element_2" @@ -460,11 +465,6 @@ } ] }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.yaml", - "http://a.ml/vocabularies/document-source-maps#value": "v2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.yaml#/source-map/lexical/element_3", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#version", @@ -485,6 +485,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.yaml", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(24,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "v2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" + }, { "@id": "http://a.ml/vocabularies/vocab2#A/source-map", "@type": [ @@ -507,6 +512,11 @@ } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#declares", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.rdf-cycled.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.rdf-cycled.expanded.jsonld index 4b21233a..fa60aeb9 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.rdf-cycled.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.rdf-cycled.expanded.jsonld @@ -472,6 +472,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/lexical/element_2", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.rdf-cycled.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.rdf-cycled.flattened.jsonld index 06468bbc..0ad5351d 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.rdf-cycled.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example3.rdf-cycled.flattened.jsonld @@ -370,6 +370,11 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/lexical/element_2" @@ -507,6 +512,11 @@ } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#declares", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example5.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example5.expanded.jsonld index c81c4466..efc84480 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example5.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example5.expanded.jsonld @@ -302,21 +302,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example5.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example5.yaml" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "v2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example5.yaml#/source-map/lexical/element_4", @@ -383,6 +368,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example5.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example5.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "v2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" + } + ] + } ] } ], @@ -506,6 +506,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/lexical/element_2", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example5.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example5.flattened.jsonld index 948289ed..667adef6 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example5.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example5.flattened.jsonld @@ -323,11 +323,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example5.yaml#/source-map/aliases-array/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example5.yaml#/source-map/lexical/element_4" @@ -344,6 +339,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example5.yaml#/source-map/lexical/element_3" } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example5.yaml#/source-map/aliases-array/element_0" + } ] }, { @@ -385,6 +385,11 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/lexical/element_2" @@ -475,11 +480,6 @@ } ] }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example5.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example5.yaml", - "http://a.ml/vocabularies/document-source-maps#value": "v2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example5.yaml#/source-map/lexical/element_4", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#externals", @@ -505,6 +505,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(3,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example5.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example5.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "v2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" + }, { "@id": "http://a.ml/vocabularies/vocab2#A/source-map", "@type": [ @@ -527,6 +532,11 @@ } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#declares", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/vocab2.yaml#/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.expanded.jsonld index f669d2e3..d2eea390 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.expanded.jsonld @@ -152,21 +152,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.yaml" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::mappings_lib.yaml" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.yaml#/source-map/lexical/element_3", @@ -220,6 +205,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::mappings_lib.yaml" + } + ] + } ] } ], @@ -492,6 +492,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/lexical/element_0", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.flattened.jsonld index 1c096e3c..5f170ee7 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.flattened.jsonld @@ -155,11 +155,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.yaml#/source-map/aliases-array/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.yaml#/source-map/lexical/element_3" @@ -173,6 +168,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.yaml#/source-map/lexical/element_2" } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.yaml#/source-map/aliases-array/element_0" + } ] }, { @@ -227,17 +227,17 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/lexical/element_0" } ] }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.yaml", - "http://a.ml/vocabularies/document-source-maps#value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::mappings_lib.yaml" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.yaml#/source-map/lexical/element_3", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#version", @@ -258,6 +258,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.yaml", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(9,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example6.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::mappings_lib.yaml" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml/externals/v2#/source-map", "@type": [ @@ -315,6 +320,11 @@ } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#declares", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.expanded.jsonld index 62de2630..7fe48797 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.expanded.jsonld @@ -152,21 +152,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.yaml" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::mappings_lib.yaml" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.yaml#/source-map/lexical/element_3", @@ -220,6 +205,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::mappings_lib.yaml" + } + ] + } ] } ], @@ -492,6 +492,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/lexical/element_0", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.flattened.jsonld index 71a7a8e6..3bc03e6e 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.flattened.jsonld @@ -228,11 +228,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.yaml#/source-map/aliases-array/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.yaml#/source-map/lexical/element_3" @@ -246,6 +241,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.yaml#/source-map/lexical/element_2" } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.yaml#/source-map/aliases-array/element_0" + } ] }, { @@ -300,6 +300,11 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/lexical/element_0" @@ -393,11 +398,6 @@ } ] }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.yaml", - "http://a.ml/vocabularies/document-source-maps#value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::mappings_lib.yaml" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.yaml#/source-map/lexical/element_3", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#version", @@ -418,6 +418,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.yaml", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(18,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/example7.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml::mappings_lib.yaml" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml/externals/v2#/source-map", "@type": [ @@ -475,6 +480,11 @@ } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#declares", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml#/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/mappings_lib.yaml", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.cycled.jsonld.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.cycled.jsonld.yaml new file mode 100644 index 00000000..4168de2f --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.cycled.jsonld.yaml @@ -0,0 +1,37 @@ +#%Dialect 1.0 +dialect: Mapping extended +version: "1.0" +external: + schema-org: https://schema.org/ +documents: + root: + encodes: Root +nodeMappings: + Root: + allOf: + - Member1 + - Member2 + - Member3 + mapping: + am01: + range: string + am02: + range: string + Member1: + mapping: + am11: + range: string + am12: + range: string + Member2: + mapping: + am21: + range: string + am22: + range: string + Member3: + mapping: + am31: + range: string + am32: + range: string diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.cycled.yaml new file mode 100644 index 00000000..4168de2f --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.cycled.yaml @@ -0,0 +1,37 @@ +#%Dialect 1.0 +dialect: Mapping extended +version: "1.0" +external: + schema-org: https://schema.org/ +documents: + root: + encodes: Root +nodeMappings: + Root: + allOf: + - Member1 + - Member2 + - Member3 + mapping: + am01: + range: string + am02: + range: string + Member1: + mapping: + am11: + range: string + am12: + range: string + Member2: + mapping: + am21: + range: string + am22: + range: string + Member3: + mapping: + am31: + range: string + am32: + range: string diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.expanded.jsonld new file mode 100644 index 00000000..fb80b18b --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.expanded.jsonld @@ -0,0 +1,1140 @@ +[ + { + "@id": "", + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": [ + { + "@value": "Mapping extended" + } + ], + "core:version": [ + { + "@value": "1.0" + } + ], + "meta:externals": [ + { + "@id": "/externals/schema-org", + "@type": [ + "owl:Ontology", + "meta:ExternalVocabulary", + "doc:DomainElement" + ], + "core:displayName": [ + { + "@value": "schema-org" + } + ], + "meta:base": [ + { + "@value": "https://schema.org/" + } + ], + "sourcemaps:sources": [ + { + "@id": "/externals/schema-org#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/externals/schema-org#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:displayName" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,2)-(6,12)]" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:base" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,14)-(6,33)]" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml/externals/schema-org" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,2)-(8,0)]" + } + ] + } + ] + } + ] + } + ], + "meta:documents": [ + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": [ + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Mapping extended 1.0" + } + ], + "meta:encodedNode": [ + { + "@id": "#/declarations/Root" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/documents/root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,7)-(12,0)]" + } + ] + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:encodedNode" + } + ], + "sourcemaps:value": [ + { + "@value": "[(10,4)-(12,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml/documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,0)-(12,0)]" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:rootDocument" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,2)-(12,0)]" + } + ] + } + ] + } + ] + } + ], + "doc:location": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml" + } + ], + "doc:root": [ + { + "@value": true + } + ], + "doc:processingData": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": [ + { + "@value": false + } + ], + "doc:sourceSpec": [ + { + "@value": "AML 1.0" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_4", + "sourcemaps:element": [ + { + "@value": "meta:externals" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,0)-(8,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(40,21)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(8,0)-(12,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:version" + } + ], + "sourcemaps:value": [ + { + "@value": "[(3,0)-(5,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + } + ] + } + ], + "doc:declares": [ + { + "@id": "#/declarations/Root", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Root" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Root/property/am02", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am02" + } + ], + "core:name": [ + { + "@value": "am02" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/am02/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(21,6)-(21,10)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(22,8)-(23,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root/property/am02" + } + ], + "sourcemaps:value": [ + { + "@value": "[(21,11)-(23,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Root/property/am01", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am01" + } + ], + "core:name": [ + { + "@value": "am01" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/am01/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(19,6)-(19,10)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(20,8)-(21,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root/property/am01" + } + ], + "sourcemaps:value": [ + { + "@value": "[(19,11)-(21,0)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/amf/aml#and": [ + { + "@id": "#/declarations/Member1" + }, + { + "@id": "#/declarations/Member2" + }, + { + "@id": "#/declarations/Member3" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(13,2)-(13,6)]" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(18,4)-(23,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(13,2)-(23,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Member1" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Member1/property/am12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am12" + } + ], + "core:name": [ + { + "@value": "am12" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/property/am12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/property/am12/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(27,6)-(27,10)]" + } + ] + }, + { + "@id": "#/declarations/Member1/property/am12/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(28,8)-(29,0)]" + } + ] + }, + { + "@id": "#/declarations/Member1/property/am12/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1/property/am12" + } + ], + "sourcemaps:value": [ + { + "@value": "[(27,11)-(29,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member1/property/am11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am11" + } + ], + "core:name": [ + { + "@value": "am11" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/property/am11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/property/am11/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(25,6)-(25,10)]" + } + ] + }, + { + "@id": "#/declarations/Member1/property/am11/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(26,8)-(27,0)]" + } + ] + }, + { + "@id": "#/declarations/Member1/property/am11/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1/property/am11" + } + ], + "sourcemaps:value": [ + { + "@value": "[(25,11)-(27,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(23,2)-(23,9)]" + } + ] + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(24,4)-(29,0)]" + } + ] + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(23,2)-(29,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Member2" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Member2/property/am22", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am22" + } + ], + "core:name": [ + { + "@value": "am22" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/property/am22/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/property/am22/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(33,6)-(33,10)]" + } + ] + }, + { + "@id": "#/declarations/Member2/property/am22/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(34,8)-(35,0)]" + } + ] + }, + { + "@id": "#/declarations/Member2/property/am22/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2/property/am22" + } + ], + "sourcemaps:value": [ + { + "@value": "[(33,11)-(35,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member2/property/am21", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am21" + } + ], + "core:name": [ + { + "@value": "am21" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/property/am21/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/property/am21/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(31,6)-(31,10)]" + } + ] + }, + { + "@id": "#/declarations/Member2/property/am21/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(32,8)-(33,0)]" + } + ] + }, + { + "@id": "#/declarations/Member2/property/am21/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2/property/am21" + } + ], + "sourcemaps:value": [ + { + "@value": "[(31,11)-(33,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(29,2)-(29,9)]" + } + ] + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(30,4)-(35,0)]" + } + ] + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2" + } + ], + "sourcemaps:value": [ + { + "@value": "[(29,2)-(35,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member3", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Member3" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Member3/property/am31", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am31" + } + ], + "core:name": [ + { + "@value": "am31" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member3/property/am31/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member3/property/am31/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(37,6)-(37,10)]" + } + ] + }, + { + "@id": "#/declarations/Member3/property/am31/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(38,8)-(39,0)]" + } + ] + }, + { + "@id": "#/declarations/Member3/property/am31/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3/property/am31" + } + ], + "sourcemaps:value": [ + { + "@value": "[(37,11)-(39,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member3/property/am32", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am32" + } + ], + "core:name": [ + { + "@value": "am32" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member3/property/am32/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member3/property/am32/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(39,6)-(39,10)]" + } + ] + }, + { + "@id": "#/declarations/Member3/property/am32/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(40,8)-(40,21)]" + } + ] + }, + { + "@id": "#/declarations/Member3/property/am32/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3/property/am32" + } + ], + "sourcemaps:value": [ + { + "@value": "[(39,11)-(40,21)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member3/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member3/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(35,2)-(35,9)]" + } + ] + }, + { + "@id": "#/declarations/Member3/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(36,4)-(40,21)]" + } + ] + }, + { + "@id": "#/declarations/Member3/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3" + } + ], + "sourcemaps:value": [ + { + "@value": "[(35,2)-(40,21)]" + } + ] + } + ] + } + ] + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "owl": "http://www.w3.org/2002/07/owl#", + "meta": "http://a.ml/vocabularies/meta#" + } + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.flattened.jsonld new file mode 100644 index 00000000..eedf2826 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.flattened.jsonld @@ -0,0 +1,908 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/externals/schema-org", + "@type": [ + "owl:Ontology", + "meta:ExternalVocabulary", + "doc:DomainElement" + ], + "core:displayName": "schema-org", + "meta:base": "https://schema.org/", + "sourcemaps:sources": [ + { + "@id": "/externals/schema-org#/source-map" + } + ] + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + }, + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/externals/schema-org#/source-map/lexical/element_2" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_0" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "Mapping extended 1.0", + "meta:encodedNode": [ + { + "@id": "#/declarations/Root" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map" + } + ] + }, + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1" + }, + { + "@id": "/documents#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_2", + "sourcemaps:element": "core:displayName", + "sourcemaps:value": "[(6,2)-(6,12)]" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_0", + "sourcemaps:element": "meta:base", + "sourcemaps:value": "[(6,14)-(6,33)]" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml/externals/schema-org", + "sourcemaps:value": "[(6,2)-(8,0)]" + }, + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml/documents", + "sourcemaps:value": "[(9,0)-(12,0)]" + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": "meta:rootDocument", + "sourcemaps:value": "[(9,2)-(12,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/documents/root", + "sourcemaps:value": "[(9,7)-(12,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": "meta:encodedNode", + "sourcemaps:value": "[(10,4)-(12,0)]" + }, + { + "@id": "", + "doc:declares": [ + { + "@id": "#/declarations/Root" + }, + { + "@id": "#/declarations/Member1" + }, + { + "@id": "#/declarations/Member2" + }, + { + "@id": "#/declarations/Member3" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "Mapping extended", + "core:version": "1.0", + "meta:externals": [ + { + "@id": "/externals/schema-org" + } + ], + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + }, + "sourcemaps:sources": [ + { + "@id": "#/source-map" + } + ] + }, + { + "@id": "#/declarations/Root", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Root", + "shacl:property": [ + { + "@id": "#/declarations/Root/property/am02" + }, + { + "@id": "#/declarations/Root/property/am01" + } + ], + "http://a.ml/vocabularies/amf/aml#and": [ + { + "@id": "#/declarations/Member1" + }, + { + "@id": "#/declarations/Member2" + }, + { + "@id": "#/declarations/Member3" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/source-map" + } + ] + }, + { + "@id": "#/declarations/Member1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Member1", + "shacl:property": [ + { + "@id": "#/declarations/Member1/property/am12" + }, + { + "@id": "#/declarations/Member1/property/am11" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/source-map" + } + ] + }, + { + "@id": "#/declarations/Member2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Member2", + "shacl:property": [ + { + "@id": "#/declarations/Member2/property/am22" + }, + { + "@id": "#/declarations/Member2/property/am21" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/source-map" + } + ] + }, + { + "@id": "#/declarations/Member3", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Member3", + "shacl:property": [ + { + "@id": "#/declarations/Member3/property/am31" + }, + { + "@id": "#/declarations/Member3/property/am32" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member3/source-map" + } + ] + }, + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_4" + }, + { + "@id": "#/source-map/lexical/element_2" + }, + { + "@id": "#/source-map/lexical/element_0" + }, + { + "@id": "#/source-map/lexical/element_1" + }, + { + "@id": "#/source-map/lexical/element_3" + } + ] + }, + { + "@id": "#/declarations/Root/property/am02", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am02" + } + ], + "core:name": "am02", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/am02/source-map" + } + ] + }, + { + "@id": "#/declarations/Root/property/am01", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am01" + } + ], + "core:name": "am01", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/am01/source-map" + } + ] + }, + { + "@id": "#/declarations/Root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member1/property/am12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am12" + } + ], + "core:name": "am12", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/property/am12/source-map" + } + ] + }, + { + "@id": "#/declarations/Member1/property/am11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am11" + } + ], + "core:name": "am11", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/property/am11/source-map" + } + ] + }, + { + "@id": "#/declarations/Member1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member2/property/am22", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am22" + } + ], + "core:name": "am22", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/property/am22/source-map" + } + ] + }, + { + "@id": "#/declarations/Member2/property/am21", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am21" + } + ], + "core:name": "am21", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/property/am21/source-map" + } + ] + }, + { + "@id": "#/declarations/Member2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member3/property/am31", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am31" + } + ], + "core:name": "am31", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member3/property/am31/source-map" + } + ] + }, + { + "@id": "#/declarations/Member3/property/am32", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am32" + } + ], + "core:name": "am32", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member3/property/am32/source-map" + } + ] + }, + { + "@id": "#/declarations/Member3/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member3/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member3/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member3/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/source-map/lexical/element_4", + "sourcemaps:element": "meta:externals", + "sourcemaps:value": "[(5,0)-(8,0)]" + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml", + "sourcemaps:value": "[(2,0)-(40,21)]" + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": "meta:documents", + "sourcemaps:value": "[(8,0)-(12,0)]" + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": "core:version", + "sourcemaps:value": "[(3,0)-(5,0)]" + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(2,0)-(3,0)]" + }, + { + "@id": "#/declarations/Root/property/am02/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Root/property/am01/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(13,2)-(13,6)]" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(18,4)-(23,0)]" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root", + "sourcemaps:value": "[(13,2)-(23,0)]" + }, + { + "@id": "#/declarations/Member1/property/am12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/property/am12/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member1/property/am12/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member1/property/am12/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member1/property/am11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/property/am11/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member1/property/am11/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member1/property/am11/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(23,2)-(23,9)]" + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(24,4)-(29,0)]" + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1", + "sourcemaps:value": "[(23,2)-(29,0)]" + }, + { + "@id": "#/declarations/Member2/property/am22/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/property/am22/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member2/property/am22/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member2/property/am22/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member2/property/am21/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/property/am21/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member2/property/am21/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member2/property/am21/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(29,2)-(29,9)]" + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(30,4)-(35,0)]" + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2", + "sourcemaps:value": "[(29,2)-(35,0)]" + }, + { + "@id": "#/declarations/Member3/property/am31/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member3/property/am31/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member3/property/am31/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member3/property/am31/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member3/property/am32/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member3/property/am32/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member3/property/am32/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member3/property/am32/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member3/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(35,2)-(35,9)]" + }, + { + "@id": "#/declarations/Member3/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(36,4)-(40,21)]" + }, + { + "@id": "#/declarations/Member3/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3", + "sourcemaps:value": "[(35,2)-(40,21)]" + }, + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(21,6)-(21,10)]" + }, + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(22,8)-(23,0)]" + }, + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root/property/am02", + "sourcemaps:value": "[(21,11)-(23,0)]" + }, + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(19,6)-(19,10)]" + }, + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(20,8)-(21,0)]" + }, + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root/property/am01", + "sourcemaps:value": "[(19,11)-(21,0)]" + }, + { + "@id": "#/declarations/Member1/property/am12/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(27,6)-(27,10)]" + }, + { + "@id": "#/declarations/Member1/property/am12/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(28,8)-(29,0)]" + }, + { + "@id": "#/declarations/Member1/property/am12/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1/property/am12", + "sourcemaps:value": "[(27,11)-(29,0)]" + }, + { + "@id": "#/declarations/Member1/property/am11/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(25,6)-(25,10)]" + }, + { + "@id": "#/declarations/Member1/property/am11/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(26,8)-(27,0)]" + }, + { + "@id": "#/declarations/Member1/property/am11/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1/property/am11", + "sourcemaps:value": "[(25,11)-(27,0)]" + }, + { + "@id": "#/declarations/Member2/property/am22/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(33,6)-(33,10)]" + }, + { + "@id": "#/declarations/Member2/property/am22/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(34,8)-(35,0)]" + }, + { + "@id": "#/declarations/Member2/property/am22/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2/property/am22", + "sourcemaps:value": "[(33,11)-(35,0)]" + }, + { + "@id": "#/declarations/Member2/property/am21/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(31,6)-(31,10)]" + }, + { + "@id": "#/declarations/Member2/property/am21/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(32,8)-(33,0)]" + }, + { + "@id": "#/declarations/Member2/property/am21/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2/property/am21", + "sourcemaps:value": "[(31,11)-(33,0)]" + }, + { + "@id": "#/declarations/Member3/property/am31/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(37,6)-(37,10)]" + }, + { + "@id": "#/declarations/Member3/property/am31/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(38,8)-(39,0)]" + }, + { + "@id": "#/declarations/Member3/property/am31/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3/property/am31", + "sourcemaps:value": "[(37,11)-(39,0)]" + }, + { + "@id": "#/declarations/Member3/property/am32/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(39,6)-(39,10)]" + }, + { + "@id": "#/declarations/Member3/property/am32/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(40,8)-(40,21)]" + }, + { + "@id": "#/declarations/Member3/property/am32/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3/property/am32", + "sourcemaps:value": "[(39,11)-(40,21)]" + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#", + "owl": "http://www.w3.org/2002/07/owl#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.resolved.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.resolved.expanded.jsonld new file mode 100644 index 00000000..f0a52c86 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.resolved.expanded.jsonld @@ -0,0 +1,567 @@ +[ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml", +"@type": [ +"http://a.ml/vocabularies/meta#Dialect", +"http://a.ml/vocabularies/document#Document", +"http://a.ml/vocabularies/document#Fragment", +"http://a.ml/vocabularies/document#Module", +"http://a.ml/vocabularies/document#Unit" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Mapping extended" +} +], +"http://a.ml/vocabularies/core#version": [ +{ +"@value": "1.0" +} +], +"http://a.ml/vocabularies/meta#extensions": [], +"http://a.ml/vocabularies/meta#externals": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml/externals/schema-org", +"@type": [ +"http://www.w3.org/2002/07/owl#Ontology", +"http://a.ml/vocabularies/meta#ExternalVocabulary", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#displayName": [ +{ +"@value": "schema-org" +} +], +"http://a.ml/vocabularies/meta#base": [ +{ +"@value": "https://schema.org/" +} +] +} +], +"http://a.ml/vocabularies/meta#documents": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml/documents", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentsModel", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/meta#rootDocument": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/documents/root", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Mapping extended 1.0" +} +], +"http://a.ml/vocabularies/meta#encodedNode": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root" +} +] +} +] +} +], +"http://a.ml/vocabularies/document#location": [ +{ +"@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml" +} +], +"http://a.ml/vocabularies/document#root": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/document#processingData": [ +{ +"@id": "null/BaseUnitProcessingData", +"@type": [ +"http://a.ml/vocabularies/document#BaseUnitProcessingData" +], +"http://a.ml/vocabularies/document#transformed": [ +{ +"@value": true +} +] +} +], +"http://a.ml/vocabularies/document#declares": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Member1" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Root" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root/property/am02", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am02" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am02" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root/property/am01", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am01" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am01" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +], +"http://a.ml/vocabularies/amf/aml#and": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Member3" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3/property/am31", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am31" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am31" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3/property/am32", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am32" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am32" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Member2" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2/property/am22", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am22" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am22" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2/property/am21", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am21" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am21" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml/CombiningMapping_1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_1" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2/property/am22", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am22" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am22" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2/property/am21", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am21" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am21" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3/property/am31", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am31" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am31" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3/property/am32", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am32" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am32" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root/property/am02", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am02" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am02" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root/property/am01", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am01" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am01" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root" +} +] +} +] +} +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.resolved.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.resolved.flattened.jsonld new file mode 100644 index 00000000..ab3a9754 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.resolved.flattened.jsonld @@ -0,0 +1,374 @@ +{ +"@graph": [ +{ +"@id": "null/BaseUnitProcessingData", +"@type": [ +"http://a.ml/vocabularies/document#BaseUnitProcessingData" +], +"http://a.ml/vocabularies/document#transformed": true +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml/documents", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentsModel", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/meta#rootDocument": { +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/documents/root" +} +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml/externals/schema-org", +"@type": [ +"http://www.w3.org/2002/07/owl#Ontology", +"http://a.ml/vocabularies/meta#ExternalVocabulary", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#displayName": "schema-org", +"http://a.ml/vocabularies/meta#base": "https://schema.org/" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/documents/root", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "Mapping extended 1.0", +"http://a.ml/vocabularies/meta#encodedNode": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml", +"http://a.ml/vocabularies/document#declares": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml/CombiningMapping_1" +} +], +"@type": [ +"http://a.ml/vocabularies/meta#Dialect", +"http://a.ml/vocabularies/document#Document", +"http://a.ml/vocabularies/document#Fragment", +"http://a.ml/vocabularies/document#Module", +"http://a.ml/vocabularies/document#Unit" +], +"http://a.ml/vocabularies/core#name": "Mapping extended", +"http://a.ml/vocabularies/core#version": "1.0", +"http://a.ml/vocabularies/meta#extensions": [], +"http://a.ml/vocabularies/meta#externals": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml/externals/schema-org" +} +], +"http://a.ml/vocabularies/meta#documents": { +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml/documents" +}, +"http://a.ml/vocabularies/document#location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml", +"http://a.ml/vocabularies/document#root": false, +"http://a.ml/vocabularies/document#processingData": { +"@id": "null/BaseUnitProcessingData" +} +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "Member1", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1/property/am12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1/property/am11" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "Root", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root/property/am02" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root/property/am01" +} +], +"http://a.ml/vocabularies/amf/aml#and": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "Member3", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3/property/am31" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3/property/am32" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "Member2", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2/property/am22" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2/property/am21" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml/CombiningMapping_1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_1", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1/property/am12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1/property/am11" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2/property/am22" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2/property/am21" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3/property/am31" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3/property/am32" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root/property/am02" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root/property/am01" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": "am12", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": "am11", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root/property/am02", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am02" +} +], +"http://a.ml/vocabularies/core#name": "am02", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Root/property/am01", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am01" +} +], +"http://a.ml/vocabularies/core#name": "am01", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3/property/am31", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am31" +} +], +"http://a.ml/vocabularies/core#name": "am31", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member3/property/am32", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am32" +} +], +"http://a.ml/vocabularies/core#name": "am32", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2/property/am22", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am22" +} +], +"http://a.ml/vocabularies/core#name": "am22", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml#/declarations/Member2/property/am21", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am21" +} +], +"http://a.ml/vocabularies/core#name": "am21", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.resolved.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.resolved.yaml new file mode 100644 index 00000000..8965f2f0 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.resolved.yaml @@ -0,0 +1,61 @@ +#%Dialect 1.0 +external: + schema-org: https://schema.org/ +documents: + root: + encodes: Root +nodeMappings: + Root: + allOf: + - Member1 + - Member2 + - Member3 + mapping: + am01: + range: string + am02: + range: string + Member1: + mapping: + am11: + range: string + am12: + range: string + Member2: + mapping: + am21: + range: string + am22: + range: string + Member3: + mapping: + am31: + range: string + am32: + range: string + CombiningMapping_1: + components: + - Member1 + - Member2 + - Member3 + - Root + mapping: + am01: + range: string + am02: + range: string + am11: + range: string + am12: + range: string + am21: + range: string + am22: + range: string + am31: + range: string + am32: + range: string + additionalProperties: true +dialect: Mapping extended +version: "1.0" diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml new file mode 100644 index 00000000..7f5aee10 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-1/dialect.yaml @@ -0,0 +1,40 @@ +#%Dialect 1.0 +dialect: Mapping extended +version: 1.0 + +external: + schema-org: https://schema.org/ + +documents: + root: + encodes: Root + +nodeMappings: + Root: + allOf: + - Member1 + - Member2 + - Member3 + mapping: + am01: + range: string + am02: + range: string + Member1: + mapping: + am11: + range: string + am12: + range: string + Member2: + mapping: + am21: + range: string + am22: + range: string + Member3: + mapping: + am31: + range: string + am32: + range: string \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.cycled.jsonld.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.cycled.jsonld.yaml new file mode 100644 index 00000000..0dafcef2 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.cycled.jsonld.yaml @@ -0,0 +1,37 @@ +#%Dialect 1.0 +dialect: Mapping extended +version: "1.0" +external: + schema-org: https://schema.org/ +documents: + root: + encodes: Root +nodeMappings: + Root: + oneOf: + - Member1 + - Member2 + - Member3 + mapping: + am01: + range: string + am02: + range: string + Member1: + mapping: + am11: + range: string + am12: + range: string + Member2: + mapping: + am21: + range: string + am22: + range: string + Member3: + mapping: + am31: + range: string + am32: + range: string diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.cycled.yaml new file mode 100644 index 00000000..0dafcef2 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.cycled.yaml @@ -0,0 +1,37 @@ +#%Dialect 1.0 +dialect: Mapping extended +version: "1.0" +external: + schema-org: https://schema.org/ +documents: + root: + encodes: Root +nodeMappings: + Root: + oneOf: + - Member1 + - Member2 + - Member3 + mapping: + am01: + range: string + am02: + range: string + Member1: + mapping: + am11: + range: string + am12: + range: string + Member2: + mapping: + am21: + range: string + am22: + range: string + Member3: + mapping: + am31: + range: string + am32: + range: string diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.expanded.jsonld new file mode 100644 index 00000000..5f363e42 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.expanded.jsonld @@ -0,0 +1,1140 @@ +[ + { + "@id": "", + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": [ + { + "@value": "Mapping extended" + } + ], + "core:version": [ + { + "@value": "1.0" + } + ], + "meta:externals": [ + { + "@id": "/externals/schema-org", + "@type": [ + "owl:Ontology", + "meta:ExternalVocabulary", + "doc:DomainElement" + ], + "core:displayName": [ + { + "@value": "schema-org" + } + ], + "meta:base": [ + { + "@value": "https://schema.org/" + } + ], + "sourcemaps:sources": [ + { + "@id": "/externals/schema-org#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/externals/schema-org#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:displayName" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,2)-(6,12)]" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:base" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,14)-(6,33)]" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml/externals/schema-org" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,2)-(8,0)]" + } + ] + } + ] + } + ] + } + ], + "meta:documents": [ + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": [ + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Mapping extended 1.0" + } + ], + "meta:encodedNode": [ + { + "@id": "#/declarations/Root" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/documents/root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,7)-(12,0)]" + } + ] + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:encodedNode" + } + ], + "sourcemaps:value": [ + { + "@value": "[(10,4)-(12,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml/documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,0)-(12,0)]" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:rootDocument" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,2)-(12,0)]" + } + ] + } + ] + } + ] + } + ], + "doc:location": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml" + } + ], + "doc:root": [ + { + "@value": true + } + ], + "doc:processingData": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": [ + { + "@value": false + } + ], + "doc:sourceSpec": [ + { + "@value": "AML 1.0" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_4", + "sourcemaps:element": [ + { + "@value": "meta:externals" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,0)-(8,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(40,21)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(8,0)-(12,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:version" + } + ], + "sourcemaps:value": [ + { + "@value": "[(3,0)-(5,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + } + ] + } + ], + "doc:declares": [ + { + "@id": "#/declarations/Root", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Root" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Root/property/am02", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am02" + } + ], + "core:name": [ + { + "@value": "am02" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/am02/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(21,6)-(21,10)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(22,8)-(23,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root/property/am02" + } + ], + "sourcemaps:value": [ + { + "@value": "[(21,11)-(23,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Root/property/am01", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am01" + } + ], + "core:name": [ + { + "@value": "am01" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/am01/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(19,6)-(19,10)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(20,8)-(21,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root/property/am01" + } + ], + "sourcemaps:value": [ + { + "@value": "[(19,11)-(21,0)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/amf/aml#or": [ + { + "@id": "#/declarations/Member1" + }, + { + "@id": "#/declarations/Member2" + }, + { + "@id": "#/declarations/Member3" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(13,2)-(13,6)]" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(18,4)-(23,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(13,2)-(23,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Member1" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Member1/property/am12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am12" + } + ], + "core:name": [ + { + "@value": "am12" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/property/am12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/property/am12/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(27,6)-(27,10)]" + } + ] + }, + { + "@id": "#/declarations/Member1/property/am12/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(28,8)-(29,0)]" + } + ] + }, + { + "@id": "#/declarations/Member1/property/am12/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1/property/am12" + } + ], + "sourcemaps:value": [ + { + "@value": "[(27,11)-(29,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member1/property/am11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am11" + } + ], + "core:name": [ + { + "@value": "am11" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/property/am11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/property/am11/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(25,6)-(25,10)]" + } + ] + }, + { + "@id": "#/declarations/Member1/property/am11/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(26,8)-(27,0)]" + } + ] + }, + { + "@id": "#/declarations/Member1/property/am11/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1/property/am11" + } + ], + "sourcemaps:value": [ + { + "@value": "[(25,11)-(27,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(23,2)-(23,9)]" + } + ] + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(24,4)-(29,0)]" + } + ] + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(23,2)-(29,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Member2" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Member2/property/am22", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am22" + } + ], + "core:name": [ + { + "@value": "am22" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/property/am22/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/property/am22/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(33,6)-(33,10)]" + } + ] + }, + { + "@id": "#/declarations/Member2/property/am22/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(34,8)-(35,0)]" + } + ] + }, + { + "@id": "#/declarations/Member2/property/am22/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2/property/am22" + } + ], + "sourcemaps:value": [ + { + "@value": "[(33,11)-(35,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member2/property/am21", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am21" + } + ], + "core:name": [ + { + "@value": "am21" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/property/am21/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/property/am21/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(31,6)-(31,10)]" + } + ] + }, + { + "@id": "#/declarations/Member2/property/am21/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(32,8)-(33,0)]" + } + ] + }, + { + "@id": "#/declarations/Member2/property/am21/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2/property/am21" + } + ], + "sourcemaps:value": [ + { + "@value": "[(31,11)-(33,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(29,2)-(29,9)]" + } + ] + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(30,4)-(35,0)]" + } + ] + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2" + } + ], + "sourcemaps:value": [ + { + "@value": "[(29,2)-(35,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member3", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Member3" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Member3/property/am31", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am31" + } + ], + "core:name": [ + { + "@value": "am31" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member3/property/am31/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member3/property/am31/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(37,6)-(37,10)]" + } + ] + }, + { + "@id": "#/declarations/Member3/property/am31/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(38,8)-(39,0)]" + } + ] + }, + { + "@id": "#/declarations/Member3/property/am31/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3/property/am31" + } + ], + "sourcemaps:value": [ + { + "@value": "[(37,11)-(39,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member3/property/am32", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am32" + } + ], + "core:name": [ + { + "@value": "am32" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member3/property/am32/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member3/property/am32/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(39,6)-(39,10)]" + } + ] + }, + { + "@id": "#/declarations/Member3/property/am32/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(40,8)-(40,21)]" + } + ] + }, + { + "@id": "#/declarations/Member3/property/am32/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3/property/am32" + } + ], + "sourcemaps:value": [ + { + "@value": "[(39,11)-(40,21)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member3/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member3/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(35,2)-(35,9)]" + } + ] + }, + { + "@id": "#/declarations/Member3/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(36,4)-(40,21)]" + } + ] + }, + { + "@id": "#/declarations/Member3/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3" + } + ], + "sourcemaps:value": [ + { + "@value": "[(35,2)-(40,21)]" + } + ] + } + ] + } + ] + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "owl": "http://www.w3.org/2002/07/owl#", + "meta": "http://a.ml/vocabularies/meta#" + } + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.flattened.jsonld new file mode 100644 index 00000000..cca1e125 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.flattened.jsonld @@ -0,0 +1,908 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/externals/schema-org", + "@type": [ + "owl:Ontology", + "meta:ExternalVocabulary", + "doc:DomainElement" + ], + "core:displayName": "schema-org", + "meta:base": "https://schema.org/", + "sourcemaps:sources": [ + { + "@id": "/externals/schema-org#/source-map" + } + ] + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + }, + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/externals/schema-org#/source-map/lexical/element_2" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_0" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "Mapping extended 1.0", + "meta:encodedNode": [ + { + "@id": "#/declarations/Root" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map" + } + ] + }, + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1" + }, + { + "@id": "/documents#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_2", + "sourcemaps:element": "core:displayName", + "sourcemaps:value": "[(6,2)-(6,12)]" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_0", + "sourcemaps:element": "meta:base", + "sourcemaps:value": "[(6,14)-(6,33)]" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml/externals/schema-org", + "sourcemaps:value": "[(6,2)-(8,0)]" + }, + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml/documents", + "sourcemaps:value": "[(9,0)-(12,0)]" + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": "meta:rootDocument", + "sourcemaps:value": "[(9,2)-(12,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/documents/root", + "sourcemaps:value": "[(9,7)-(12,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": "meta:encodedNode", + "sourcemaps:value": "[(10,4)-(12,0)]" + }, + { + "@id": "", + "doc:declares": [ + { + "@id": "#/declarations/Root" + }, + { + "@id": "#/declarations/Member1" + }, + { + "@id": "#/declarations/Member2" + }, + { + "@id": "#/declarations/Member3" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "Mapping extended", + "core:version": "1.0", + "meta:externals": [ + { + "@id": "/externals/schema-org" + } + ], + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + }, + "sourcemaps:sources": [ + { + "@id": "#/source-map" + } + ] + }, + { + "@id": "#/declarations/Root", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Root", + "shacl:property": [ + { + "@id": "#/declarations/Root/property/am02" + }, + { + "@id": "#/declarations/Root/property/am01" + } + ], + "http://a.ml/vocabularies/amf/aml#or": [ + { + "@id": "#/declarations/Member1" + }, + { + "@id": "#/declarations/Member2" + }, + { + "@id": "#/declarations/Member3" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/source-map" + } + ] + }, + { + "@id": "#/declarations/Member1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Member1", + "shacl:property": [ + { + "@id": "#/declarations/Member1/property/am12" + }, + { + "@id": "#/declarations/Member1/property/am11" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/source-map" + } + ] + }, + { + "@id": "#/declarations/Member2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Member2", + "shacl:property": [ + { + "@id": "#/declarations/Member2/property/am22" + }, + { + "@id": "#/declarations/Member2/property/am21" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/source-map" + } + ] + }, + { + "@id": "#/declarations/Member3", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Member3", + "shacl:property": [ + { + "@id": "#/declarations/Member3/property/am31" + }, + { + "@id": "#/declarations/Member3/property/am32" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member3/source-map" + } + ] + }, + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_4" + }, + { + "@id": "#/source-map/lexical/element_2" + }, + { + "@id": "#/source-map/lexical/element_0" + }, + { + "@id": "#/source-map/lexical/element_1" + }, + { + "@id": "#/source-map/lexical/element_3" + } + ] + }, + { + "@id": "#/declarations/Root/property/am02", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am02" + } + ], + "core:name": "am02", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/am02/source-map" + } + ] + }, + { + "@id": "#/declarations/Root/property/am01", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am01" + } + ], + "core:name": "am01", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/am01/source-map" + } + ] + }, + { + "@id": "#/declarations/Root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member1/property/am12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am12" + } + ], + "core:name": "am12", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/property/am12/source-map" + } + ] + }, + { + "@id": "#/declarations/Member1/property/am11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am11" + } + ], + "core:name": "am11", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/property/am11/source-map" + } + ] + }, + { + "@id": "#/declarations/Member1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member2/property/am22", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am22" + } + ], + "core:name": "am22", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/property/am22/source-map" + } + ] + }, + { + "@id": "#/declarations/Member2/property/am21", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am21" + } + ], + "core:name": "am21", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/property/am21/source-map" + } + ] + }, + { + "@id": "#/declarations/Member2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member3/property/am31", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am31" + } + ], + "core:name": "am31", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member3/property/am31/source-map" + } + ] + }, + { + "@id": "#/declarations/Member3/property/am32", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am32" + } + ], + "core:name": "am32", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member3/property/am32/source-map" + } + ] + }, + { + "@id": "#/declarations/Member3/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member3/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member3/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member3/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/source-map/lexical/element_4", + "sourcemaps:element": "meta:externals", + "sourcemaps:value": "[(5,0)-(8,0)]" + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml", + "sourcemaps:value": "[(2,0)-(40,21)]" + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": "meta:documents", + "sourcemaps:value": "[(8,0)-(12,0)]" + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": "core:version", + "sourcemaps:value": "[(3,0)-(5,0)]" + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(2,0)-(3,0)]" + }, + { + "@id": "#/declarations/Root/property/am02/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Root/property/am01/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(13,2)-(13,6)]" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(18,4)-(23,0)]" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root", + "sourcemaps:value": "[(13,2)-(23,0)]" + }, + { + "@id": "#/declarations/Member1/property/am12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/property/am12/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member1/property/am12/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member1/property/am12/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member1/property/am11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/property/am11/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member1/property/am11/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member1/property/am11/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(23,2)-(23,9)]" + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(24,4)-(29,0)]" + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1", + "sourcemaps:value": "[(23,2)-(29,0)]" + }, + { + "@id": "#/declarations/Member2/property/am22/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/property/am22/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member2/property/am22/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member2/property/am22/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member2/property/am21/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/property/am21/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member2/property/am21/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member2/property/am21/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(29,2)-(29,9)]" + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(30,4)-(35,0)]" + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2", + "sourcemaps:value": "[(29,2)-(35,0)]" + }, + { + "@id": "#/declarations/Member3/property/am31/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member3/property/am31/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member3/property/am31/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member3/property/am31/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member3/property/am32/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member3/property/am32/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member3/property/am32/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member3/property/am32/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member3/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(35,2)-(35,9)]" + }, + { + "@id": "#/declarations/Member3/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(36,4)-(40,21)]" + }, + { + "@id": "#/declarations/Member3/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3", + "sourcemaps:value": "[(35,2)-(40,21)]" + }, + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(21,6)-(21,10)]" + }, + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(22,8)-(23,0)]" + }, + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root/property/am02", + "sourcemaps:value": "[(21,11)-(23,0)]" + }, + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(19,6)-(19,10)]" + }, + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(20,8)-(21,0)]" + }, + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root/property/am01", + "sourcemaps:value": "[(19,11)-(21,0)]" + }, + { + "@id": "#/declarations/Member1/property/am12/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(27,6)-(27,10)]" + }, + { + "@id": "#/declarations/Member1/property/am12/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(28,8)-(29,0)]" + }, + { + "@id": "#/declarations/Member1/property/am12/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1/property/am12", + "sourcemaps:value": "[(27,11)-(29,0)]" + }, + { + "@id": "#/declarations/Member1/property/am11/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(25,6)-(25,10)]" + }, + { + "@id": "#/declarations/Member1/property/am11/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(26,8)-(27,0)]" + }, + { + "@id": "#/declarations/Member1/property/am11/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1/property/am11", + "sourcemaps:value": "[(25,11)-(27,0)]" + }, + { + "@id": "#/declarations/Member2/property/am22/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(33,6)-(33,10)]" + }, + { + "@id": "#/declarations/Member2/property/am22/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(34,8)-(35,0)]" + }, + { + "@id": "#/declarations/Member2/property/am22/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2/property/am22", + "sourcemaps:value": "[(33,11)-(35,0)]" + }, + { + "@id": "#/declarations/Member2/property/am21/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(31,6)-(31,10)]" + }, + { + "@id": "#/declarations/Member2/property/am21/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(32,8)-(33,0)]" + }, + { + "@id": "#/declarations/Member2/property/am21/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2/property/am21", + "sourcemaps:value": "[(31,11)-(33,0)]" + }, + { + "@id": "#/declarations/Member3/property/am31/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(37,6)-(37,10)]" + }, + { + "@id": "#/declarations/Member3/property/am31/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(38,8)-(39,0)]" + }, + { + "@id": "#/declarations/Member3/property/am31/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3/property/am31", + "sourcemaps:value": "[(37,11)-(39,0)]" + }, + { + "@id": "#/declarations/Member3/property/am32/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(39,6)-(39,10)]" + }, + { + "@id": "#/declarations/Member3/property/am32/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(40,8)-(40,21)]" + }, + { + "@id": "#/declarations/Member3/property/am32/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3/property/am32", + "sourcemaps:value": "[(39,11)-(40,21)]" + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#", + "owl": "http://www.w3.org/2002/07/owl#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.resolved.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.resolved.expanded.jsonld new file mode 100644 index 00000000..1bb9ef2d --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.resolved.expanded.jsonld @@ -0,0 +1,715 @@ +[ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml", +"@type": [ +"http://a.ml/vocabularies/meta#Dialect", +"http://a.ml/vocabularies/document#Document", +"http://a.ml/vocabularies/document#Fragment", +"http://a.ml/vocabularies/document#Module", +"http://a.ml/vocabularies/document#Unit" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Mapping extended" +} +], +"http://a.ml/vocabularies/core#version": [ +{ +"@value": "1.0" +} +], +"http://a.ml/vocabularies/meta#extensions": [], +"http://a.ml/vocabularies/meta#externals": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml/externals/schema-org", +"@type": [ +"http://www.w3.org/2002/07/owl#Ontology", +"http://a.ml/vocabularies/meta#ExternalVocabulary", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#displayName": [ +{ +"@value": "schema-org" +} +], +"http://a.ml/vocabularies/meta#base": [ +{ +"@value": "https://schema.org/" +} +] +} +], +"http://a.ml/vocabularies/meta#documents": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml/documents", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentsModel", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/meta#rootDocument": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/documents/root", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Mapping extended 1.0" +} +], +"http://a.ml/vocabularies/meta#encodedNode": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root" +} +] +} +] +} +], +"http://a.ml/vocabularies/document#location": [ +{ +"@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml" +} +], +"http://a.ml/vocabularies/document#root": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/document#processingData": [ +{ +"@id": "null/BaseUnitProcessingData", +"@type": [ +"http://a.ml/vocabularies/document#BaseUnitProcessingData" +], +"http://a.ml/vocabularies/document#transformed": [ +{ +"@value": true +} +] +} +], +"http://a.ml/vocabularies/document#declares": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Member1" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml/CombiningMapping_1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_1" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am12" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am11" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root/property/am02", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am02" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am02" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root/property/am01", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am01" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am01" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Member3" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3/property/am31", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am31" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am31" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3/property/am32", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am32" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am32" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml/CombiningMapping_3", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_3" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3/property/am31", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am31" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am31" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3/property/am32", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am32" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am32" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root/property/am02", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am02" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am02" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root/property/am01", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am01" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am01" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Member2" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2/property/am22", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am22" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am22" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2/property/am21", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am21" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am21" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml/CombiningMapping_2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_2" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2/property/am22", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am22" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am22" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2/property/am21", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am21" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am21" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root/property/am02", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am02" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am02" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root/property/am01", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am01" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am01" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Root" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root/property/am02", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am02" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am02" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root/property/am01", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am01" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am01" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +], +"http://a.ml/vocabularies/amf/aml#or": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3" +} +] +} +] +} +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.resolved.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.resolved.flattened.jsonld new file mode 100644 index 00000000..f300fba3 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.resolved.flattened.jsonld @@ -0,0 +1,436 @@ +{ +"@graph": [ +{ +"@id": "null/BaseUnitProcessingData", +"@type": [ +"http://a.ml/vocabularies/document#BaseUnitProcessingData" +], +"http://a.ml/vocabularies/document#transformed": true +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml/documents", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentsModel", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/meta#rootDocument": { +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/documents/root" +} +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml/externals/schema-org", +"@type": [ +"http://www.w3.org/2002/07/owl#Ontology", +"http://a.ml/vocabularies/meta#ExternalVocabulary", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#displayName": "schema-org", +"http://a.ml/vocabularies/meta#base": "https://schema.org/" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/documents/root", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "Mapping extended 1.0", +"http://a.ml/vocabularies/meta#encodedNode": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml", +"http://a.ml/vocabularies/document#declares": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml/CombiningMapping_1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml/CombiningMapping_3" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml/CombiningMapping_2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root" +} +], +"@type": [ +"http://a.ml/vocabularies/meta#Dialect", +"http://a.ml/vocabularies/document#Document", +"http://a.ml/vocabularies/document#Fragment", +"http://a.ml/vocabularies/document#Module", +"http://a.ml/vocabularies/document#Unit" +], +"http://a.ml/vocabularies/core#name": "Mapping extended", +"http://a.ml/vocabularies/core#version": "1.0", +"http://a.ml/vocabularies/meta#extensions": [], +"http://a.ml/vocabularies/meta#externals": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml/externals/schema-org" +} +], +"http://a.ml/vocabularies/meta#documents": { +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml/documents" +}, +"http://a.ml/vocabularies/document#location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml", +"http://a.ml/vocabularies/document#root": false, +"http://a.ml/vocabularies/document#processingData": { +"@id": "null/BaseUnitProcessingData" +} +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "Member1", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1/property/am12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1/property/am11" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml/CombiningMapping_1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_1", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1/property/am12" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1/property/am11" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root/property/am02" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root/property/am01" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "Member3", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3/property/am31" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3/property/am32" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml/CombiningMapping_3", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_3", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3/property/am31" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3/property/am32" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root/property/am02" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root/property/am01" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "Member2", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2/property/am22" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2/property/am21" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml/CombiningMapping_2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_2", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2/property/am22" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2/property/am21" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root/property/am02" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root/property/am01" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "Root", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root/property/am02" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root/property/am01" +} +], +"http://a.ml/vocabularies/amf/aml#or": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1/property/am12", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am12" +} +], +"http://a.ml/vocabularies/core#name": "am12", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member1/property/am11", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am11" +} +], +"http://a.ml/vocabularies/core#name": "am11", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root/property/am02", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am02" +} +], +"http://a.ml/vocabularies/core#name": "am02", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Root/property/am01", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am01" +} +], +"http://a.ml/vocabularies/core#name": "am01", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3/property/am31", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am31" +} +], +"http://a.ml/vocabularies/core#name": "am31", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member3/property/am32", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am32" +} +], +"http://a.ml/vocabularies/core#name": "am32", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2/property/am22", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am22" +} +], +"http://a.ml/vocabularies/core#name": "am22", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml#/declarations/Member2/property/am21", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am21" +} +], +"http://a.ml/vocabularies/core#name": "am21", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.resolved.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.resolved.yaml new file mode 100644 index 00000000..1bd062a3 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.resolved.yaml @@ -0,0 +1,79 @@ +#%Dialect 1.0 +external: + schema-org: https://schema.org/ +documents: + root: + encodes: Root +nodeMappings: + Root: + oneOf: + - Member1 + - Member2 + - Member3 + mapping: + am01: + range: string + am02: + range: string + Member1: + mapping: + am11: + range: string + am12: + range: string + Member2: + mapping: + am21: + range: string + am22: + range: string + Member3: + mapping: + am31: + range: string + am32: + range: string + CombiningMapping_1: + components: + - Member1 + - Root + mapping: + am01: + range: string + am02: + range: string + am11: + range: string + am12: + range: string + additionalProperties: true + CombiningMapping_3: + components: + - Member3 + - Root + mapping: + am01: + range: string + am02: + range: string + am31: + range: string + am32: + range: string + additionalProperties: true + CombiningMapping_2: + components: + - Member2 + - Root + mapping: + am01: + range: string + am02: + range: string + am21: + range: string + am22: + range: string + additionalProperties: true +dialect: Mapping extended +version: "1.0" diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml new file mode 100644 index 00000000..f12a8850 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-2/dialect.yaml @@ -0,0 +1,40 @@ +#%Dialect 1.0 +dialect: Mapping extended +version: 1.0 + +external: + schema-org: https://schema.org/ + +documents: + root: + encodes: Root + +nodeMappings: + Root: + oneOf: + - Member1 + - Member2 + - Member3 + mapping: + am01: + range: string + am02: + range: string + Member1: + mapping: + am11: + range: string + am12: + range: string + Member2: + mapping: + am21: + range: string + am22: + range: string + Member3: + mapping: + am31: + range: string + am32: + range: string \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.cycled.jsonld.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.cycled.jsonld.yaml new file mode 100644 index 00000000..f943e851 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.cycled.jsonld.yaml @@ -0,0 +1,36 @@ +#%Dialect 1.0 +dialect: Mapping extended +version: "1.0" +external: + schema-org: https://schema.org/ +documents: + root: + encodes: Root +nodeMappings: + Root: + conditional: + if: ConditionMapping + then: ThenMapping + else: ElseMapping + mapping: + am01: + range: string + am02: + range: string + ConditionMapping: + mapping: + someField: + range: string + enum: + - conditional-value + mandatory: true + ThenMapping: + mapping: + someField: + range: string + propertyTerm: schema-org.name + ElseMapping: + mapping: + someOtherField: + range: string + propertyTerm: schema-org.description diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.cycled.yaml new file mode 100644 index 00000000..f943e851 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.cycled.yaml @@ -0,0 +1,36 @@ +#%Dialect 1.0 +dialect: Mapping extended +version: "1.0" +external: + schema-org: https://schema.org/ +documents: + root: + encodes: Root +nodeMappings: + Root: + conditional: + if: ConditionMapping + then: ThenMapping + else: ElseMapping + mapping: + am01: + range: string + am02: + range: string + ConditionMapping: + mapping: + someField: + range: string + enum: + - conditional-value + mandatory: true + ThenMapping: + mapping: + someField: + range: string + propertyTerm: schema-org.name + ElseMapping: + mapping: + someOtherField: + range: string + propertyTerm: schema-org.description diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.expanded.jsonld new file mode 100644 index 00000000..2262747a --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.expanded.jsonld @@ -0,0 +1,1002 @@ +[ + { + "@id": "", + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": [ + { + "@value": "Mapping extended" + } + ], + "core:version": [ + { + "@value": "1.0" + } + ], + "meta:externals": [ + { + "@id": "/externals/schema-org", + "@type": [ + "owl:Ontology", + "meta:ExternalVocabulary", + "doc:DomainElement" + ], + "core:displayName": [ + { + "@value": "schema-org" + } + ], + "meta:base": [ + { + "@value": "https://schema.org/" + } + ], + "sourcemaps:sources": [ + { + "@id": "/externals/schema-org#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/externals/schema-org#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:displayName" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,2)-(6,12)]" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:base" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,14)-(6,33)]" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml/externals/schema-org" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,2)-(8,0)]" + } + ] + } + ] + } + ] + } + ], + "meta:documents": [ + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": [ + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Mapping extended 1.0" + } + ], + "meta:encodedNode": [ + { + "@id": "#/declarations/Root" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/documents/root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,7)-(12,0)]" + } + ] + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:encodedNode" + } + ], + "sourcemaps:value": [ + { + "@value": "[(10,4)-(12,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml/documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,0)-(12,0)]" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:rootDocument" + } + ], + "sourcemaps:value": [ + { + "@value": "[(9,2)-(12,0)]" + } + ] + } + ] + } + ] + } + ], + "doc:location": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml" + } + ], + "doc:root": [ + { + "@value": true + } + ], + "doc:processingData": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": [ + { + "@value": false + } + ], + "doc:sourceSpec": [ + { + "@value": "AML 1.0" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_4", + "sourcemaps:element": [ + { + "@value": "meta:externals" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,0)-(8,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(38,44)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(8,0)-(12,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:version" + } + ], + "sourcemaps:value": [ + { + "@value": "[(3,0)-(5,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + } + ] + } + ], + "doc:declares": [ + { + "@id": "#/declarations/Root", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Root" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Root/property/am02", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am02" + } + ], + "core:name": [ + { + "@value": "am02" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/am02/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(21,6)-(21,10)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(22,8)-(23,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root/property/am02" + } + ], + "sourcemaps:value": [ + { + "@value": "[(21,11)-(23,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Root/property/am01", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am01" + } + ], + "core:name": [ + { + "@value": "am01" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/am01/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(19,6)-(19,10)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(20,8)-(21,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root/property/am01" + } + ], + "sourcemaps:value": [ + { + "@value": "[(19,11)-(21,0)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/amf/aml#if": [ + { + "@id": "#/declarations/ConditionMapping" + } + ], + "http://a.ml/vocabularies/amf/aml#then": [ + { + "@id": "#/declarations/ThenMapping" + } + ], + "http://a.ml/vocabularies/amf/aml#else": [ + { + "@id": "#/declarations/ElseMapping" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(13,2)-(13,6)]" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(18,4)-(23,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(13,2)-(23,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/ConditionMapping", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "ConditionMapping" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/ConditionMapping/property/someField", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#someField" + } + ], + "core:name": [ + { + "@value": "someField" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:minCount": [ + { + "@value": 1 + } + ], + "shacl:in": [ + { + "@id": "#/declarations/ConditionMapping/property/someField/list", + "@type": "rdfs:Seq", + "rdfs:_1": [ + { + "@value": "conditional-value", + "@type": "xsd:string" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_4", + "sourcemaps:element": [ + { + "@value": "shacl:minCount" + } + ], + "sourcemaps:value": [ + { + "@value": "[(28,8)-(29,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ConditionMapping/property/someField" + } + ], + "sourcemaps:value": [ + { + "@value": "[(25,16)-(29,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:in" + } + ], + "sourcemaps:value": [ + { + "@value": "[(27,8)-(28,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(26,8)-(27,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(25,6)-(25,15)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionMapping/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(23,2)-(23,18)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMapping/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(24,4)-(29,0)]" + } + ] + }, + { + "@id": "#/declarations/ConditionMapping/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ConditionMapping" + } + ], + "sourcemaps:value": [ + { + "@value": "[(23,2)-(29,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/ThenMapping", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "ThenMapping" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/ThenMapping/property/someField", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/name" + } + ], + "core:name": [ + { + "@value": "someField" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ThenMapping/property/someField/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(31,6)-(31,15)]" + } + ] + }, + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "shacl:path" + } + ], + "sourcemaps:value": [ + { + "@value": "[(33,8)-(34,0)]" + } + ] + }, + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(32,8)-(33,0)]" + } + ] + }, + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ThenMapping/property/someField" + } + ], + "sourcemaps:value": [ + { + "@value": "[(31,16)-(34,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ThenMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ThenMapping/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(29,2)-(29,13)]" + } + ] + }, + { + "@id": "#/declarations/ThenMapping/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(30,4)-(34,0)]" + } + ] + }, + { + "@id": "#/declarations/ThenMapping/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ThenMapping" + } + ], + "sourcemaps:value": [ + { + "@value": "[(29,2)-(34,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/ElseMapping", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "ElseMapping" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/ElseMapping/property/someOtherField", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/description" + } + ], + "core:name": [ + { + "@value": "someOtherField" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(36,6)-(36,20)]" + } + ] + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "shacl:path" + } + ], + "sourcemaps:value": [ + { + "@value": "[(38,8)-(38,44)]" + } + ] + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(37,8)-(38,0)]" + } + ] + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ElseMapping/property/someOtherField" + } + ], + "sourcemaps:value": [ + { + "@value": "[(36,21)-(38,44)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ElseMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ElseMapping/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(34,2)-(34,13)]" + } + ] + }, + { + "@id": "#/declarations/ElseMapping/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(35,4)-(38,44)]" + } + ] + }, + { + "@id": "#/declarations/ElseMapping/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ElseMapping" + } + ], + "sourcemaps:value": [ + { + "@value": "[(34,2)-(38,44)]" + } + ] + } + ] + } + ] + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "owl": "http://www.w3.org/2002/07/owl#", + "meta": "http://a.ml/vocabularies/meta#", + "xsd": "http://www.w3.org/2001/XMLSchema#" + } + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.flattened.jsonld new file mode 100644 index 00000000..ead4499d --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.flattened.jsonld @@ -0,0 +1,784 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/externals/schema-org", + "@type": [ + "owl:Ontology", + "meta:ExternalVocabulary", + "doc:DomainElement" + ], + "core:displayName": "schema-org", + "meta:base": "https://schema.org/", + "sourcemaps:sources": [ + { + "@id": "/externals/schema-org#/source-map" + } + ] + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + }, + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/externals/schema-org#/source-map/lexical/element_2" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_0" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "Mapping extended 1.0", + "meta:encodedNode": [ + { + "@id": "#/declarations/Root" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map" + } + ] + }, + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1" + }, + { + "@id": "/documents#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_2", + "sourcemaps:element": "core:displayName", + "sourcemaps:value": "[(6,2)-(6,12)]" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_0", + "sourcemaps:element": "meta:base", + "sourcemaps:value": "[(6,14)-(6,33)]" + }, + { + "@id": "/externals/schema-org#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml/externals/schema-org", + "sourcemaps:value": "[(6,2)-(8,0)]" + }, + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml/documents", + "sourcemaps:value": "[(9,0)-(12,0)]" + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": "meta:rootDocument", + "sourcemaps:value": "[(9,2)-(12,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/documents/root", + "sourcemaps:value": "[(9,7)-(12,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": "meta:encodedNode", + "sourcemaps:value": "[(10,4)-(12,0)]" + }, + { + "@id": "", + "doc:declares": [ + { + "@id": "#/declarations/Root" + }, + { + "@id": "#/declarations/ConditionMapping" + }, + { + "@id": "#/declarations/ThenMapping" + }, + { + "@id": "#/declarations/ElseMapping" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "Mapping extended", + "core:version": "1.0", + "meta:externals": [ + { + "@id": "/externals/schema-org" + } + ], + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + }, + "sourcemaps:sources": [ + { + "@id": "#/source-map" + } + ] + }, + { + "@id": "#/declarations/Root", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Root", + "shacl:property": [ + { + "@id": "#/declarations/Root/property/am02" + }, + { + "@id": "#/declarations/Root/property/am01" + } + ], + "http://a.ml/vocabularies/amf/aml#if": [ + { + "@id": "#/declarations/ConditionMapping" + } + ], + "http://a.ml/vocabularies/amf/aml#then": [ + { + "@id": "#/declarations/ThenMapping" + } + ], + "http://a.ml/vocabularies/amf/aml#else": [ + { + "@id": "#/declarations/ElseMapping" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/source-map" + } + ] + }, + { + "@id": "#/declarations/ConditionMapping", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "ConditionMapping", + "shacl:property": [ + { + "@id": "#/declarations/ConditionMapping/property/someField" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionMapping/source-map" + } + ] + }, + { + "@id": "#/declarations/ThenMapping", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "ThenMapping", + "shacl:property": [ + { + "@id": "#/declarations/ThenMapping/property/someField" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ThenMapping/source-map" + } + ] + }, + { + "@id": "#/declarations/ElseMapping", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "ElseMapping", + "shacl:property": [ + { + "@id": "#/declarations/ElseMapping/property/someOtherField" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ElseMapping/source-map" + } + ] + }, + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_4" + }, + { + "@id": "#/source-map/lexical/element_2" + }, + { + "@id": "#/source-map/lexical/element_0" + }, + { + "@id": "#/source-map/lexical/element_1" + }, + { + "@id": "#/source-map/lexical/element_3" + } + ] + }, + { + "@id": "#/declarations/Root/property/am02", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am02" + } + ], + "core:name": "am02", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/am02/source-map" + } + ] + }, + { + "@id": "#/declarations/Root/property/am01", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#am01" + } + ], + "core:name": "am01", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/am01/source-map" + } + ] + }, + { + "@id": "#/declarations/Root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/ConditionMapping/property/someField", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#someField" + } + ], + "core:name": "someField", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:minCount": 1, + "shacl:in": { + "@id": "#/declarations/ConditionMapping/property/someField/list" + }, + "sourcemaps:sources": [ + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map" + } + ] + }, + { + "@id": "#/declarations/ConditionMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionMapping/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/ConditionMapping/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ConditionMapping/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/ThenMapping/property/someField", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/name" + } + ], + "core:name": "someField", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ThenMapping/property/someField/source-map" + } + ] + }, + { + "@id": "#/declarations/ThenMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ThenMapping/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/ThenMapping/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ThenMapping/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "https://schema.org/description" + } + ], + "core:name": "someOtherField", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map" + } + ] + }, + { + "@id": "#/declarations/ElseMapping/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ElseMapping/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/ElseMapping/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ElseMapping/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/source-map/lexical/element_4", + "sourcemaps:element": "meta:externals", + "sourcemaps:value": "[(5,0)-(8,0)]" + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml", + "sourcemaps:value": "[(2,0)-(38,44)]" + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": "meta:documents", + "sourcemaps:value": "[(8,0)-(12,0)]" + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": "core:version", + "sourcemaps:value": "[(3,0)-(5,0)]" + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(2,0)-(3,0)]" + }, + { + "@id": "#/declarations/Root/property/am02/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Root/property/am01/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(13,2)-(13,6)]" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(18,4)-(23,0)]" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root", + "sourcemaps:value": "[(13,2)-(23,0)]" + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/list", + "@type": "rdfs:Seq", + "rdfs:_1": { + "@value": "conditional-value", + "@type": "xsd:string" + } + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_4" + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_3" + } + ] + }, + { + "@id": "#/declarations/ConditionMapping/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(23,2)-(23,18)]" + }, + { + "@id": "#/declarations/ConditionMapping/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(24,4)-(29,0)]" + }, + { + "@id": "#/declarations/ConditionMapping/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ConditionMapping", + "sourcemaps:value": "[(23,2)-(29,0)]" + }, + { + "@id": "#/declarations/ThenMapping/property/someField/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/ThenMapping/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(29,2)-(29,13)]" + }, + { + "@id": "#/declarations/ThenMapping/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(30,4)-(34,0)]" + }, + { + "@id": "#/declarations/ThenMapping/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ThenMapping", + "sourcemaps:value": "[(29,2)-(34,0)]" + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/ElseMapping/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(34,2)-(34,13)]" + }, + { + "@id": "#/declarations/ElseMapping/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(35,4)-(38,44)]" + }, + { + "@id": "#/declarations/ElseMapping/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ElseMapping", + "sourcemaps:value": "[(34,2)-(38,44)]" + }, + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(21,6)-(21,10)]" + }, + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(22,8)-(23,0)]" + }, + { + "@id": "#/declarations/Root/property/am02/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root/property/am02", + "sourcemaps:value": "[(21,11)-(23,0)]" + }, + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(19,6)-(19,10)]" + }, + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(20,8)-(21,0)]" + }, + { + "@id": "#/declarations/Root/property/am01/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root/property/am01", + "sourcemaps:value": "[(19,11)-(21,0)]" + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_4", + "sourcemaps:element": "shacl:minCount", + "sourcemaps:value": "[(28,8)-(29,0)]" + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ConditionMapping/property/someField", + "sourcemaps:value": "[(25,16)-(29,0)]" + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_0", + "sourcemaps:element": "shacl:in", + "sourcemaps:value": "[(27,8)-(28,0)]" + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_1", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(26,8)-(27,0)]" + }, + { + "@id": "#/declarations/ConditionMapping/property/someField/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(25,6)-(25,15)]" + }, + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(31,6)-(31,15)]" + }, + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_1", + "sourcemaps:element": "shacl:path", + "sourcemaps:value": "[(33,8)-(34,0)]" + }, + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(32,8)-(33,0)]" + }, + { + "@id": "#/declarations/ThenMapping/property/someField/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ThenMapping/property/someField", + "sourcemaps:value": "[(31,16)-(34,0)]" + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(36,6)-(36,20)]" + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_1", + "sourcemaps:element": "shacl:path", + "sourcemaps:value": "[(38,8)-(38,44)]" + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(37,8)-(38,0)]" + }, + { + "@id": "#/declarations/ElseMapping/property/someOtherField/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ElseMapping/property/someOtherField", + "sourcemaps:value": "[(36,21)-(38,44)]" + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#", + "owl": "http://www.w3.org/2002/07/owl#", + "xsd": "http://www.w3.org/2001/XMLSchema#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.resolved.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.resolved.expanded.jsonld new file mode 100644 index 00000000..0f10b913 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.resolved.expanded.jsonld @@ -0,0 +1,502 @@ +[ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml", +"@type": [ +"http://a.ml/vocabularies/meta#Dialect", +"http://a.ml/vocabularies/document#Document", +"http://a.ml/vocabularies/document#Fragment", +"http://a.ml/vocabularies/document#Module", +"http://a.ml/vocabularies/document#Unit" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Mapping extended" +} +], +"http://a.ml/vocabularies/core#version": [ +{ +"@value": "1.0" +} +], +"http://a.ml/vocabularies/meta#extensions": [], +"http://a.ml/vocabularies/meta#externals": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml/externals/schema-org", +"@type": [ +"http://www.w3.org/2002/07/owl#Ontology", +"http://a.ml/vocabularies/meta#ExternalVocabulary", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#displayName": [ +{ +"@value": "schema-org" +} +], +"http://a.ml/vocabularies/meta#base": [ +{ +"@value": "https://schema.org/" +} +] +} +], +"http://a.ml/vocabularies/meta#documents": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml/documents", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentsModel", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/meta#rootDocument": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/documents/root", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Mapping extended 1.0" +} +], +"http://a.ml/vocabularies/meta#encodedNode": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root" +} +] +} +] +} +], +"http://a.ml/vocabularies/document#location": [ +{ +"@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml" +} +], +"http://a.ml/vocabularies/document#root": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/document#processingData": [ +{ +"@id": "null/BaseUnitProcessingData", +"@type": [ +"http://a.ml/vocabularies/document#BaseUnitProcessingData" +], +"http://a.ml/vocabularies/document#transformed": [ +{ +"@value": true +} +] +} +], +"http://a.ml/vocabularies/document#declares": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ElseMapping", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "ElseMapping" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ElseMapping/property/someOtherField", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/description" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "someOtherField" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml/CombiningMapping_1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_1" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ThenMapping/property/someField", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/name" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "someField" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root/property/am02", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am02" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am02" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root/property/am01", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am01" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am01" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ThenMapping" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ThenMapping" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ThenMapping", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "ThenMapping" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ThenMapping/property/someField", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/name" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "someField" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml/CombiningMapping_2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "CombiningMapping_2" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ElseMapping/property/someOtherField", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/description" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "someOtherField" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root/property/am02", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am02" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am02" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root/property/am01", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am01" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am01" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ElseMapping" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root" +} +], +"http://www.w3.org/ns/shacl#closed": [ +{ +"@value": false +} +], +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ElseMapping" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ConditionMapping", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "ConditionMapping" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ConditionMapping/property/someField", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#someField" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "someField" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +], +"http://www.w3.org/ns/shacl#minCount": [ +{ +"@value": 1 +} +], +"http://www.w3.org/ns/shacl#in": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ConditionMapping/property/someField/list", +"@type": "http://www.w3.org/2000/01/rdf-schema#Seq", +"http://www.w3.org/2000/01/rdf-schema#_1": [ +{ +"@value": "conditional-value", +"@type": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +] +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "Root" +} +], +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root/property/am02", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am02" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am02" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root/property/am01", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am01" +} +], +"http://a.ml/vocabularies/core#name": [ +{ +"@value": "am01" +} +], +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +} +], +"http://a.ml/vocabularies/amf/aml#if": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ConditionMapping" +} +], +"http://a.ml/vocabularies/amf/aml#then": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ThenMapping" +} +], +"http://a.ml/vocabularies/amf/aml#else": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ElseMapping" +} +] +} +] +} +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.resolved.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.resolved.flattened.jsonld new file mode 100644 index 00000000..f7c6bd9d --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.resolved.flattened.jsonld @@ -0,0 +1,340 @@ +{ +"@graph": [ +{ +"@id": "null/BaseUnitProcessingData", +"@type": [ +"http://a.ml/vocabularies/document#BaseUnitProcessingData" +], +"http://a.ml/vocabularies/document#transformed": true +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml/documents", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentsModel", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/meta#rootDocument": { +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/documents/root" +} +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml/externals/schema-org", +"@type": [ +"http://www.w3.org/2002/07/owl#Ontology", +"http://a.ml/vocabularies/meta#ExternalVocabulary", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#displayName": "schema-org", +"http://a.ml/vocabularies/meta#base": "https://schema.org/" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/documents/root", +"@type": [ +"http://a.ml/vocabularies/meta#DocumentMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "Mapping extended 1.0", +"http://a.ml/vocabularies/meta#encodedNode": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml", +"http://a.ml/vocabularies/document#declares": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ElseMapping" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml/CombiningMapping_1" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ThenMapping" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml/CombiningMapping_2" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ConditionMapping" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root" +} +], +"@type": [ +"http://a.ml/vocabularies/meta#Dialect", +"http://a.ml/vocabularies/document#Document", +"http://a.ml/vocabularies/document#Fragment", +"http://a.ml/vocabularies/document#Module", +"http://a.ml/vocabularies/document#Unit" +], +"http://a.ml/vocabularies/core#name": "Mapping extended", +"http://a.ml/vocabularies/core#version": "1.0", +"http://a.ml/vocabularies/meta#extensions": [], +"http://a.ml/vocabularies/meta#externals": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml/externals/schema-org" +} +], +"http://a.ml/vocabularies/meta#documents": { +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml/documents" +}, +"http://a.ml/vocabularies/document#location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml", +"http://a.ml/vocabularies/document#root": false, +"http://a.ml/vocabularies/document#processingData": { +"@id": "null/BaseUnitProcessingData" +} +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ElseMapping", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "ElseMapping", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ElseMapping/property/someOtherField" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml/CombiningMapping_1", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_1", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ThenMapping/property/someField" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root/property/am02" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root/property/am01" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ThenMapping" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ThenMapping" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ThenMapping", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "ThenMapping", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ThenMapping/property/someField" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml/CombiningMapping_2", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "CombiningMapping_2", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ElseMapping/property/someOtherField" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root/property/am02" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root/property/am01" +} +], +"http://a.ml/vocabularies/meta#resolvedExtends": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ElseMapping" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root" +} +], +"http://www.w3.org/ns/shacl#closed": false, +"http://a.ml/vocabularies/amf/aml#components": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ElseMapping" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ConditionMapping", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "ConditionMapping", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ConditionMapping/property/someField" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root", +"@type": [ +"http://a.ml/vocabularies/meta#NodeMapping", +"http://www.w3.org/ns/shacl#Shape", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://a.ml/vocabularies/core#name": "Root", +"http://www.w3.org/ns/shacl#property": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root/property/am02" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root/property/am01" +} +], +"http://a.ml/vocabularies/amf/aml#if": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ConditionMapping" +} +], +"http://a.ml/vocabularies/amf/aml#then": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ThenMapping" +} +], +"http://a.ml/vocabularies/amf/aml#else": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ElseMapping" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ElseMapping/property/someOtherField", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/description" +} +], +"http://a.ml/vocabularies/core#name": "someOtherField", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ThenMapping/property/someField", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "https://schema.org/name" +} +], +"http://a.ml/vocabularies/core#name": "someField", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root/property/am02", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am02" +} +], +"http://a.ml/vocabularies/core#name": "am02", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/Root/property/am01", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#am01" +} +], +"http://a.ml/vocabularies/core#name": "am01", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ConditionMapping/property/someField", +"@type": [ +"http://a.ml/vocabularies/meta#NodePropertyMapping", +"http://a.ml/vocabularies/document#DomainElement" +], +"http://www.w3.org/ns/shacl#path": [ +{ +"@id": "http://a.ml/vocabularies/data#someField" +} +], +"http://a.ml/vocabularies/core#name": "someField", +"http://www.w3.org/ns/shacl#datatype": [ +{ +"@id": "http://www.w3.org/2001/XMLSchema#string" +} +], +"http://www.w3.org/ns/shacl#minCount": 1, +"http://www.w3.org/ns/shacl#in": { +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ConditionMapping/property/someField/list" +} +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml#/declarations/ConditionMapping/property/someField/list", +"@type": "http://www.w3.org/2000/01/rdf-schema#Seq", +"http://www.w3.org/2000/01/rdf-schema#_1": { +"@value": "conditional-value", +"@type": "http://www.w3.org/2001/XMLSchema#string" +} +} +] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.resolved.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.resolved.yaml new file mode 100644 index 00000000..85956b16 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.resolved.yaml @@ -0,0 +1,62 @@ +#%Dialect 1.0 +external: + schema-org: https://schema.org/ +documents: + root: + encodes: Root +nodeMappings: + Root: + conditional: + if: ConditionMapping + then: ThenMapping + else: ElseMapping + mapping: + am01: + range: string + am02: + range: string + ConditionMapping: + mapping: + someField: + range: string + enum: + - conditional-value + mandatory: true + ThenMapping: + mapping: + someField: + range: string + propertyTerm: schema-org.name + ElseMapping: + mapping: + someOtherField: + range: string + propertyTerm: schema-org.description + CombiningMapping_1: + components: + - ThenMapping + - Root + mapping: + am01: + range: string + am02: + range: string + someField: + range: string + propertyTerm: schema-org.name + additionalProperties: true + CombiningMapping_2: + components: + - ElseMapping + - Root + mapping: + am01: + range: string + am02: + range: string + someOtherField: + range: string + propertyTerm: schema-org.description + additionalProperties: true +dialect: Mapping extended +version: "1.0" diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml new file mode 100644 index 00000000..bb44c634 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/extended-mapping-3/dialect.yaml @@ -0,0 +1,38 @@ +#%Dialect 1.0 +dialect: Mapping extended +version: 1.0 + +external: + schema-org: https://schema.org/ + +documents: + root: + encodes: Root + +nodeMappings: + Root: + conditional: + if: ConditionMapping + then: ThenMapping + else: ElseMapping + mapping: + am01: + range: string + am02: + range: string + ConditionMapping: + mapping: + someField: + range: string + enum: [ "conditional-value" ] + mandatory: true + ThenMapping: + mapping: + someField: + range: string + propertyTerm: schema-org.name + ElseMapping: + mapping: + someOtherField: + range: string + propertyTerm: schema-org.description \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive-fragment/dialect.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive-fragment/dialect.jsonld new file mode 100644 index 00000000..c4195266 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive-fragment/dialect.jsonld @@ -0,0 +1,185 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + } + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "Test 1.0", + "meta:encodedNode": [ + { + "@id": "#/declarations/RootNode" + } + ] + }, + { + "@id": "", + "doc:references": [ + { + "@id": "https://fragments.aml/test-1-0" + } + ], + "doc:declares": [ + { + "@id": "#/declarations/AnotherNode" + }, + { + "@id": "#/declarations/RootNode" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "Test", + "core:version": "1.0", + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive-fragment/dialect.yaml", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + } + }, + { + "@id": "https://fragments.aml/test-1-0", + "@type": [ + "meta:DialectFragment", + "doc:Fragment", + "doc:Unit" + ], + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive-fragment/fragment.yaml", + "doc:encodes": { + "@id": "https://fragments.aml/test-1-0/fragment" + }, + "doc:references": [], + "doc:root": false, + "doc:processingData": { + "@id": "https://fragments.aml/test-1-0#/BaseUnitProcessingData" + } + }, + { + "@id": "#/declarations/AnotherNode", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "AnotherNode", + "doc:link-target": [ + { + "@id": "https://fragments.aml/test-1-0/fragment" + } + ], + "doc:link-label": "fragment.yaml" + }, + { + "@id": "#/declarations/RootNode", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "RootNode", + "shacl:property": [ + { + "@id": "#/declarations/RootNode/property/myProperty" + } + ] + }, + { + "@id": "https://fragments.aml/test-1-0/fragment", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "fragment", + "shacl:property": [ + { + "@id": "https://fragments.aml/test-1-0/fragment/property/anotherProperty" + } + ] + }, + { + "@id": "https://fragments.aml/test-1-0#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "#/declarations/RootNode/property/myProperty", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#myProperty" + } + ], + "core:name": "myProperty", + "shacl:node": { + "@id": "#/declarations/RootNode/property/myProperty/list" + } + }, + { + "@id": "https://fragments.aml/test-1-0/fragment/property/anotherProperty", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#anotherProperty" + } + ], + "core:name": "anotherProperty", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + }, + { + "@id": "#/declarations/RootNode/property/myProperty/list", + "@type": "rdfs:Seq", + "rdfs:_1": { + "@id": "#/declarations/AnotherNode" + } + } + ], + "@context": { + "@base": "https://dialects.aml/test-1-0", + "shacl": "http://www.w3.org/ns/shacl#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "meta": "http://a.ml/vocabularies/meta#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive-fragment/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive-fragment/dialect.yaml new file mode 100644 index 00000000..187a0595 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive-fragment/dialect.yaml @@ -0,0 +1,13 @@ +#%Dialect 1.0 +$id: https://dialects.aml/test-1-0 +dialect: Test +version: "1.0" +nodeMappings: + AnotherNode: !include fragment.yaml + RootNode: + mapping: + myProperty: + range: AnotherNode +documents: + root: + encodes: RootNode \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive-fragment/fragment.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive-fragment/fragment.yaml new file mode 100644 index 00000000..42fbf1b9 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive-fragment/fragment.yaml @@ -0,0 +1,5 @@ +#%NodeMapping/Dialect1.0 +$id: https://fragments.aml/test-1-0 +mapping: + anotherProperty: + range: string \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive-library/dialect.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive-library/dialect.jsonld new file mode 100644 index 00000000..66910998 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive-library/dialect.jsonld @@ -0,0 +1,189 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + } + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "Test 1.0", + "meta:encodedNode": [ + { + "@id": "#/declarations/RootNode" + } + ] + }, + { + "@id": "", + "doc:references": [ + { + "@id": "https://libraries.aml/test-1-0" + } + ], + "doc:declares": [ + { + "@id": "#/declarations/AnotherNode" + }, + { + "@id": "#/declarations/RootNode" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "Test", + "core:version": "1.0", + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive-library/dialect.yaml", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + } + }, + { + "@id": "https://libraries.aml/test-1-0", + "@type": [ + "meta:DialectLibrary", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive-library/library.yaml", + "doc:declares": [ + { + "@id": "https://libraries.aml/test-1-0#/declarations/AnotherNode" + } + ], + "doc:references": [], + "doc:root": false, + "doc:processingData": { + "@id": "null/BaseUnitProcessingData" + } + }, + { + "@id": "#/declarations/AnotherNode", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "AnotherNode", + "doc:link-target": [ + { + "@id": "https://libraries.aml/test-1-0#/declarations/AnotherNode" + } + ], + "doc:link-label": "lib.AnotherNode" + }, + { + "@id": "#/declarations/RootNode", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "RootNode", + "shacl:property": [ + { + "@id": "#/declarations/RootNode/property/myProperty" + } + ] + }, + { + "@id": "https://libraries.aml/test-1-0#/declarations/AnotherNode", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "AnotherNode", + "shacl:property": [ + { + "@id": "https://libraries.aml/test-1-0#/declarations/AnotherNode/property/anotherProperty" + } + ] + }, + { + "@id": "null/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "#/declarations/RootNode/property/myProperty", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#myProperty" + } + ], + "core:name": "myProperty", + "shacl:node": { + "@id": "#/declarations/RootNode/property/myProperty/list" + } + }, + { + "@id": "https://libraries.aml/test-1-0#/declarations/AnotherNode/property/anotherProperty", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#anotherProperty" + } + ], + "core:name": "anotherProperty", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + }, + { + "@id": "#/declarations/RootNode/property/myProperty/list", + "@type": "rdfs:Seq", + "rdfs:_1": { + "@id": "#/declarations/AnotherNode" + } + } + ], + "@context": { + "@base": "https://dialects.aml/test-1-0", + "shacl": "http://www.w3.org/ns/shacl#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "meta": "http://a.ml/vocabularies/meta#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive-library/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive-library/dialect.yaml new file mode 100644 index 00000000..732af202 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive-library/dialect.yaml @@ -0,0 +1,15 @@ +#%Dialect 1.0 +$id: https://dialects.aml/test-1-0 +dialect: Test +version: "1.0" +uses: + lib: library.yaml +nodeMappings: + AnotherNode: lib.AnotherNode + RootNode: + mapping: + myProperty: + range: AnotherNode +documents: + root: + encodes: RootNode \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive-library/library.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive-library/library.yaml new file mode 100644 index 00000000..30fbce78 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive-library/library.yaml @@ -0,0 +1,7 @@ +#%Library/Dialect1.0 +$id: https://libraries.aml/test-1-0 +nodeMappings: + AnotherNode: + mapping: + anotherProperty: + range: string \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive/dialect.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive/dialect.jsonld new file mode 100644 index 00000000..d2d4daff --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive/dialect.jsonld @@ -0,0 +1,99 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + } + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "Test 1.0", + "meta:encodedNode": [ + { + "@id": "#/declarations/RootNode" + } + ] + }, + { + "@id": "", + "doc:declares": [ + { + "@id": "#/declarations/RootNode" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "Test", + "core:version": "1.0", + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive/dialect.yaml", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + } + }, + { + "@id": "#/declarations/RootNode", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "RootNode", + "shacl:property": [ + { + "@id": "#/declarations/RootNode/property/myProperty" + } + ] + }, + { + "@id": "#/declarations/RootNode/property/myProperty", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#myProperty" + } + ], + "core:name": "myProperty", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "@context": { + "@base": "https://dialects.aml/test-1-0", + "shacl": "http://www.w3.org/ns/shacl#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "meta": "http://a.ml/vocabularies/meta#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive/dialect.yaml new file mode 100644 index 00000000..80a30743 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/id-directive/dialect.yaml @@ -0,0 +1,12 @@ +#%Dialect 1.0 +$id: https://dialects.aml/test-1-0 +dialect: Test +version: "1.0" +nodeMappings: + RootNode: + mapping: + myProperty: + range: string +documents: + root: + encodes: RootNode \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/simple/dialect.json b/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/simple/dialect.json new file mode 100644 index 00000000..f4e3d467 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/simple/dialect.json @@ -0,0 +1,28 @@ +{ + "$type": "Dialect 1.0", + "dialect": "Movie", + "version": "1.0", + "nodeMappings": { + "Movie": { + "classTerm": "movies.Movie", + "mapping": { + "title": { + "propertyTerm": "movies.title", + "range": "string" + }, + "director": { + "propertyTerm": "movies.directedBy", + "range": "string" + } + } + } + }, + "documents": { + "root": { + "encodes": "Movie" + } + }, + "external": { + "movies": "http://schema.org/movies/" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/simple/dialect.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/simple/dialect.jsonld new file mode 100644 index 00000000..5f789eb6 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/simple/dialect.jsonld @@ -0,0 +1,141 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/externals/movies", + "@type": [ + "owl:Ontology", + "meta:ExternalVocabulary", + "doc:DomainElement" + ], + "core:displayName": "movies", + "meta:base": "http://schema.org/movies/" + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + } + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "Movie 1.0", + "meta:encodedNode": [ + { + "@id": "#/declarations/Movie" + } + ] + }, + { + "@id": "", + "doc:declares": [ + { + "@id": "#/declarations/Movie" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "Movie", + "core:version": "1.0", + "meta:externals": [ + { + "@id": "/externals/movies" + } + ], + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/json/simple/dialect.json", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + } + }, + { + "@id": "#/declarations/Movie", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "shacl:targetClass": [ + { + "@id": "http://schema.org/movies/Movie" + } + ], + "core:name": "Movie", + "shacl:property": [ + { + "@id": "#/declarations/Movie/property/title" + }, + { + "@id": "#/declarations/Movie/property/director" + } + ] + }, + { + "@id": "#/declarations/Movie/property/title", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://schema.org/movies/title" + } + ], + "core:name": "title", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + }, + { + "@id": "#/declarations/Movie/property/director", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://schema.org/movies/directedBy" + } + ], + "core:name": "director", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/json/simple/dialect.json", + "shacl": "http://www.w3.org/ns/shacl#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "meta": "http://a.ml/vocabularies/meta#", + "owl": "http://www.w3.org/2002/07/owl#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-library/dialect.cycled.json b/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-library/dialect.cycled.json new file mode 100644 index 00000000..63911eb2 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-library/dialect.cycled.json @@ -0,0 +1,23 @@ +{ + "$type": "Dialect 1.0", + "dialect": "Test", + "version": "1.0", + "nodeMappings": { + "AnotherNode": "lib.AnotherNode", + "RootNode": { + "mapping": { + "myProperty": { + "range": "AnotherNode" + } + } + } + }, + "documents": { + "root": { + "encodes": "RootNode" + } + }, + "uses": { + "lib": "library.json" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-library/dialect.json b/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-library/dialect.json new file mode 100644 index 00000000..5a98b3ce --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-library/dialect.json @@ -0,0 +1,23 @@ +{ + "$type": "Dialect 1.0", + "dialect": "Test", + "version": "1.0", + "uses": { + "lib": "library.json" + }, + "nodeMappings": { + "AnotherNode": "lib.AnotherNode", + "RootNode": { + "mapping": { + "myProperty": { + "range": "AnotherNode" + } + } + } + }, + "documents": { + "root": { + "encodes": "RootNode" + } + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-library/dialect.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-library/dialect.jsonld new file mode 100644 index 00000000..11510f11 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-library/dialect.jsonld @@ -0,0 +1,189 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + } + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "Test 1.0", + "meta:encodedNode": [ + { + "@id": "#/declarations/RootNode" + } + ] + }, + { + "@id": "", + "doc:references": [ + { + "@id": "./library.json" + } + ], + "doc:declares": [ + { + "@id": "#/declarations/AnotherNode" + }, + { + "@id": "#/declarations/RootNode" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "Test", + "core:version": "1.0", + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-library/dialect.json", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + } + }, + { + "@id": "./library.json", + "@type": [ + "meta:DialectLibrary", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-library/library.json", + "doc:declares": [ + { + "@id": "./library.json#/declarations/AnotherNode" + } + ], + "doc:references": [], + "doc:root": false, + "doc:processingData": { + "@id": "null/BaseUnitProcessingData" + } + }, + { + "@id": "#/declarations/AnotherNode", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "AnotherNode", + "doc:link-target": [ + { + "@id": "./library.json#/declarations/AnotherNode" + } + ], + "doc:link-label": "lib.AnotherNode" + }, + { + "@id": "#/declarations/RootNode", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "RootNode", + "shacl:property": [ + { + "@id": "#/declarations/RootNode/property/myProperty" + } + ] + }, + { + "@id": "./library.json#/declarations/AnotherNode", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "AnotherNode", + "shacl:property": [ + { + "@id": "./library.json#/declarations/AnotherNode/property/anotherProperty" + } + ] + }, + { + "@id": "null/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "#/declarations/RootNode/property/myProperty", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#myProperty" + } + ], + "core:name": "myProperty", + "shacl:node": { + "@id": "#/declarations/RootNode/property/myProperty/list" + } + }, + { + "@id": "./library.json#/declarations/AnotherNode/property/anotherProperty", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#anotherProperty" + } + ], + "core:name": "anotherProperty", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + }, + { + "@id": "#/declarations/RootNode/property/myProperty/list", + "@type": "rdfs:Seq", + "rdfs:_1": { + "@id": "#/declarations/AnotherNode" + } + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-library/dialect.json", + "shacl": "http://www.w3.org/ns/shacl#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "meta": "http://a.ml/vocabularies/meta#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-library/library.json b/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-library/library.json new file mode 100644 index 00000000..d8da14d3 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-library/library.json @@ -0,0 +1,12 @@ +{ + "$type": "Library / Dialect 1.0", + "nodeMappings": { + "AnotherNode": { + "mapping": { + "anotherProperty": { + "range": "string" + } + } + } + } +} \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-vocabulary/dialect.cycled.json b/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-vocabulary/dialect.cycled.json new file mode 100644 index 00000000..33d0474b --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-vocabulary/dialect.cycled.json @@ -0,0 +1,31 @@ +{ + "$type": "Dialect 1.0", + "dialect": "Test", + "version": "1", + "external": { + "myExternal": "http://myexternal.org#" + }, + "documents": { + "root": { + "encodes": "RootNode" + } + }, + "nodeMappings": { + "RootNode": { + "classTerm": "myVocab.MyClass", + "mapping": { + "myProperty": { + "propertyTerm": "myVocab.myProperty", + "range": "string" + }, + "anotherProperty": { + "propertyTerm": "myExternal.anotherProperty", + "range": "string" + } + } + } + }, + "uses": { + "myVocab": "vocabulary.json" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-vocabulary/dialect.json b/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-vocabulary/dialect.json new file mode 100644 index 00000000..f5d0bf84 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-vocabulary/dialect.json @@ -0,0 +1,31 @@ +{ + "$type": "Dialect 1.0", + "dialect": "Test", + "version": 1, + "uses": { + "myVocab": "vocabulary.json" + }, + "external": { + "myExternal": "http://myexternal.org#" + }, + "documents": { + "root": { + "encodes": "RootNode" + } + }, + "nodeMappings": { + "RootNode": { + "classTerm": "myVocab.MyClass", + "mapping": { + "myProperty": { + "propertyTerm": "myVocab.myProperty", + "range": "string" + }, + "anotherProperty": { + "propertyTerm": "myExternal.anotherProperty", + "range": "string" + } + } + } + } +} \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-vocabulary/dialect.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-vocabulary/dialect.jsonld new file mode 100644 index 00000000..7fbb66c7 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-vocabulary/dialect.jsonld @@ -0,0 +1,209 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/externals/myExternal", + "@type": [ + "owl:Ontology", + "meta:ExternalVocabulary", + "doc:DomainElement" + ], + "core:displayName": "myExternal", + "meta:base": "http://myexternal.org#" + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + } + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "Test 1", + "meta:encodedNode": [ + { + "@id": "#/declarations/RootNode" + } + ] + }, + { + "@id": "", + "doc:references": [ + { + "@id": "./vocabulary.json" + } + ], + "doc:declares": [ + { + "@id": "#/declarations/RootNode" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "Test", + "core:version": "1", + "meta:externals": [ + { + "@id": "/externals/myExternal" + } + ], + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-vocabulary/dialect.json", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + } + }, + { + "@id": "./vocabulary.json", + "@type": [ + "meta:Vocabulary", + "owl:Ontology", + "doc:Unit" + ], + "core:name": "My Vocabulary", + "doc:declares": [ + { + "@id": "http://myvocabulary.org#MyClass" + }, + { + "@id": "http://myvocabulary.org#myProperty" + } + ], + "meta:base": "http://myvocabulary.org#", + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-vocabulary/vocabulary.json", + "doc:usage": "Example vocabulary", + "doc:root": false, + "doc:processingData": { + "@id": "./vocabulary.json#/BaseUnitProcessingData" + } + }, + { + "@id": "#/declarations/RootNode", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "shacl:targetClass": [ + { + "@id": "http://myvocabulary.org#MyClass" + } + ], + "core:name": "RootNode", + "shacl:property": [ + { + "@id": "#/declarations/RootNode/property/anotherProperty" + }, + { + "@id": "#/declarations/RootNode/property/myProperty" + } + ] + }, + { + "@id": "http://myvocabulary.org#MyClass", + "@type": [ + "owl:Class", + "doc:DomainElement" + ], + "core:name": "MyClass", + "core:displayName": "My Class", + "core:description": "Some class", + "meta:properties": [ + { + "@id": "http://myvocabulary.org#myProperty" + } + ] + }, + { + "@id": "http://myvocabulary.org#myProperty", + "@type": [ + "owl:DatatypeProperty", + "meta:Property", + "doc:DomainElement" + ], + "core:displayName": "My Property", + "core:description": "Some property", + "rdfs:range": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + }, + { + "@id": "./vocabulary.json#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "#/declarations/RootNode/property/anotherProperty", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://myexternal.org#anotherProperty" + } + ], + "core:name": "anotherProperty", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + }, + { + "@id": "#/declarations/RootNode/property/myProperty", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://myvocabulary.org#myProperty" + } + ], + "core:name": "myProperty", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-vocabulary/dialect.json", + "shacl": "http://www.w3.org/ns/shacl#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "meta": "http://a.ml/vocabularies/meta#", + "owl": "http://www.w3.org/2002/07/owl#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-vocabulary/vocabulary.json b/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-vocabulary/vocabulary.json new file mode 100644 index 00000000..8f5db819 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-vocabulary/vocabulary.json @@ -0,0 +1,22 @@ +{ + "$type": "Vocabulary 1.0", + "vocabulary": "My Vocabulary", + "usage": "Example vocabulary", + "base": "http://myvocabulary.org#", + "classTerms": { + "MyClass": { + "displayName": "My Class", + "description": "Some class", + "properties": [ + "myProperty" + ] + } + }, + "propertyTerms": { + "myProperty": { + "displayName": "My Property", + "description": "Some property", + "range": "string" + } + } +} \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-vocabulary/vocabulary.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-vocabulary/vocabulary.jsonld new file mode 100644 index 00000000..873cb202 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-vocabulary/vocabulary.jsonld @@ -0,0 +1,74 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "", + "doc:declares": [ + { + "@id": "http://myvocabulary.org#MyClass" + }, + { + "@id": "http://myvocabulary.org#myProperty" + } + ], + "@type": [ + "meta:Vocabulary", + "owl:Ontology", + "doc:Unit" + ], + "core:name": "My Vocabulary", + "meta:base": "http://myvocabulary.org#", + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-vocabulary/vocabulary.json", + "doc:usage": "Example vocabulary", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + } + }, + { + "@id": "http://myvocabulary.org#MyClass", + "@type": [ + "owl:Class", + "doc:DomainElement" + ], + "core:name": "MyClass", + "core:displayName": "My Class", + "core:description": "Some class", + "meta:properties": [ + { + "@id": "http://myvocabulary.org#myProperty" + } + ] + }, + { + "@id": "http://myvocabulary.org#myProperty", + "@type": [ + "owl:DatatypeProperty", + "meta:Property", + "doc:DomainElement" + ], + "core:displayName": "My Property", + "core:description": "Some property", + "rdfs:range": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/json/with-vocabulary/vocabulary.json", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "owl": "http://www.w3.org/2002/07/owl#", + "meta": "http://a.ml/vocabularies/meta#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.cycled.jsonld.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.cycled.jsonld.yaml new file mode 100644 index 00000000..f0d3079f --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.cycled.jsonld.yaml @@ -0,0 +1,11 @@ +#%Dialect 1.0 +dialect: Long Datatype +version: "1.0" +documents: + root: + encodes: Root +nodeMappings: + Root: + mapping: + something: + range: long diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.cycled.yaml new file mode 100644 index 00000000..f0d3079f --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.cycled.yaml @@ -0,0 +1,11 @@ +#%Dialect 1.0 +dialect: Long Datatype +version: "1.0" +documents: + root: + encodes: Root +nodeMappings: + Root: + mapping: + something: + range: long diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.expanded.jsonld new file mode 100644 index 00000000..d72ebcd4 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.expanded.jsonld @@ -0,0 +1,357 @@ +[ + { + "@id": "", + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": [ + { + "@value": "Long Datatype" + } + ], + "core:version": [ + { + "@value": "1.0" + } + ], + "meta:documents": [ + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": [ + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Long Datatype 1.0" + } + ], + "meta:encodedNode": [ + { + "@id": "#/declarations/Root" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.yaml#/documents/root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,7)-(9,0)]" + } + ] + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:encodedNode" + } + ], + "sourcemaps:value": [ + { + "@value": "[(7,4)-(9,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.yaml/documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,0)-(9,0)]" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:rootDocument" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,2)-(9,0)]" + } + ] + } + ] + } + ] + } + ], + "doc:location": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.yaml" + } + ], + "doc:root": [ + { + "@value": true + } + ], + "doc:processingData": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": [ + { + "@value": false + } + ], + "doc:sourceSpec": [ + { + "@value": "AML 1.0" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:version" + } + ], + "sourcemaps:value": [ + { + "@value": "[(3,0)-(5,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,0)-(9,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.yaml" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(13,19)]" + } + ] + } + ] + } + ], + "doc:declares": [ + { + "@id": "#/declarations/Root", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Root" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Root/property/something", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#something" + } + ], + "core:name": [ + { + "@value": "something" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#long" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/something/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/something/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(12,6)-(12,15)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/something/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(13,8)-(13,19)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/something/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.yaml#/declarations/Root/property/something" + } + ], + "sourcemaps:value": [ + { + "@value": "[(12,16)-(13,19)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(10,2)-(10,6)]" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(11,4)-(13,19)]" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.yaml#/declarations/Root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(10,2)-(13,19)]" + } + ] + } + ] + } + ] + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#" + } + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.flattened.jsonld new file mode 100644 index 00000000..96ecbcb8 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.flattened.jsonld @@ -0,0 +1,277 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + }, + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map" + } + ] + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "Long Datatype 1.0", + "meta:encodedNode": [ + { + "@id": "#/declarations/Root" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map" + } + ] + }, + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1" + }, + { + "@id": "/documents#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.yaml/documents", + "sourcemaps:value": "[(6,0)-(9,0)]" + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": "meta:rootDocument", + "sourcemaps:value": "[(6,2)-(9,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.yaml#/documents/root", + "sourcemaps:value": "[(6,7)-(9,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": "meta:encodedNode", + "sourcemaps:value": "[(7,4)-(9,0)]" + }, + { + "@id": "", + "doc:declares": [ + { + "@id": "#/declarations/Root" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "Long Datatype", + "core:version": "1.0", + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.yaml", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + }, + "sourcemaps:sources": [ + { + "@id": "#/source-map" + } + ] + }, + { + "@id": "#/declarations/Root", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Root", + "shacl:property": [ + { + "@id": "#/declarations/Root/property/something" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/source-map" + } + ] + }, + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_3" + }, + { + "@id": "#/source-map/lexical/element_1" + }, + { + "@id": "#/source-map/lexical/element_0" + }, + { + "@id": "#/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/Root/property/something", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#something" + } + ], + "core:name": "something", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#long" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/something/source-map" + } + ] + }, + { + "@id": "#/declarations/Root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": "core:version", + "sourcemaps:value": "[(3,0)-(5,0)]" + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(2,0)-(3,0)]" + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": "meta:documents", + "sourcemaps:value": "[(5,0)-(9,0)]" + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.yaml", + "sourcemaps:value": "[(2,0)-(13,19)]" + }, + { + "@id": "#/declarations/Root/property/something/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/something/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Root/property/something/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Root/property/something/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(10,2)-(10,6)]" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(11,4)-(13,19)]" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.yaml#/declarations/Root", + "sourcemaps:value": "[(10,2)-(13,19)]" + }, + { + "@id": "#/declarations/Root/property/something/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(12,6)-(12,15)]" + }, + { + "@id": "#/declarations/Root/property/something/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(13,8)-(13,19)]" + }, + { + "@id": "#/declarations/Root/property/something/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.yaml#/declarations/Root/property/something", + "sourcemaps:value": "[(12,16)-(13,19)]" + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.yaml new file mode 100644 index 00000000..64e3cc4f --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/long-datatype/dialect.yaml @@ -0,0 +1,13 @@ +#%Dialect 1.0 +dialect: Long Datatype +version: 1.0 + +documents: + root: + encodes: Root + +nodeMappings: + Root: + mapping: + something: + range: long \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.cycled.jsonld.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.cycled.jsonld.yaml new file mode 100644 index 00000000..d4be0f7d --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.cycled.jsonld.yaml @@ -0,0 +1,33 @@ +#%Dialect 1.0 +dialect: Mapping MinItems properties +version: "1.0" +documents: + root: + encodes: Root +nodeMappings: + Root: + mapping: + Items0MandatoryTrue: + range: string + allowMultiple: true + minItems: 0 + mandatory: true + Items5MandatoryTrue: + range: string + allowMultiple: true + minItems: 5 + mandatory: true + Items0MandatoryFalse: + range: string + allowMultiple: true + minItems: 0 + mandatory: false + Items5NoMandatory: + range: string + allowMultiple: true + minItems: 5 + mandatory: false + NoItemsMandatoryTrue: + range: string + allowMultiple: true + mandatory: true diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.cycled.yaml new file mode 100644 index 00000000..d4be0f7d --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.cycled.yaml @@ -0,0 +1,33 @@ +#%Dialect 1.0 +dialect: Mapping MinItems properties +version: "1.0" +documents: + root: + encodes: Root +nodeMappings: + Root: + mapping: + Items0MandatoryTrue: + range: string + allowMultiple: true + minItems: 0 + mandatory: true + Items5MandatoryTrue: + range: string + allowMultiple: true + minItems: 5 + mandatory: true + Items0MandatoryFalse: + range: string + allowMultiple: true + minItems: 0 + mandatory: false + Items5NoMandatory: + range: string + allowMultiple: true + minItems: 5 + mandatory: false + NoItemsMandatoryTrue: + range: string + allowMultiple: true + mandatory: true diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.expanded.jsonld new file mode 100644 index 00000000..73afc4c5 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.expanded.jsonld @@ -0,0 +1,895 @@ +[ + { + "@id": "", + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": [ + { + "@value": "Mapping MinItems properties" + } + ], + "core:version": [ + { + "@value": "1.0" + } + ], + "meta:documents": [ + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": [ + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Mapping MinItems properties 1.0" + } + ], + "meta:encodedNode": [ + { + "@id": "#/declarations/Root" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml#/documents/root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,7)-(9,0)]" + } + ] + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:encodedNode" + } + ], + "sourcemaps:value": [ + { + "@value": "[(7,4)-(9,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml/documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,0)-(9,0)]" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:rootDocument" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,2)-(9,0)]" + } + ] + } + ] + } + ] + } + ], + "doc:location": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml" + } + ], + "doc:root": [ + { + "@value": true + } + ], + "doc:processingData": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": [ + { + "@value": false + } + ], + "doc:sourceSpec": [ + { + "@value": "AML 1.0" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:version" + } + ], + "sourcemaps:value": [ + { + "@value": "[(3,0)-(5,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,0)-(9,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(35,0)]" + } + ] + } + ] + } + ], + "doc:declares": [ + { + "@id": "#/declarations/Root", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Root" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#Items0MandatoryFalse" + } + ], + "core:name": [ + { + "@value": "Items0MandatoryFalse" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:minCount": [ + { + "@value": 0 + } + ], + "meta:allowMultiple": [ + { + "@value": true + } + ], + "shacl:mandatory": [ + { + "@value": false + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse/source-map/lexical/element_5", + "sourcemaps:element": [ + { + "@value": "meta:allowMultiple" + } + ], + "sourcemaps:value": [ + { + "@value": "[(24,8)-(25,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml#/declarations/Root/property/Items0MandatoryFalse" + } + ], + "sourcemaps:value": [ + { + "@value": "[(22,27)-(27,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "shacl:minCount" + } + ], + "sourcemaps:value": [ + { + "@value": "[(25,8)-(26,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:mandatory" + } + ], + "sourcemaps:value": [ + { + "@value": "[(26,8)-(27,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(22,6)-(22,26)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse/source-map/lexical/element_4", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(23,8)-(24,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#Items5MandatoryTrue" + } + ], + "core:name": [ + { + "@value": "Items5MandatoryTrue" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:minCount": [ + { + "@value": 5 + } + ], + "meta:allowMultiple": [ + { + "@value": true + } + ], + "shacl:mandatory": [ + { + "@value": true + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue/source-map/lexical/element_5", + "sourcemaps:element": [ + { + "@value": "meta:allowMultiple" + } + ], + "sourcemaps:value": [ + { + "@value": "[(19,8)-(20,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml#/declarations/Root/property/Items5MandatoryTrue" + } + ], + "sourcemaps:value": [ + { + "@value": "[(17,26)-(22,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "shacl:minCount" + } + ], + "sourcemaps:value": [ + { + "@value": "[(20,8)-(21,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:mandatory" + } + ], + "sourcemaps:value": [ + { + "@value": "[(21,8)-(22,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(17,6)-(17,25)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue/source-map/lexical/element_4", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(18,8)-(19,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#Items0MandatoryTrue" + } + ], + "core:name": [ + { + "@value": "Items0MandatoryTrue" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:minCount": [ + { + "@value": 0 + } + ], + "meta:allowMultiple": [ + { + "@value": true + } + ], + "shacl:mandatory": [ + { + "@value": true + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue/source-map/lexical/element_5", + "sourcemaps:element": [ + { + "@value": "meta:allowMultiple" + } + ], + "sourcemaps:value": [ + { + "@value": "[(14,8)-(15,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml#/declarations/Root/property/Items0MandatoryTrue" + } + ], + "sourcemaps:value": [ + { + "@value": "[(12,26)-(17,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "shacl:minCount" + } + ], + "sourcemaps:value": [ + { + "@value": "[(15,8)-(16,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:mandatory" + } + ], + "sourcemaps:value": [ + { + "@value": "[(16,8)-(17,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(12,6)-(12,25)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue/source-map/lexical/element_4", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(13,8)-(14,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Root/property/NoItemsMandatoryTrue", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#NoItemsMandatoryTrue" + } + ], + "core:name": [ + { + "@value": "NoItemsMandatoryTrue" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:minCount": [ + { + "@value": 1 + } + ], + "meta:allowMultiple": [ + { + "@value": true + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/NoItemsMandatoryTrue/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/NoItemsMandatoryTrue/source-map/lexical/element_4", + "sourcemaps:element": [ + { + "@value": "shacl:minCount" + } + ], + "sourcemaps:value": [ + { + "@value": "[(34,8)-(35,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/NoItemsMandatoryTrue/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml#/declarations/Root/property/NoItemsMandatoryTrue" + } + ], + "sourcemaps:value": [ + { + "@value": "[(31,27)-(35,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/NoItemsMandatoryTrue/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:allowMultiple" + } + ], + "sourcemaps:value": [ + { + "@value": "[(33,8)-(34,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/NoItemsMandatoryTrue/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(32,8)-(33,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/NoItemsMandatoryTrue/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(31,6)-(31,26)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Root/property/Items5NoMandatory", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#Items5NoMandatory" + } + ], + "core:name": [ + { + "@value": "Items5NoMandatory" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:minCount": [ + { + "@value": 5 + } + ], + "meta:allowMultiple": [ + { + "@value": true + } + ], + "shacl:mandatory": [ + { + "@value": false + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/Items5NoMandatory/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:virtual-element": [ + { + "@id": "#/declarations/Root/property/Items5NoMandatory/source-map/virtual-element/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:mandatory" + } + ], + "sourcemaps:value": [ + { + "@value": "true" + } + ] + } + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/Items5NoMandatory/source-map/lexical/element_4", + "sourcemaps:element": [ + { + "@value": "shacl:minCount" + } + ], + "sourcemaps:value": [ + { + "@value": "[(30,8)-(31,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items5NoMandatory/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml#/declarations/Root/property/Items5NoMandatory" + } + ], + "sourcemaps:value": [ + { + "@value": "[(27,24)-(31,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items5NoMandatory/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:allowMultiple" + } + ], + "sourcemaps:value": [ + { + "@value": "[(29,8)-(30,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items5NoMandatory/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(28,8)-(29,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items5NoMandatory/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(27,6)-(27,23)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(10,2)-(10,6)]" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(11,4)-(35,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml#/declarations/Root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(10,2)-(35,0)]" + } + ] + } + ] + } + ] + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#" + } + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.flattened.jsonld new file mode 100644 index 00000000..46644634 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.flattened.jsonld @@ -0,0 +1,637 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + }, + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map" + } + ] + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "Mapping MinItems properties 1.0", + "meta:encodedNode": [ + { + "@id": "#/declarations/Root" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map" + } + ] + }, + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1" + }, + { + "@id": "/documents#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml/documents", + "sourcemaps:value": "[(6,0)-(9,0)]" + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": "meta:rootDocument", + "sourcemaps:value": "[(6,2)-(9,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml#/documents/root", + "sourcemaps:value": "[(6,7)-(9,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": "meta:encodedNode", + "sourcemaps:value": "[(7,4)-(9,0)]" + }, + { + "@id": "", + "doc:declares": [ + { + "@id": "#/declarations/Root" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "Mapping MinItems properties", + "core:version": "1.0", + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + }, + "sourcemaps:sources": [ + { + "@id": "#/source-map" + } + ] + }, + { + "@id": "#/declarations/Root", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Root", + "shacl:property": [ + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse" + }, + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue" + }, + { + "@id": "#/declarations/Root/property/NoItemsMandatoryTrue" + }, + { + "@id": "#/declarations/Root/property/Items5NoMandatory" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/source-map" + } + ] + }, + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_3" + }, + { + "@id": "#/source-map/lexical/element_1" + }, + { + "@id": "#/source-map/lexical/element_0" + }, + { + "@id": "#/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#Items0MandatoryFalse" + } + ], + "core:name": "Items0MandatoryFalse", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:minCount": 0, + "meta:allowMultiple": true, + "shacl:mandatory": false, + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse/source-map" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#Items5MandatoryTrue" + } + ], + "core:name": "Items5MandatoryTrue", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:minCount": 5, + "meta:allowMultiple": true, + "shacl:mandatory": true, + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue/source-map" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#Items0MandatoryTrue" + } + ], + "core:name": "Items0MandatoryTrue", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:minCount": 0, + "meta:allowMultiple": true, + "shacl:mandatory": true, + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue/source-map" + } + ] + }, + { + "@id": "#/declarations/Root/property/NoItemsMandatoryTrue", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#NoItemsMandatoryTrue" + } + ], + "core:name": "NoItemsMandatoryTrue", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:minCount": 1, + "meta:allowMultiple": true, + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/NoItemsMandatoryTrue/source-map" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items5NoMandatory", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#Items5NoMandatory" + } + ], + "core:name": "Items5NoMandatory", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "shacl:minCount": 5, + "meta:allowMultiple": true, + "shacl:mandatory": false, + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/property/Items5NoMandatory/source-map" + } + ] + }, + { + "@id": "#/declarations/Root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": "core:version", + "sourcemaps:value": "[(3,0)-(5,0)]" + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(2,0)-(3,0)]" + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": "meta:documents", + "sourcemaps:value": "[(5,0)-(9,0)]" + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml", + "sourcemaps:value": "[(2,0)-(35,0)]" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse/source-map/lexical/element_5" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse/source-map/lexical/element_4" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue/source-map/lexical/element_5" + }, + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue/source-map/lexical/element_4" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue/source-map/lexical/element_5" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue/source-map/lexical/element_3" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue/source-map/lexical/element_4" + } + ] + }, + { + "@id": "#/declarations/Root/property/NoItemsMandatoryTrue/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/NoItemsMandatoryTrue/source-map/lexical/element_4" + }, + { + "@id": "#/declarations/Root/property/NoItemsMandatoryTrue/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Root/property/NoItemsMandatoryTrue/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Root/property/NoItemsMandatoryTrue/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/Root/property/NoItemsMandatoryTrue/source-map/lexical/element_3" + } + ] + }, + { + "@id": "#/declarations/Root/property/Items5NoMandatory/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:virtual-element": [ + { + "@id": "#/declarations/Root/property/Items5NoMandatory/source-map/virtual-element/element_0" + } + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/property/Items5NoMandatory/source-map/lexical/element_4" + }, + { + "@id": "#/declarations/Root/property/Items5NoMandatory/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Root/property/Items5NoMandatory/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Root/property/Items5NoMandatory/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/Root/property/Items5NoMandatory/source-map/lexical/element_3" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(10,2)-(10,6)]" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(11,4)-(35,0)]" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml#/declarations/Root", + "sourcemaps:value": "[(10,2)-(35,0)]" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse/source-map/lexical/element_5", + "sourcemaps:element": "meta:allowMultiple", + "sourcemaps:value": "[(24,8)-(25,0)]" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse/source-map/lexical/element_3", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml#/declarations/Root/property/Items0MandatoryFalse", + "sourcemaps:value": "[(22,27)-(27,0)]" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse/source-map/lexical/element_1", + "sourcemaps:element": "shacl:minCount", + "sourcemaps:value": "[(25,8)-(26,0)]" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse/source-map/lexical/element_0", + "sourcemaps:element": "shacl:mandatory", + "sourcemaps:value": "[(26,8)-(27,0)]" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(22,6)-(22,26)]" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryFalse/source-map/lexical/element_4", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(23,8)-(24,0)]" + }, + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue/source-map/lexical/element_5", + "sourcemaps:element": "meta:allowMultiple", + "sourcemaps:value": "[(19,8)-(20,0)]" + }, + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue/source-map/lexical/element_3", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml#/declarations/Root/property/Items5MandatoryTrue", + "sourcemaps:value": "[(17,26)-(22,0)]" + }, + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue/source-map/lexical/element_1", + "sourcemaps:element": "shacl:minCount", + "sourcemaps:value": "[(20,8)-(21,0)]" + }, + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue/source-map/lexical/element_0", + "sourcemaps:element": "shacl:mandatory", + "sourcemaps:value": "[(21,8)-(22,0)]" + }, + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(17,6)-(17,25)]" + }, + { + "@id": "#/declarations/Root/property/Items5MandatoryTrue/source-map/lexical/element_4", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(18,8)-(19,0)]" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue/source-map/lexical/element_5", + "sourcemaps:element": "meta:allowMultiple", + "sourcemaps:value": "[(14,8)-(15,0)]" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue/source-map/lexical/element_3", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml#/declarations/Root/property/Items0MandatoryTrue", + "sourcemaps:value": "[(12,26)-(17,0)]" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue/source-map/lexical/element_1", + "sourcemaps:element": "shacl:minCount", + "sourcemaps:value": "[(15,8)-(16,0)]" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue/source-map/lexical/element_0", + "sourcemaps:element": "shacl:mandatory", + "sourcemaps:value": "[(16,8)-(17,0)]" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(12,6)-(12,25)]" + }, + { + "@id": "#/declarations/Root/property/Items0MandatoryTrue/source-map/lexical/element_4", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(13,8)-(14,0)]" + }, + { + "@id": "#/declarations/Root/property/NoItemsMandatoryTrue/source-map/lexical/element_4", + "sourcemaps:element": "shacl:minCount", + "sourcemaps:value": "[(34,8)-(35,0)]" + }, + { + "@id": "#/declarations/Root/property/NoItemsMandatoryTrue/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml#/declarations/Root/property/NoItemsMandatoryTrue", + "sourcemaps:value": "[(31,27)-(35,0)]" + }, + { + "@id": "#/declarations/Root/property/NoItemsMandatoryTrue/source-map/lexical/element_0", + "sourcemaps:element": "meta:allowMultiple", + "sourcemaps:value": "[(33,8)-(34,0)]" + }, + { + "@id": "#/declarations/Root/property/NoItemsMandatoryTrue/source-map/lexical/element_1", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(32,8)-(33,0)]" + }, + { + "@id": "#/declarations/Root/property/NoItemsMandatoryTrue/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(31,6)-(31,26)]" + }, + { + "@id": "#/declarations/Root/property/Items5NoMandatory/source-map/virtual-element/element_0", + "sourcemaps:element": "shacl:mandatory", + "sourcemaps:value": "true" + }, + { + "@id": "#/declarations/Root/property/Items5NoMandatory/source-map/lexical/element_4", + "sourcemaps:element": "shacl:minCount", + "sourcemaps:value": "[(30,8)-(31,0)]" + }, + { + "@id": "#/declarations/Root/property/Items5NoMandatory/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml#/declarations/Root/property/Items5NoMandatory", + "sourcemaps:value": "[(27,24)-(31,0)]" + }, + { + "@id": "#/declarations/Root/property/Items5NoMandatory/source-map/lexical/element_0", + "sourcemaps:element": "meta:allowMultiple", + "sourcemaps:value": "[(29,8)-(30,0)]" + }, + { + "@id": "#/declarations/Root/property/Items5NoMandatory/source-map/lexical/element_1", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(28,8)-(29,0)]" + }, + { + "@id": "#/declarations/Root/property/Items5NoMandatory/source-map/lexical/element_3", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(27,6)-(27,23)]" + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml new file mode 100644 index 00000000..e87bb9cd --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/min-items/dialect.yaml @@ -0,0 +1,34 @@ +#%Dialect 1.0 +dialect: Mapping MinItems properties +version: 1.0 + +documents: + root: + encodes: Root + +nodeMappings: + Root: + mapping: + Items0MandatoryTrue: + range: string + allowMultiple: true + minItems: 0 + mandatory: true + Items5MandatoryTrue: + range: string + allowMultiple: true + minItems: 5 + mandatory: true + Items0MandatoryFalse: + range: string + allowMultiple: true + minItems: 0 + mandatory: false + Items5NoMandatory: + range: string + allowMultiple: true + minItems: 5 + NoItemsMandatoryTrue: + range: string + allowMultiple: true + mandatory: true diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.cycled.jsonld.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.cycled.jsonld.yaml new file mode 100644 index 00000000..0ad71fa8 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.cycled.jsonld.yaml @@ -0,0 +1,23 @@ +#%Dialect 1.0 +dialect: Mapping AllOf +version: "1.0" +documents: + root: + encodes: Root +nodeMappings: + Root: + oneOf: + - Member1 + - Member2 + Member1: + mapping: + m11: + range: string + m12: + range: string + Member2: + mapping: + m21: + range: string + m22: + range: string diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.cycled.yaml new file mode 100644 index 00000000..0ad71fa8 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.cycled.yaml @@ -0,0 +1,23 @@ +#%Dialect 1.0 +dialect: Mapping AllOf +version: "1.0" +documents: + root: + encodes: Root +nodeMappings: + Root: + oneOf: + - Member1 + - Member2 + Member1: + mapping: + m11: + range: string + m12: + range: string + Member2: + mapping: + m21: + range: string + m22: + range: string diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.expanded.jsonld new file mode 100644 index 00000000..340a75bb --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.expanded.jsonld @@ -0,0 +1,691 @@ +[ + { + "@id": "", + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": [ + { + "@value": "Mapping AllOf" + } + ], + "core:version": [ + { + "@value": "1.0" + } + ], + "meta:documents": [ + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": [ + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Mapping AllOf 1.0" + } + ], + "meta:encodedNode": [ + { + "@id": "#/declarations/Root" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml#/documents/root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,7)-(9,0)]" + } + ] + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:encodedNode" + } + ], + "sourcemaps:value": [ + { + "@value": "[(7,4)-(9,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml/documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,0)-(9,0)]" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:rootDocument" + } + ], + "sourcemaps:value": [ + { + "@value": "[(6,2)-(9,0)]" + } + ] + } + ] + } + ] + } + ], + "doc:location": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml" + } + ], + "doc:root": [ + { + "@value": true + } + ], + "doc:processingData": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": [ + { + "@value": false + } + ], + "doc:sourceSpec": [ + { + "@value": "AML 1.0" + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": [ + { + "@value": "core:version" + } + ], + "sourcemaps:value": [ + { + "@value": "[(3,0)-(5,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "meta:documents" + } + ], + "sourcemaps:value": [ + { + "@value": "[(5,0)-(9,0)]" + } + ] + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml" + } + ], + "sourcemaps:value": [ + { + "@value": "[(2,0)-(25,21)]" + } + ] + } + ] + } + ], + "doc:declares": [ + { + "@id": "#/declarations/Root", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Root" + } + ], + "http://a.ml/vocabularies/amf/aml#or": [ + { + "@id": "#/declarations/Member1" + }, + { + "@id": "#/declarations/Member2" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml#/declarations/Root" + } + ], + "sourcemaps:value": [ + { + "@value": "[(10,2)-(14,0)]" + } + ] + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(10,2)-(10,6)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Member1" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Member1/property/m12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m12" + } + ], + "core:name": [ + { + "@value": "m12" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/property/m12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(18,6)-(18,9)]" + } + ] + }, + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(19,8)-(20,0)]" + } + ] + }, + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml#/declarations/Member1/property/m12" + } + ], + "sourcemaps:value": [ + { + "@value": "[(18,10)-(20,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member1/property/m11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m11" + } + ], + "core:name": [ + { + "@value": "m11" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/property/m11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(16,6)-(16,9)]" + } + ] + }, + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(17,8)-(18,0)]" + } + ] + }, + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml#/declarations/Member1/property/m11" + } + ], + "sourcemaps:value": [ + { + "@value": "[(16,10)-(18,0)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(14,2)-(14,9)]" + } + ] + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(15,4)-(20,0)]" + } + ] + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml#/declarations/Member1" + } + ], + "sourcemaps:value": [ + { + "@value": "[(14,2)-(20,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "Member2" + } + ], + "shacl:property": [ + { + "@id": "#/declarations/Member2/property/m21", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m21" + } + ], + "core:name": [ + { + "@value": "m21" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/property/m21/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(22,6)-(22,9)]" + } + ] + }, + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(23,8)-(24,0)]" + } + ] + }, + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml#/declarations/Member2/property/m21" + } + ], + "sourcemaps:value": [ + { + "@value": "[(22,10)-(24,0)]" + } + ] + } + ] + } + ] + }, + { + "@id": "#/declarations/Member2/property/m22", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m22" + } + ], + "core:name": [ + { + "@value": "m22" + } + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/property/m22/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(24,6)-(24,9)]" + } + ] + }, + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:datatype" + } + ], + "sourcemaps:value": [ + { + "@value": "[(25,8)-(25,21)]" + } + ] + }, + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml#/declarations/Member2/property/m22" + } + ], + "sourcemaps:value": [ + { + "@value": "[(24,10)-(25,21)]" + } + ] + } + ] + } + ] + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/source-map/lexical/element_2", + "sourcemaps:element": [ + { + "@value": "core:name" + } + ], + "sourcemaps:value": [ + { + "@value": "[(20,2)-(20,9)]" + } + ] + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_0", + "sourcemaps:element": [ + { + "@value": "shacl:property" + } + ], + "sourcemaps:value": [ + { + "@value": "[(21,4)-(25,21)]" + } + ] + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_1", + "sourcemaps:element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml#/declarations/Member2" + } + ], + "sourcemaps:value": [ + { + "@value": "[(20,2)-(25,21)]" + } + ] + } + ] + } + ] + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#" + } + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.flattened.jsonld new file mode 100644 index 00000000..53a9da9c --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.flattened.jsonld @@ -0,0 +1,551 @@ +{ + "@graph": [ + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:BaseUnitProcessingData" + ], + "doc:transformed": false, + "doc:sourceSpec": "AML 1.0" + }, + { + "@id": "/documents", + "@type": [ + "meta:DocumentsModel", + "doc:DomainElement" + ], + "meta:rootDocument": { + "@id": "#/documents/root" + }, + "sourcemaps:sources": [ + { + "@id": "/documents#/source-map" + } + ] + }, + { + "@id": "#/documents/root", + "@type": [ + "meta:DocumentMapping", + "doc:DomainElement" + ], + "core:name": "Mapping AllOf 1.0", + "meta:encodedNode": [ + { + "@id": "#/declarations/Root" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/documents/root/source-map" + } + ] + }, + { + "@id": "/documents#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "/documents#/source-map/lexical/element_1" + }, + { + "@id": "/documents#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/documents/root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/documents/root/source-map/lexical/element_1" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "/documents#/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml/documents", + "sourcemaps:value": "[(6,0)-(9,0)]" + }, + { + "@id": "/documents#/source-map/lexical/element_0", + "sourcemaps:element": "meta:rootDocument", + "sourcemaps:value": "[(6,2)-(9,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml#/documents/root", + "sourcemaps:value": "[(6,7)-(9,0)]" + }, + { + "@id": "#/documents/root/source-map/lexical/element_0", + "sourcemaps:element": "meta:encodedNode", + "sourcemaps:value": "[(7,4)-(9,0)]" + }, + { + "@id": "", + "doc:declares": [ + { + "@id": "#/declarations/Root" + }, + { + "@id": "#/declarations/Member1" + }, + { + "@id": "#/declarations/Member2" + } + ], + "@type": [ + "meta:Dialect", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "core:name": "Mapping AllOf", + "core:version": "1.0", + "meta:documents": { + "@id": "/documents" + }, + "doc:location": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml", + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + }, + "sourcemaps:sources": [ + { + "@id": "#/source-map" + } + ] + }, + { + "@id": "#/declarations/Root", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Root", + "http://a.ml/vocabularies/amf/aml#or": [ + { + "@id": "#/declarations/Member1" + }, + { + "@id": "#/declarations/Member2" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Root/source-map" + } + ] + }, + { + "@id": "#/declarations/Member1", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Member1", + "shacl:property": [ + { + "@id": "#/declarations/Member1/property/m12" + }, + { + "@id": "#/declarations/Member1/property/m11" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/source-map" + } + ] + }, + { + "@id": "#/declarations/Member2", + "@type": [ + "meta:NodeMapping", + "shacl:Shape", + "doc:DomainElement" + ], + "core:name": "Member2", + "shacl:property": [ + { + "@id": "#/declarations/Member2/property/m21" + }, + { + "@id": "#/declarations/Member2/property/m22" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/source-map" + } + ] + }, + { + "@id": "#/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/source-map/lexical/element_3" + }, + { + "@id": "#/source-map/lexical/element_1" + }, + { + "@id": "#/source-map/lexical/element_0" + }, + { + "@id": "#/source-map/lexical/element_2" + } + ] + }, + { + "@id": "#/declarations/Root/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Root/source-map/lexical/element_1" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0" + } + ] + }, + { + "@id": "#/declarations/Member1/property/m12", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m12" + } + ], + "core:name": "m12", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/property/m12/source-map" + } + ] + }, + { + "@id": "#/declarations/Member1/property/m11", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m11" + } + ], + "core:name": "m11", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member1/property/m11/source-map" + } + ] + }, + { + "@id": "#/declarations/Member1/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member2/property/m21", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m21" + } + ], + "core:name": "m21", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/property/m21/source-map" + } + ] + }, + { + "@id": "#/declarations/Member2/property/m22", + "@type": [ + "meta:NodePropertyMapping", + "doc:DomainElement" + ], + "shacl:path": [ + { + "@id": "http://a.ml/vocabularies/data#m22" + } + ], + "core:name": "m22", + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "sourcemaps:sources": [ + { + "@id": "#/declarations/Member2/property/m22/source-map" + } + ] + }, + { + "@id": "#/declarations/Member2/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/source-map/lexical/element_3", + "sourcemaps:element": "core:version", + "sourcemaps:value": "[(3,0)-(5,0)]" + }, + { + "@id": "#/source-map/lexical/element_1", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(2,0)-(3,0)]" + }, + { + "@id": "#/source-map/lexical/element_0", + "sourcemaps:element": "meta:documents", + "sourcemaps:value": "[(5,0)-(9,0)]" + }, + { + "@id": "#/source-map/lexical/element_2", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml", + "sourcemaps:value": "[(2,0)-(25,21)]" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml#/declarations/Root", + "sourcemaps:value": "[(10,2)-(14,0)]" + }, + { + "@id": "#/declarations/Root/source-map/lexical/element_0", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(10,2)-(10,6)]" + }, + { + "@id": "#/declarations/Member1/property/m12/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member1/property/m11/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(14,2)-(14,9)]" + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(15,4)-(20,0)]" + }, + { + "@id": "#/declarations/Member1/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml#/declarations/Member1", + "sourcemaps:value": "[(14,2)-(20,0)]" + }, + { + "@id": "#/declarations/Member2/property/m21/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member2/property/m22/source-map", + "@type": [ + "sourcemaps:SourceMap" + ], + "sourcemaps:lexical": [ + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_2" + }, + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_0" + }, + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_1" + } + ] + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(20,2)-(20,9)]" + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_0", + "sourcemaps:element": "shacl:property", + "sourcemaps:value": "[(21,4)-(25,21)]" + }, + { + "@id": "#/declarations/Member2/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml#/declarations/Member2", + "sourcemaps:value": "[(20,2)-(25,21)]" + }, + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(18,6)-(18,9)]" + }, + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(19,8)-(20,0)]" + }, + { + "@id": "#/declarations/Member1/property/m12/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml#/declarations/Member1/property/m12", + "sourcemaps:value": "[(18,10)-(20,0)]" + }, + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(16,6)-(16,9)]" + }, + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(17,8)-(18,0)]" + }, + { + "@id": "#/declarations/Member1/property/m11/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml#/declarations/Member1/property/m11", + "sourcemaps:value": "[(16,10)-(18,0)]" + }, + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(22,6)-(22,9)]" + }, + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(23,8)-(24,0)]" + }, + { + "@id": "#/declarations/Member2/property/m21/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml#/declarations/Member2/property/m21", + "sourcemaps:value": "[(22,10)-(24,0)]" + }, + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_2", + "sourcemaps:element": "core:name", + "sourcemaps:value": "[(24,6)-(24,9)]" + }, + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_0", + "sourcemaps:element": "shacl:datatype", + "sourcemaps:value": "[(25,8)-(25,21)]" + }, + { + "@id": "#/declarations/Member2/property/m22/source-map/lexical/element_1", + "sourcemaps:element": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml#/declarations/Member2/property/m22", + "sourcemaps:value": "[(24,10)-(25,21)]" + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml", + "shacl": "http://www.w3.org/ns/shacl#", + "doc": "http://a.ml/vocabularies/document#", + "core": "http://a.ml/vocabularies/core#", + "sourcemaps": "http://a.ml/vocabularies/document-source-maps#", + "meta": "http://a.ml/vocabularies/meta#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml new file mode 100644 index 00000000..71fe4a4f --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/oneOf/dialect.yaml @@ -0,0 +1,25 @@ +#%Dialect 1.0 +dialect: Mapping AllOf +version: 1.0 + +documents: + root: + encodes: Root + +nodeMappings: + Root: + oneOf: + - Member1 + - Member2 + Member1: + mapping: + m11: + range: string + m12: + range: string + Member2: + mapping: + m21: + range: string + m22: + range: string \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/dialects/range-mapping.yaml b/amf-aml/shared/src/test/resources/vocabularies2/dialects/range-mapping.yaml new file mode 100644 index 00000000..b9737bf8 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/dialects/range-mapping.yaml @@ -0,0 +1,37 @@ +#%Dialect 1.0 +dialect: Test +version: "1.0" +nodeMappings: + B: + classTerm: v2.B + mapping: + b: + mandatory: true + range: string + propertyTerm: v2.a + mapTermKey: v2.t + A: + classTerm: v2.A + mapping: + a: + mandatory: true + pattern: a-z + range: string + propertyTerm: v2.a + C: + classTerm: v2.C + mapping: + c: + mandatory: true + range: string + propertyTerm: v2.c + RootNode: + mapping: + unionProperty: + propertyTerm: v2.unionRangeProp + range: [ A, B, C ] +documents: + root: + encodes: RootNode +external: + v2: http://test.com/v2# diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/$base/instance.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/$base/instance.expanded.jsonld index a22b6bf1..ee2fe4eb 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/$base/instance.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/$base/instance.expanded.jsonld @@ -89,9 +89,9 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#custom-id": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://overriden.com/presidents/BarackObama#/source-map/custom-id/element_0", + "@id": "http://overriden.com/presidents/BarackObama#/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://overriden.com/presidents/BarackObama" @@ -99,35 +99,35 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "true" + "@value": "[(6,4)-(10,0)]" } ] - } - ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + }, { - "@id": "http://overriden.com/presidents/BarackObama#/source-map/lexical/element_1", + "@id": "http://overriden.com/presidents/BarackObama#/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://overriden.com/presidents/BarackObama" + "@value": "http://a.ml/vocabularies/data#name" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(6,4)-(10,0)]" + "@value": "[(6,4)-(7,0)]" } ] - }, + } + ], + "http://a.ml/vocabularies/document-source-maps#custom-id": [ { - "@id": "http://overriden.com/presidents/BarackObama#/source-map/lexical/element_0", + "@id": "http://overriden.com/presidents/BarackObama#/source-map/custom-id/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://a.ml/vocabularies/data#name" + "@value": "http://overriden.com/presidents/BarackObama" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(6,4)-(7,0)]" + "@value": "true" } ] } @@ -153,9 +153,9 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#custom-id": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://overriden.com/presidents#GeorgeWBush/source-map/custom-id/element_0", + "@id": "http://overriden.com/presidents#GeorgeWBush/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://overriden.com/presidents#GeorgeWBush" @@ -163,35 +163,35 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "true" + "@value": "[(10,4)-(13,0)]" } ] - } - ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + }, { - "@id": "http://overriden.com/presidents#GeorgeWBush/source-map/lexical/element_1", + "@id": "http://overriden.com/presidents#GeorgeWBush/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://overriden.com/presidents#GeorgeWBush" + "@value": "http://a.ml/vocabularies/data#name" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(10,4)-(13,0)]" + "@value": "[(10,4)-(11,0)]" } ] - }, + } + ], + "http://a.ml/vocabularies/document-source-maps#custom-id": [ { - "@id": "http://overriden.com/presidents#GeorgeWBush/source-map/lexical/element_0", + "@id": "http://overriden.com/presidents#GeorgeWBush/source-map/custom-id/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://a.ml/vocabularies/data#name" + "@value": "http://overriden.com/presidents#GeorgeWBush" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(10,4)-(11,0)]" + "@value": "true" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/$base/instance.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/$base/instance.flattened.jsonld index c7cf1525..0a51559e 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/$base/instance.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/$base/instance.flattened.jsonld @@ -112,11 +112,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#custom-id": [ - { - "@id": "http://overriden.com/presidents/BarackObama#/source-map/custom-id/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "http://overriden.com/presidents/BarackObama#/source-map/lexical/element_1" @@ -124,6 +119,11 @@ { "@id": "http://overriden.com/presidents/BarackObama#/source-map/lexical/element_0" } + ], + "http://a.ml/vocabularies/document-source-maps#custom-id": [ + { + "@id": "http://overriden.com/presidents/BarackObama#/source-map/custom-id/element_0" + } ] }, { @@ -131,11 +131,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#custom-id": [ - { - "@id": "http://overriden.com/presidents#GeorgeWBush/source-map/custom-id/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "http://overriden.com/presidents#GeorgeWBush/source-map/lexical/element_1" @@ -143,6 +138,11 @@ { "@id": "http://overriden.com/presidents#GeorgeWBush/source-map/lexical/element_0" } + ], + "http://a.ml/vocabularies/document-source-maps#custom-id": [ + { + "@id": "http://overriden.com/presidents#GeorgeWBush/source-map/custom-id/element_0" + } ] }, { @@ -165,11 +165,6 @@ "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#name", "http://a.ml/vocabularies/document-source-maps#value": "[(3,4)-(4,0)]" }, - { - "@id": "http://overriden.com/presidents/BarackObama#/source-map/custom-id/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "http://overriden.com/presidents/BarackObama", - "http://a.ml/vocabularies/document-source-maps#value": "true" - }, { "@id": "http://overriden.com/presidents/BarackObama#/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://overriden.com/presidents/BarackObama", @@ -181,8 +176,8 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(6,4)-(7,0)]" }, { - "@id": "http://overriden.com/presidents#GeorgeWBush/source-map/custom-id/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "http://overriden.com/presidents#GeorgeWBush", + "@id": "http://overriden.com/presidents/BarackObama#/source-map/custom-id/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://overriden.com/presidents/BarackObama", "http://a.ml/vocabularies/document-source-maps#value": "true" }, { @@ -195,6 +190,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#name", "http://a.ml/vocabularies/document-source-maps#value": "[(10,4)-(11,0)]" }, + { + "@id": "http://overriden.com/presidents#GeorgeWBush/source-map/custom-id/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://overriden.com/presidents#GeorgeWBush", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/$base/instance.yaml", "@type": [ diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/$id/instance.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/$id/instance.expanded.jsonld index 5903771a..e70e61d6 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/$id/instance.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/$id/instance.expanded.jsonld @@ -40,9 +40,9 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#custom-id": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://a.ml/NodeA#/source-map/custom-id/element_0", + "@id": "file://a.ml/NodeA#/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://a.ml/NodeA" @@ -50,35 +50,35 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "true" + "@value": "[(2,2)-(5,0)]" } ] - } - ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + }, { - "@id": "file://a.ml/NodeA#/source-map/lexical/element_1", + "@id": "file://a.ml/NodeA#/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://a.ml/NodeA" + "@value": "http://a.ml/vocabularies/data#nameA" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(2,2)-(5,0)]" + "@value": "[(4,2)-(5,0)]" } ] - }, + } + ], + "http://a.ml/vocabularies/document-source-maps#custom-id": [ { - "@id": "file://a.ml/NodeA#/source-map/lexical/element_0", + "@id": "file://a.ml/NodeA#/source-map/custom-id/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://a.ml/vocabularies/data#nameA" + "@value": "file://a.ml/NodeA" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(4,2)-(5,0)]" + "@value": "true" } ] } @@ -106,9 +106,9 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#custom-id": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://a.ml/NodeB#/source-map/custom-id/element_0", + "@id": "file://a.ml/NodeB#/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://a.ml/NodeB" @@ -116,35 +116,35 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "true" + "@value": "[(5,2)-(8,0)]" } ] - } - ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + }, { - "@id": "file://a.ml/NodeB#/source-map/lexical/element_1", + "@id": "file://a.ml/NodeB#/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://a.ml/NodeB" + "@value": "http://a.ml/vocabularies/data#nameB" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(5,2)-(8,0)]" + "@value": "[(7,2)-(8,0)]" } ] - }, + } + ], + "http://a.ml/vocabularies/document-source-maps#custom-id": [ { - "@id": "file://a.ml/NodeB#/source-map/lexical/element_0", + "@id": "file://a.ml/NodeB#/source-map/custom-id/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://a.ml/vocabularies/data#nameB" + "@value": "file://a.ml/NodeB" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(7,2)-(8,0)]" + "@value": "true" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/$id/instance.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/$id/instance.flattened.jsonld index b68ef97d..c27493e0 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/$id/instance.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/$id/instance.flattened.jsonld @@ -82,11 +82,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#custom-id": [ - { - "@id": "file://a.ml/NodeA#/source-map/custom-id/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://a.ml/NodeA#/source-map/lexical/element_1" @@ -94,6 +89,11 @@ { "@id": "file://a.ml/NodeA#/source-map/lexical/element_0" } + ], + "http://a.ml/vocabularies/document-source-maps#custom-id": [ + { + "@id": "file://a.ml/NodeA#/source-map/custom-id/element_0" + } ] }, { @@ -101,11 +101,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#custom-id": [ - { - "@id": "file://a.ml/NodeB#/source-map/custom-id/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://a.ml/NodeB#/source-map/lexical/element_1" @@ -113,6 +108,11 @@ { "@id": "file://a.ml/NodeB#/source-map/lexical/element_0" } + ], + "http://a.ml/vocabularies/document-source-maps#custom-id": [ + { + "@id": "file://a.ml/NodeB#/source-map/custom-id/element_0" + } ] }, { @@ -130,11 +130,6 @@ "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/$id/instance.yaml#/encodes", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(8,0)]" }, - { - "@id": "file://a.ml/NodeA#/source-map/custom-id/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://a.ml/NodeA", - "http://a.ml/vocabularies/document-source-maps#value": "true" - }, { "@id": "file://a.ml/NodeA#/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "file://a.ml/NodeA", @@ -146,8 +141,8 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(4,2)-(5,0)]" }, { - "@id": "file://a.ml/NodeB#/source-map/custom-id/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://a.ml/NodeB", + "@id": "file://a.ml/NodeA#/source-map/custom-id/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://a.ml/NodeA", "http://a.ml/vocabularies/document-source-maps#value": "true" }, { @@ -160,6 +155,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#nameB", "http://a.ml/vocabularies/document-source-maps#value": "[(7,2)-(8,0)]" }, + { + "@id": "file://a.ml/NodeB#/source-map/custom-id/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://a.ml/NodeB", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/$id/instance.yaml", "@type": [ diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/additional-properties/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/additional-properties/dialect.yaml new file mode 100644 index 00000000..2e77c6e0 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/additional-properties/dialect.yaml @@ -0,0 +1,23 @@ +#%Dialect 1.0 +dialect: Mapping Additional properties +version: 1.0 + +documents: + root: + encodes: Person + +nodeMappings: + Person: + mapping: + name: + range: PersonName + club: + range: string + + PersonName: + mapping: + name: + range: string + surname: + range: string + additionalProperties: true diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/additional-properties/instance.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/additional-properties/instance.yaml new file mode 100644 index 00000000..7bea8c51 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/additional-properties/instance.yaml @@ -0,0 +1,7 @@ +#%Mapping Additional properties 1.0 +name: + name: Lionel + surname: Messi + nickname: Pulga +club: PSG +number: 30 diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/additional-properties/report.json b/amf-aml/shared/src/test/resources/vocabularies2/instances/additional-properties/report.json new file mode 100644 index 00000000..e0b9dfec --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/additional-properties/report.json @@ -0,0 +1,32 @@ +{ + "@type": "http://www.w3.org/ns/shacl#ValidationReport", + "http://www.w3.org/ns/shacl#conforms": false, + "http://www.w3.org/ns/shacl#result": [ + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/additional-properties/instance.yaml#/encodes" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Property: 'number' not supported in a file://amf-aml/shared/src/test/resources/vocabularies2/instances/additional-properties/dialect.yaml#/declarations/Person node", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "http://a.ml/vocabularies/amf/aml#closed-shape" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 7, + "http://a.ml/vocabularies/amf/parser#column": 8 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 7, + "http://a.ml/vocabularies/amf/parser#column": 10 + } + } + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/dialect.yaml new file mode 100644 index 00000000..d6ce2471 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/dialect.yaml @@ -0,0 +1,76 @@ +#%Dialect 1.0 +dialect: Mapping AllOf +version: 1.0 +external: + schema-org: https://schema.org/ +documents: + root: + encodes: Root +nodeMappings: + Root: + allOf: + - OrMember1 + - Conditional + Member11: + mapping: + am11: + range: string + mandatory: true + Member12: + mapping: + am12: + range: string + mandatory: true + OrMember1: + oneOf: + - Member11 + - Member12 + Conditional: + conditional: + if: IfAppliesMapping + then: ThenAppliesMapping + else: ElseAppliesMapping + + IfAppliesMapping: + mapping: + aProp: + range: string + enum: ["then-mapping"] + ThenAppliesMapping: + mapping: + aProp: + range: string + enum: [ "then-mapping" ] + ElseAppliesMapping: + mapping: + aProp: + range: string + enum: [ "else-mapping" ] + combining_mapping_1: + components: + - ThenAppliesMapping + - Member11 + extends: + - ThenAppliesMapping + - Member11 + combining_mapping_2: + components: + - ElseAppliesMapping + - Member11 + extends: + - ElseAppliesMapping + - Member11 + combining_mapping_3: + components: + - ThenAppliesMapping + - Member12 + extends: + - ThenAppliesMapping + - Member12 + combining_mapping_4: + components: + - ElseAppliesMapping + - Member12 + extends: + - ElseAppliesMapping + - Member12 diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.cycled.yaml new file mode 100644 index 00000000..96410fc1 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.cycled.yaml @@ -0,0 +1,3 @@ +#%Mapping AllOf 1.0 +am12: a +aProp: else-mapping diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.expanded.jsonld new file mode 100644 index 00000000..51de8691 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.expanded.jsonld @@ -0,0 +1,137 @@ +[ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml", + "@type": [ + "http://a.ml/vocabularies/meta#DialectInstance", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#encodes": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/encodes", + "@type": [ + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/dialect.yaml#/declarations/combining_mapping_4", + "http://a.ml/vocabularies/meta#DialectDomainElement", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#aProp": [ + { + "@value": "else-mapping" + } + ], + "http://a.ml/vocabularies/data#am12": [ + { + "@value": "a" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/encodes/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/encodes/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/data#aProp" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(3,0)-(4,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/encodes/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/data#am12" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/encodes/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/encodes" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(4,0)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document#root": [ + { + "@value": true + } + ], + "http://a.ml/vocabularies/document#processingData": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#DialectInstanceProcessingData" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#transformed": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/document#sourceSpec": [ + { + "@value": "Mapping AllOf 1.0" + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(4,0)]" + } + ] + } + ] + } + ] + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.flattened.jsonld new file mode 100644 index 00000000..ae33b0a2 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.flattened.jsonld @@ -0,0 +1,107 @@ +{ + "@graph": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#DialectInstanceProcessingData" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#transformed": false, + "http://a.ml/vocabularies/document#sourceSpec": "Mapping AllOf 1.0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/encodes", + "@type": [ + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/dialect.yaml#/declarations/combining_mapping_4", + "http://a.ml/vocabularies/meta#DialectDomainElement", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#aProp": "else-mapping", + "http://a.ml/vocabularies/data#am12": "a", + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/encodes/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/encodes/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/encodes/source-map/lexical/element_2" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/encodes/source-map/lexical/element_0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/encodes/source-map/lexical/element_1" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/encodes/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#aProp", + "http://a.ml/vocabularies/document-source-maps#value": "[(3,0)-(4,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/encodes/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#am12", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(3,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/encodes/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/encodes", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(4,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml", + "@type": [ + "http://a.ml/vocabularies/meta#DialectInstance", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#encodes": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/encodes" + }, + "http://a.ml/vocabularies/document#root": true, + "http://a.ml/vocabularies/document#processingData": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml/BaseUnitProcessingData" + }, + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(4,0)]" + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml new file mode 100644 index 00000000..fbfb4a45 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-oneOf-if-then-else/instance.yaml @@ -0,0 +1,3 @@ +#%Mapping AllOf 1.0 +am12: a +aProp: "else-mapping" diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/dialect.yaml new file mode 100644 index 00000000..2ad5f2d7 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/dialect.yaml @@ -0,0 +1,39 @@ +#%Dialect 1.0 +dialect: Mapping AllOf +version: 1.0 +external: + schema-org: https://schema.org/ +documents: + root: + encodes: Root +nodeMappings: + Root: + mapping: + root1: + range: integer + root2: + range: string + allOf: + - AndMember1 + - AndMember2 + AndMember1: + mapping: + am11: + range: string + am12: + range: string + AndMember2: + mapping: + am21: + range: string + am22: + range: string + combining_mapping_1: + components: + - AndMember1 + - AndMember2 + - Root + extends: + - AndMember1 + - AndMember2 + - Root diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.cycled.yaml new file mode 100644 index 00000000..5d2a5322 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.cycled.yaml @@ -0,0 +1,7 @@ +#%Mapping AllOf 1.0 +am11: a +am12: b +am21: c +am22: d +root1: 5 +root2: aString diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.expanded.jsonld new file mode 100644 index 00000000..b533f5eb --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.expanded.jsonld @@ -0,0 +1,209 @@ +[ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml", + "@type": [ + "http://a.ml/vocabularies/meta#DialectInstance", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#encodes": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes", + "@type": [ + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/dialect.yaml#/declarations/combining_mapping_1", + "http://a.ml/vocabularies/meta#DialectDomainElement", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#am12": [ + { + "@value": "b" + } + ], + "http://a.ml/vocabularies/data#am11": [ + { + "@value": "a" + } + ], + "http://a.ml/vocabularies/data#am22": [ + { + "@value": "d" + } + ], + "http://a.ml/vocabularies/data#am21": [ + { + "@value": "c" + } + ], + "http://a.ml/vocabularies/data#root1": [ + { + "@value": 5 + } + ], + "http://a.ml/vocabularies/data#root2": [ + { + "@value": "aString" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map/lexical/element_6", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/data#root1" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(6,0)-(7,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map/lexical/element_4", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/data#am12" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(3,0)-(4,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/data#am11" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/data#root2" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(7,0)-(8,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/data#am21" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(4,0)-(5,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map/lexical/element_3", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(8,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map/lexical/element_5", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/data#am22" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(5,0)-(6,0)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document#root": [ + { + "@value": true + } + ], + "http://a.ml/vocabularies/document#processingData": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#DialectInstanceProcessingData" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#transformed": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/document#sourceSpec": [ + { + "@value": "Mapping AllOf 1.0" + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(8,0)]" + } + ] + } + ] + } + ] + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.flattened.jsonld new file mode 100644 index 00000000..f3223ae0 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.flattened.jsonld @@ -0,0 +1,143 @@ +{ + "@graph": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#DialectInstanceProcessingData" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#transformed": false, + "http://a.ml/vocabularies/document#sourceSpec": "Mapping AllOf 1.0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes", + "@type": [ + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/dialect.yaml#/declarations/combining_mapping_1", + "http://a.ml/vocabularies/meta#DialectDomainElement", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#am12": "b", + "http://a.ml/vocabularies/data#am11": "a", + "http://a.ml/vocabularies/data#am22": "d", + "http://a.ml/vocabularies/data#am21": "c", + "http://a.ml/vocabularies/data#root1": 5, + "http://a.ml/vocabularies/data#root2": "aString", + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map/lexical/element_6" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map/lexical/element_4" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map/lexical/element_2" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map/lexical/element_0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map/lexical/element_1" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map/lexical/element_3" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map/lexical/element_5" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map/lexical/element_6", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#root1", + "http://a.ml/vocabularies/document-source-maps#value": "[(6,0)-(7,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map/lexical/element_4", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#am12", + "http://a.ml/vocabularies/document-source-maps#value": "[(3,0)-(4,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#am11", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(3,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#root2", + "http://a.ml/vocabularies/document-source-maps#value": "[(7,0)-(8,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#am21", + "http://a.ml/vocabularies/document-source-maps#value": "[(4,0)-(5,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map/lexical/element_3", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(8,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes/source-map/lexical/element_5", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#am22", + "http://a.ml/vocabularies/document-source-maps#value": "[(5,0)-(6,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml", + "@type": [ + "http://a.ml/vocabularies/meta#DialectInstance", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#encodes": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/encodes" + }, + "http://a.ml/vocabularies/document#root": true, + "http://a.ml/vocabularies/document#processingData": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml/BaseUnitProcessingData" + }, + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(8,0)]" + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml new file mode 100644 index 00000000..5d2a5322 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-properties/instance.yaml @@ -0,0 +1,7 @@ +#%Mapping AllOf 1.0 +am11: a +am12: b +am21: c +am22: d +root1: 5 +root2: aString diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/dialect.yaml new file mode 100644 index 00000000..0dd7fb7a --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/dialect.yaml @@ -0,0 +1,32 @@ +#%Dialect 1.0 +dialect: Mapping AllOf +version: 1.0 +external: + schema-org: https://schema.org/ +documents: + root: + encodes: Root +nodeMappings: + Root: + allOf: + - AndMember1 + - AndMember2 + AndMember1: + mapping: + am11: + range: string + am12: + range: string + AndMember2: + mapping: + am21: + range: string + am22: + range: string + combining_mapping_1: + components: + - AndMember1 + - AndMember2 + extends: + - AndMember1 + - AndMember2 diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.cycled.yaml new file mode 100644 index 00000000..b450a78f --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.cycled.yaml @@ -0,0 +1,5 @@ +#%Mapping AllOf 1.0 +am11: a +am12: b +am21: c +am22: d diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.expanded.jsonld new file mode 100644 index 00000000..80bba5f8 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.expanded.jsonld @@ -0,0 +1,173 @@ +[ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml", + "@type": [ + "http://a.ml/vocabularies/meta#DialectInstance", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#encodes": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes", + "@type": [ + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/dialect.yaml#/declarations/combining_mapping_1", + "http://a.ml/vocabularies/meta#DialectDomainElement", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#am12": [ + { + "@value": "b" + } + ], + "http://a.ml/vocabularies/data#am11": [ + { + "@value": "a" + } + ], + "http://a.ml/vocabularies/data#am22": [ + { + "@value": "d" + } + ], + "http://a.ml/vocabularies/data#am21": [ + { + "@value": "c" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes/source-map/lexical/element_4", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/data#am22" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(5,0)-(6,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(6,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/data#am21" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(4,0)-(5,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/data#am11" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes/source-map/lexical/element_3", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/data#am12" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(3,0)-(4,0)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document#root": [ + { + "@value": true + } + ], + "http://a.ml/vocabularies/document#processingData": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#DialectInstanceProcessingData" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#transformed": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/document#sourceSpec": [ + { + "@value": "Mapping AllOf 1.0" + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(6,0)]" + } + ] + } + ] + } + ] + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.flattened.jsonld new file mode 100644 index 00000000..b1c59115 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.flattened.jsonld @@ -0,0 +1,125 @@ +{ + "@graph": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#DialectInstanceProcessingData" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#transformed": false, + "http://a.ml/vocabularies/document#sourceSpec": "Mapping AllOf 1.0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes", + "@type": [ + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/dialect.yaml#/declarations/combining_mapping_1", + "http://a.ml/vocabularies/meta#DialectDomainElement", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#am12": "b", + "http://a.ml/vocabularies/data#am11": "a", + "http://a.ml/vocabularies/data#am22": "d", + "http://a.ml/vocabularies/data#am21": "c", + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes/source-map/lexical/element_4" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes/source-map/lexical/element_2" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes/source-map/lexical/element_0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes/source-map/lexical/element_1" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes/source-map/lexical/element_3" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes/source-map/lexical/element_4", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#am22", + "http://a.ml/vocabularies/document-source-maps#value": "[(5,0)-(6,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(6,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#am21", + "http://a.ml/vocabularies/document-source-maps#value": "[(4,0)-(5,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#am11", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(3,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes/source-map/lexical/element_3", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#am12", + "http://a.ml/vocabularies/document-source-maps#value": "[(3,0)-(4,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml", + "@type": [ + "http://a.ml/vocabularies/meta#DialectInstance", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#encodes": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/encodes" + }, + "http://a.ml/vocabularies/document#root": true, + "http://a.ml/vocabularies/document#processingData": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml/BaseUnitProcessingData" + }, + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(6,0)]" + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml new file mode 100644 index 00000000..b450a78f --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-simple/instance.yaml @@ -0,0 +1,5 @@ +#%Mapping AllOf 1.0 +am11: a +am12: b +am21: c +am22: d diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/dialect.yaml new file mode 100644 index 00000000..b71f53b6 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/dialect.yaml @@ -0,0 +1,53 @@ +#%Dialect 1.0 +dialect: Mapping AllOf +version: 1.0 +external: + schema-org: https://schema.org/ +documents: + root: + encodes: Root +nodeMappings: + Root: + allOf: + - OrMember1 + - AndMember2 + AndMember1: + mapping: + am11: + range: string + am12: + range: string + AndMember2: + mapping: + am21: + range: string + am22: + range: string + Member11: + mapping: + am11: + range: string + mandatory: true + Member12: + mapping: + am12: + range: string + mandatory: true + OrMember1: + oneOf: + - Member11 + - Member12 + combining_mapping_1: + components: + - AndMember2 + - Member11 + extends: + - AndMember2 + - Member11 + combining_mapping_2: + components: + - AndMember2 + - Member12 + extends: + - AndMember2 + - Member12 diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.cycled.yaml new file mode 100644 index 00000000..da6aa709 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.cycled.yaml @@ -0,0 +1,4 @@ +#%Mapping AllOf 1.0 +am11: a +am21: c +am22: d diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.expanded.jsonld new file mode 100644 index 00000000..0a4468aa --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.expanded.jsonld @@ -0,0 +1,155 @@ +[ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml", + "@type": [ + "http://a.ml/vocabularies/meta#DialectInstance", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#encodes": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/encodes", + "@type": [ + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/dialect.yaml#/declarations/combining_mapping_1", + "http://a.ml/vocabularies/meta#DialectDomainElement", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#am22": [ + { + "@value": "d" + } + ], + "http://a.ml/vocabularies/data#am21": [ + { + "@value": "c" + } + ], + "http://a.ml/vocabularies/data#am11": [ + { + "@value": "a" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/encodes/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/encodes/source-map/lexical/element_3", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/data#am21" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(3,0)-(4,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/encodes/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/data#am22" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(4,0)-(5,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/encodes/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/data#am11" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/encodes/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/encodes" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(5,0)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document#root": [ + { + "@value": true + } + ], + "http://a.ml/vocabularies/document#processingData": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#DialectInstanceProcessingData" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#transformed": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/document#sourceSpec": [ + { + "@value": "Mapping AllOf 1.0" + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(5,0)]" + } + ] + } + ] + } + ] + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.flattened.jsonld new file mode 100644 index 00000000..ff909ac1 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.flattened.jsonld @@ -0,0 +1,116 @@ +{ + "@graph": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#DialectInstanceProcessingData" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#transformed": false, + "http://a.ml/vocabularies/document#sourceSpec": "Mapping AllOf 1.0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/encodes", + "@type": [ + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/dialect.yaml#/declarations/combining_mapping_1", + "http://a.ml/vocabularies/meta#DialectDomainElement", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#am22": "d", + "http://a.ml/vocabularies/data#am21": "c", + "http://a.ml/vocabularies/data#am11": "a", + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/encodes/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/encodes/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/encodes/source-map/lexical/element_3" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/encodes/source-map/lexical/element_1" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/encodes/source-map/lexical/element_0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/encodes/source-map/lexical/element_2" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/encodes/source-map/lexical/element_3", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#am21", + "http://a.ml/vocabularies/document-source-maps#value": "[(3,0)-(4,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/encodes/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#am22", + "http://a.ml/vocabularies/document-source-maps#value": "[(4,0)-(5,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/encodes/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#am11", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(3,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/encodes/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/encodes", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(5,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml", + "@type": [ + "http://a.ml/vocabularies/meta#DialectInstance", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#encodes": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/encodes" + }, + "http://a.ml/vocabularies/document#root": true, + "http://a.ml/vocabularies/document#processingData": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml/BaseUnitProcessingData" + }, + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(5,0)]" + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml new file mode 100644 index 00000000..da6aa709 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/allOf-with-nested-oneOf/instance.yaml @@ -0,0 +1,4 @@ +#%Mapping AllOf 1.0 +am11: a +am21: c +am22: d diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/array-of-any/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/array-of-any/dialect.yaml new file mode 100644 index 00000000..dbf64c7e --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/array-of-any/dialect.yaml @@ -0,0 +1,14 @@ +#%Dialect 1.0 +dialect: Test +version: 1.0 + +nodeMappings: + RootNode: + mapping: + rootProperty: + range: any + allowMultiple: true + +documents: + root: + encodes: RootNode \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/array-of-any/instance.golden.json b/amf-aml/shared/src/test/resources/vocabularies2/instances/array-of-any/instance.golden.json new file mode 100644 index 00000000..a1e44134 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/array-of-any/instance.golden.json @@ -0,0 +1,61 @@ +{ + "@graph": [ + { + "@id": "#/encodes", + "@type": [ + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/array-of-any/dialect.yaml#/declarations/RootNode", + "meta:DialectDomainElement", + "doc:DomainElement" + ], + "data:rootProperty": [ + "A", + { + "@value": "1", + "@type": "xsd:integer" + } + ] + }, + { + "@id": "#/BaseUnitProcessingData", + "@type": [ + "doc:DialectInstanceProcessingData" + ], + "meta:definedBy": [ + { + "@id": "./dialect.yaml" + } + ], + "doc:transformed": false, + "doc:sourceSpec": "Test 1.0" + }, + { + "@id": "", + "@type": [ + "meta:DialectInstance", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "meta:definedBy": [ + { + "@id": "./dialect.yaml" + } + ], + "doc:encodes": { + "@id": "#/encodes" + }, + "doc:root": true, + "doc:processingData": { + "@id": "#/BaseUnitProcessingData" + } + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/array-of-any/instance.json", + "data": "http://a.ml/vocabularies/data#", + "doc": "http://a.ml/vocabularies/document#", + "meta": "http://a.ml/vocabularies/meta#", + "xsd": "http://www.w3.org/2001/XMLSchema#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/array-of-any/instance.json b/amf-aml/shared/src/test/resources/vocabularies2/instances/array-of-any/instance.json new file mode 100644 index 00000000..9af87b2f --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/array-of-any/instance.json @@ -0,0 +1,61 @@ +{ + "@graph": [ + { + "@id": "/BaseUnitProcessingData", + "@type": [ + "doc:DialectInstanceProcessingData" + ], + "meta:definedBy": [ + { + "@id": "./dialect.yaml" + } + ], + "doc:transformed": false, + "doc:sourceSpec": "Test 1.0" + }, + { + "@id": "#/encodes", + "@type": [ + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/array-of-any/dialect.yaml#/declarations/RootNode", + "meta:DialectDomainElement", + "doc:DomainElement" + ], + "data:rootProperty": [ + { + "@value": "1", + "@type": "xsd:integer" + }, + "A" + ] + }, + { + "@id": "", + "@type": [ + "meta:DialectInstance", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "meta:definedBy": [ + { + "@id": "./dialect.yaml" + } + ], + "doc:encodes": { + "@id": "#/encodes" + }, + "doc:root": true, + "doc:processingData": { + "@id": "/BaseUnitProcessingData" + } + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/array-of-any/instance.json", + "data": "http://a.ml/vocabularies/data#", + "doc": "http://a.ml/vocabularies/document#", + "meta": "http://a.ml/vocabularies/meta#", + "xsd": "http://www.w3.org/2001/XMLSchema#" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/defined-union-range-mapping.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/defined-union-range-mapping.yaml new file mode 100644 index 00000000..7731981e --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/defined-union-range-mapping.yaml @@ -0,0 +1,3 @@ +#%Test 1.0 +unionProperty: + a: diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/dialect17.input.json b/amf-aml/shared/src/test/resources/vocabularies2/instances/dialect17.input.json index 22568760..4a30006f 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/dialect17.input.json +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/dialect17.input.json @@ -1,5 +1,5 @@ { - "$dialect": "Dialect 1.0", + "$type": "Dialect 1.0", "dialect": "TestInstance", "version": "1.17", "nodeMappings": { diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example1.ttl b/amf-aml/shared/src/test/resources/vocabularies2/instances/example1.ttl index f8816ab4..2541cd41 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example1.ttl +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example1.ttl @@ -15,12 +15,9 @@ "false"^^ . . . - "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1.yaml" . - . . . "true"^^ . - . . . . diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.expanded.jsonld index 409328e6..49509efc 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.expanded.jsonld @@ -47,9 +47,9 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/0/source-map/from-union-node-mapping/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/0/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/0" @@ -57,35 +57,35 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect13b.yaml#/declarations/Element" + "@value": "[(5,0)-(7,0)]" } ] - } - ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/0/source-map/lexical/element_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/0/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/0" + "@value": "http://test.com/vocab#name" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(5,0)-(7,0)]" + "@value": "[(5,4)-(6,0)]" } ] - }, + } + ], + "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/0/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/0/source-map/from-union-node-mapping/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://test.com/vocab#name" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/0" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(5,4)-(6,0)]" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect13b.yaml#/declarations/Element" } ] } @@ -112,9 +112,9 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/1/source-map/from-union-node-mapping/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/1/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/1" @@ -122,35 +122,35 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect13b.yaml#/declarations/Element" + "@value": "[(8,0)-(10,0)]" } ] - } - ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/1/source-map/lexical/element_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/1/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/1" + "@value": "http://test.com/vocab#name" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(8,0)-(10,0)]" + "@value": "[(8,4)-(9,0)]" } ] - }, + } + ], + "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/1/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/1/source-map/from-union-node-mapping/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://test.com/vocab#name" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/1" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(8,4)-(9,0)]" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect13b.yaml#/declarations/Element" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.flattened.jsonld index 8c959220..036e8109 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.flattened.jsonld @@ -88,11 +88,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/0/source-map/from-union-node-mapping/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/0/source-map/lexical/element_1" @@ -100,6 +95,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/0/source-map/lexical/element_0" } + ], + "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/0/source-map/from-union-node-mapping/element_0" + } ] }, { @@ -107,11 +107,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/1/source-map/from-union-node-mapping/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/1/source-map/lexical/element_1" @@ -119,6 +114,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/1/source-map/lexical/element_0" } + ], + "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/1/source-map/from-union-node-mapping/element_0" + } ] }, { @@ -136,11 +136,6 @@ "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(10,0)]" }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/0/source-map/from-union-node-mapping/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/0", - "http://a.ml/vocabularies/document-source-maps#value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect13b.yaml#/declarations/Element" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/0/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/0", @@ -152,8 +147,8 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(5,4)-(6,0)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/1/source-map/from-union-node-mapping/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/0/source-map/from-union-node-mapping/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/0", "http://a.ml/vocabularies/document-source-maps#value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect13b.yaml#/declarations/Element" }, { @@ -166,6 +161,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "http://test.com/vocab#name", "http://a.ml/vocabularies/document-source-maps#value": "[(8,4)-(9,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/1/source-map/from-union-node-mapping/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml#/encodes/ls/1", + "http://a.ml/vocabularies/document-source-maps#value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect13b.yaml#/declarations/Element" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13b.yaml", "@type": [ diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.expanded.jsonld index 91b3fdb8..3d57152c 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.expanded.jsonld @@ -38,21 +38,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.yaml#/encodes/source-map/from-union-node-mapping/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.yaml#/encodes" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect13c.yaml#/declarations/AssetUnion" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.yaml#/encodes/source-map/lexical/element_2", @@ -93,6 +78,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.yaml#/encodes/source-map/from-union-node-mapping/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.yaml#/encodes" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect13c.yaml#/declarations/AssetUnion" + } + ] + } ] } ] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.flattened.jsonld index eb2d8ec8..0c5ce4b0 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.flattened.jsonld @@ -34,11 +34,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.yaml#/encodes/source-map/from-union-node-mapping/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.yaml#/encodes/source-map/lexical/element_2" @@ -49,13 +44,13 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.yaml#/encodes/source-map/lexical/element_1" } + ], + "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.yaml#/encodes/source-map/from-union-node-mapping/element_0" + } ] }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.yaml#/encodes/source-map/from-union-node-mapping/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.yaml#/encodes", - "http://a.ml/vocabularies/document-source-maps#value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect13c.yaml#/declarations/AssetUnion" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.yaml#/encodes/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": "http://anypoint.com/vocabs/schema-org#description", @@ -71,6 +66,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.yaml#/encodes", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(5,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.yaml#/encodes/source-map/from-union-node-mapping/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.yaml#/encodes", + "http://a.ml/vocabularies/document-source-maps#value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect13c.yaml#/declarations/AssetUnion" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example13c.yaml", "@type": [ diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example14.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example14.expanded.jsonld index fe75d88b..1579edca 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example14.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example14.expanded.jsonld @@ -42,9 +42,9 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#custom-id": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://test.com/something#here/source-map/custom-id/element_0", + "@id": "http://test.com/something#here/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://test.com/something#here" @@ -52,35 +52,35 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "true" + "@value": "[(3,3)-(6,0)]" } ] - } - ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + }, { - "@id": "http://test.com/something#here/source-map/lexical/element_1", + "@id": "http://test.com/something#here/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://test.com/something#here" + "@value": "http://test.com/v2#a" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(3,3)-(6,0)]" + "@value": "[(4,4)-(5,0)]" } ] - }, + } + ], + "http://a.ml/vocabularies/document-source-maps#custom-id": [ { - "@id": "http://test.com/something#here/source-map/lexical/element_0", + "@id": "http://test.com/something#here/source-map/custom-id/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://test.com/v2#a" + "@value": "http://test.com/something#here" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(4,4)-(5,0)]" + "@value": "true" } ] } @@ -107,9 +107,9 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#custom-id": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#/ho/source-map/custom-id/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#/ho/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#/ho" @@ -117,35 +117,35 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "true" + "@value": "[(6,3)-(9,0)]" } ] - } - ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#/ho/source-map/lexical/element_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#/ho/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#/ho" + "@value": "http://test.com/v2#a" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(6,3)-(9,0)]" + "@value": "[(7,4)-(8,0)]" } ] - }, + } + ], + "http://a.ml/vocabularies/document-source-maps#custom-id": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#/ho/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#/ho/source-map/custom-id/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://test.com/v2#a" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#/ho" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(7,4)-(8,0)]" + "@value": "true" } ] } @@ -160,9 +160,9 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#custom-id": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#a/source-map/custom-id/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#a/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#a" @@ -170,35 +170,35 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "true" + "@value": "[(2,0)-(10,0)]" } ] - } - ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#a/source-map/lexical/element_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#a/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#a" + "@value": "http://test.com/v2#a" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(2,0)-(10,0)]" + "@value": "[(2,0)-(9,0)]" } ] - }, + } + ], + "http://a.ml/vocabularies/document-source-maps#custom-id": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#a/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#a/source-map/custom-id/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://test.com/v2#a" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#a" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(2,0)-(9,0)]" + "@value": "true" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example14.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example14.flattened.jsonld index 50981b7f..f982bed9 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example14.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example14.flattened.jsonld @@ -70,11 +70,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#custom-id": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#a/source-map/custom-id/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#a/source-map/lexical/element_1" @@ -82,6 +77,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#a/source-map/lexical/element_0" } + ], + "http://a.ml/vocabularies/document-source-maps#custom-id": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#a/source-map/custom-id/element_0" + } ] }, { @@ -89,11 +89,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#custom-id": [ - { - "@id": "http://test.com/something#here/source-map/custom-id/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "http://test.com/something#here/source-map/lexical/element_1" @@ -101,6 +96,11 @@ { "@id": "http://test.com/something#here/source-map/lexical/element_0" } + ], + "http://a.ml/vocabularies/document-source-maps#custom-id": [ + { + "@id": "http://test.com/something#here/source-map/custom-id/element_0" + } ] }, { @@ -108,11 +108,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#custom-id": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#/ho/source-map/custom-id/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#/ho/source-map/lexical/element_1" @@ -120,13 +115,13 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#/ho/source-map/lexical/element_0" } + ], + "http://a.ml/vocabularies/document-source-maps#custom-id": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#/ho/source-map/custom-id/element_0" + } ] }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#a/source-map/custom-id/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#a", - "http://a.ml/vocabularies/document-source-maps#value": "true" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#a/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#a", @@ -138,8 +133,8 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(9,0)]" }, { - "@id": "http://test.com/something#here/source-map/custom-id/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "http://test.com/something#here", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#a/source-map/custom-id/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#a", "http://a.ml/vocabularies/document-source-maps#value": "true" }, { @@ -153,8 +148,8 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(4,4)-(5,0)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#/ho/source-map/custom-id/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#/ho", + "@id": "http://test.com/something#here/source-map/custom-id/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://test.com/something#here", "http://a.ml/vocabularies/document-source-maps#value": "true" }, { @@ -167,6 +162,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "http://test.com/v2#a", "http://a.ml/vocabularies/document-source-maps#value": "[(7,4)-(8,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#/ho/source-map/custom-id/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect14.yaml#/ho", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example14.yaml", "@type": [ diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.expanded.jsonld index 622926a4..cd48885e 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.expanded.jsonld @@ -67,9 +67,9 @@ ] } ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + "http://a.ml/vocabularies/document-source-maps#ref-include": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.yaml#/encodes/za/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.yaml#/encodes/za/source-map/ref-include/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.yaml#/encodes/za" @@ -77,14 +77,14 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(3,12)-(3,27)]" + "@value": "true" } ] } ], - "http://a.ml/vocabularies/document-source-maps#ref-include": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.yaml#/encodes/za/source-map/ref-include/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.yaml#/encodes/za/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.yaml#/encodes/za" @@ -92,7 +92,7 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "true" + "@value": "[(3,12)-(3,27)]" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.flattened.jsonld index c8c6e240..65ccfcd7 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.flattened.jsonld @@ -79,14 +79,14 @@ "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.yaml#/encodes/za/source-map/synthesized-field/element_0" } ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + "http://a.ml/vocabularies/document-source-maps#ref-include": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.yaml#/encodes/za/source-map/lexical/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.yaml#/encodes/za/source-map/ref-include/element_0" } ], - "http://a.ml/vocabularies/document-source-maps#ref-include": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.yaml#/encodes/za/source-map/ref-include/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.yaml#/encodes/za/source-map/lexical/element_0" } ] }, @@ -106,14 +106,14 @@ "http://a.ml/vocabularies/document-source-maps#value": "true" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.yaml#/encodes/za/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.yaml#/encodes/za/source-map/ref-include/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.yaml#/encodes/za", - "http://a.ml/vocabularies/document-source-maps#value": "[(3,12)-(3,27)]" + "http://a.ml/vocabularies/document-source-maps#value": "true" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.yaml#/encodes/za/source-map/ref-include/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.yaml#/encodes/za/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.yaml#/encodes/za", - "http://a.ml/vocabularies/document-source-maps#value": "true" + "http://a.ml/vocabularies/document-source-maps#value": "[(3,12)-(3,27)]" }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example16c.yaml", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.expanded.jsonld index 7f111b57..f4cfb6f3 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.expanded.jsonld @@ -98,7 +98,7 @@ "@value": "(anon1)" } ], - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/AnnotationInfo((anon1),anon1,None,anon1,(anon1): true).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/anon1/scalar_1", "@type": [ "http://a.ml/vocabularies/data#Scalar", "http://a.ml/vocabularies/data#Node", @@ -121,16 +121,16 @@ ], "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/AnnotationInfo((anon1),anon1,None,anon1,(anon1): true).suffix/scalar_1/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/anon1/scalar_1/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/AnnotationInfo((anon1),anon1,None,anon1,(anon1): true).suffix/scalar_1/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/anon1/scalar_1/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/AnnotationInfo((anon1),anon1,None,anon1,(anon1): true).suffix/scalar_1" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/anon1/scalar_1" } ], "http://a.ml/vocabularies/document-source-maps#value": [ @@ -149,7 +149,7 @@ "@value": "x-anon2" } ], - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/AnnotationInfo(x-anon2,anon2,None,anon2,x-anon2: 2.3[).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/anon2/scalar_1", "@type": [ "http://a.ml/vocabularies/data#Scalar", "http://a.ml/vocabularies/data#Node", @@ -172,16 +172,16 @@ ], "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/AnnotationInfo(x-anon2,anon2,None,anon2,x-anon2: 2.3[).suffix/scalar_1/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/anon2/scalar_1/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/AnnotationInfo(x-anon2,anon2,None,anon2,x-anon2: 2.3[).suffix/scalar_1/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/anon2/scalar_1/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/AnnotationInfo(x-anon2,anon2,None,anon2,x-anon2: 2.3[).suffix/scalar_1" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/anon2/scalar_1" } ], "http://a.ml/vocabularies/document-source-maps#value": [ @@ -200,7 +200,7 @@ "@value": "(a.hey)" } ], - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/AnnotationInfo((a.hey),a.hey,Some(a),hey,(a.hey): hey).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/hey/scalar_1", "@type": [ "http://a.ml/vocabularies/data#Scalar", "http://a.ml/vocabularies/data#Node", @@ -223,16 +223,16 @@ ], "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/AnnotationInfo((a.hey),a.hey,Some(a),hey,(a.hey): hey).suffix/scalar_1/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/hey/scalar_1/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/AnnotationInfo((a.hey),a.hey,Some(a),hey,(a.hey): hey).suffix/scalar_1/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/hey/scalar_1/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/AnnotationInfo((a.hey),a.hey,Some(a),hey,(a.hey): hey).suffix/scalar_1" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/hey/scalar_1" } ], "http://a.ml/vocabularies/document-source-maps#value": [ @@ -251,7 +251,7 @@ "@value": "x-a-hey2" } ], - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/AnnotationInfo(x-a-hey2,a-hey2,Some(a),hey2,x-a-hey2: 1).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/hey2/scalar_1", "@type": [ "http://a.ml/vocabularies/data#Scalar", "http://a.ml/vocabularies/data#Node", @@ -274,16 +274,16 @@ ], "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/AnnotationInfo(x-a-hey2,a-hey2,Some(a),hey2,x-a-hey2: 1).suffix/scalar_1/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/hey2/scalar_1/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/AnnotationInfo(x-a-hey2,a-hey2,Some(a),hey2,x-a-hey2: 1).suffix/scalar_1/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/hey2/scalar_1/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/AnnotationInfo(x-a-hey2,a-hey2,Some(a),hey2,x-a-hey2: 1).suffix/scalar_1" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/hey2/scalar_1" } ], "http://a.ml/vocabularies/document-source-maps#value": [ @@ -302,7 +302,7 @@ "@value": "(b.ho)" } ], - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/AnnotationInfo((b.ho),b.ho,Some(b),ho,(b.ho): ho).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/ho/scalar_1", "@type": [ "http://a.ml/vocabularies/data#Scalar", "http://a.ml/vocabularies/data#Node", @@ -325,16 +325,16 @@ ], "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/AnnotationInfo((b.ho),b.ho,Some(b),ho,(b.ho): ho).suffix/scalar_1/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/ho/scalar_1/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/AnnotationInfo((b.ho),b.ho,Some(b),ho,(b.ho): ho).suffix/scalar_1/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/ho/scalar_1/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/AnnotationInfo((b.ho),b.ho,Some(b),ho,(b.ho): ho).suffix/scalar_1" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/ho/scalar_1" } ], "http://a.ml/vocabularies/document-source-maps#value": [ @@ -353,7 +353,7 @@ "@value": "x-b-ho2" } ], - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/AnnotationInfo(x-b-ho2,b-ho2,Some(b),ho2,x-b-ho2: 2).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/ho2/scalar_1", "@type": [ "http://a.ml/vocabularies/data#Scalar", "http://a.ml/vocabularies/data#Node", @@ -376,16 +376,16 @@ ], "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/AnnotationInfo(x-b-ho2,b-ho2,Some(b),ho2,x-b-ho2: 2).suffix/scalar_1/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/ho2/scalar_1/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/AnnotationInfo(x-b-ho2,b-ho2,Some(b),ho2,x-b-ho2: 2).suffix/scalar_1/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/ho2/scalar_1/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/AnnotationInfo(x-b-ho2,b-ho2,Some(b),ho2,x-b-ho2: 2).suffix/scalar_1" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/ho2/scalar_1" } ], "http://a.ml/vocabularies/document-source-maps#value": [ diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.flattened.jsonld index 91837738..d4b80a79 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.flattened.jsonld @@ -58,22 +58,22 @@ ], "http://test.com/tmp#boolean": true, "http://a.ml/vocabularies/data#anon1": { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/AnnotationInfo((anon1),anon1,None,anon1,(anon1): true).suffix/scalar_1" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/anon1/scalar_1" }, "http://a.ml/vocabularies/data#anon2": { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/AnnotationInfo(x-anon2,anon2,None,anon2,x-anon2: 2.3[).suffix/scalar_1" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/anon2/scalar_1" }, "http://test.com/a#hey": { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/AnnotationInfo((a.hey),a.hey,Some(a),hey,(a.hey): hey).suffix/scalar_1" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/hey/scalar_1" }, "http://test.com/a#hey2": { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/AnnotationInfo(x-a-hey2,a-hey2,Some(a),hey2,x-a-hey2: 1).suffix/scalar_1" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/hey2/scalar_1" }, "http://test.com/b#ho": { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/AnnotationInfo((b.ho),b.ho,Some(b),ho,(b.ho): ho).suffix/scalar_1" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/ho/scalar_1" }, "http://test.com/b#ho2": { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/AnnotationInfo(x-b-ho2,b-ho2,Some(b),ho2,x-b-ho2: 2).suffix/scalar_1" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/ho2/scalar_1" }, "http://a.ml/vocabularies/document#customDomainProperties": [ { @@ -103,7 +103,7 @@ }, { "http://a.ml/vocabularies/core#extensionName": "(anon1)", - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/AnnotationInfo((anon1),anon1,None,anon1,(anon1): true).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/anon1/scalar_1", "@type": [ "http://a.ml/vocabularies/data#Scalar", "http://a.ml/vocabularies/data#Node", @@ -118,13 +118,13 @@ "http://a.ml/vocabularies/core#name": "scalar_1", "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/AnnotationInfo((anon1),anon1,None,anon1,(anon1): true).suffix/scalar_1/source-map" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/anon1/scalar_1/source-map" } ] }, { "http://a.ml/vocabularies/core#extensionName": "x-anon2", - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/AnnotationInfo(x-anon2,anon2,None,anon2,x-anon2: 2.3[).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/anon2/scalar_1", "@type": [ "http://a.ml/vocabularies/data#Scalar", "http://a.ml/vocabularies/data#Node", @@ -139,13 +139,13 @@ "http://a.ml/vocabularies/core#name": "scalar_1", "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/AnnotationInfo(x-anon2,anon2,None,anon2,x-anon2: 2.3[).suffix/scalar_1/source-map" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/anon2/scalar_1/source-map" } ] }, { "http://a.ml/vocabularies/core#extensionName": "(a.hey)", - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/AnnotationInfo((a.hey),a.hey,Some(a),hey,(a.hey): hey).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/hey/scalar_1", "@type": [ "http://a.ml/vocabularies/data#Scalar", "http://a.ml/vocabularies/data#Node", @@ -160,13 +160,13 @@ "http://a.ml/vocabularies/core#name": "scalar_1", "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/AnnotationInfo((a.hey),a.hey,Some(a),hey,(a.hey): hey).suffix/scalar_1/source-map" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/hey/scalar_1/source-map" } ] }, { "http://a.ml/vocabularies/core#extensionName": "x-a-hey2", - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/AnnotationInfo(x-a-hey2,a-hey2,Some(a),hey2,x-a-hey2: 1).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/hey2/scalar_1", "@type": [ "http://a.ml/vocabularies/data#Scalar", "http://a.ml/vocabularies/data#Node", @@ -181,13 +181,13 @@ "http://a.ml/vocabularies/core#name": "scalar_1", "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/AnnotationInfo(x-a-hey2,a-hey2,Some(a),hey2,x-a-hey2: 1).suffix/scalar_1/source-map" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/hey2/scalar_1/source-map" } ] }, { "http://a.ml/vocabularies/core#extensionName": "(b.ho)", - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/AnnotationInfo((b.ho),b.ho,Some(b),ho,(b.ho): ho).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/ho/scalar_1", "@type": [ "http://a.ml/vocabularies/data#Scalar", "http://a.ml/vocabularies/data#Node", @@ -202,13 +202,13 @@ "http://a.ml/vocabularies/core#name": "scalar_1", "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/AnnotationInfo((b.ho),b.ho,Some(b),ho,(b.ho): ho).suffix/scalar_1/source-map" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/ho/scalar_1/source-map" } ] }, { "http://a.ml/vocabularies/core#extensionName": "x-b-ho2", - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/AnnotationInfo(x-b-ho2,b-ho2,Some(b),ho2,x-b-ho2: 2).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/ho2/scalar_1", "@type": [ "http://a.ml/vocabularies/data#Scalar", "http://a.ml/vocabularies/data#Node", @@ -223,7 +223,7 @@ "http://a.ml/vocabularies/core#name": "scalar_1", "http://a.ml/vocabularies/document-source-maps#sources": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/AnnotationInfo(x-b-ho2,b-ho2,Some(b),ho2,x-b-ho2: 2).suffix/scalar_1/source-map" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/ho2/scalar_1/source-map" } ] }, @@ -257,68 +257,68 @@ ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/AnnotationInfo((anon1),anon1,None,anon1,(anon1): true).suffix/scalar_1/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/anon1/scalar_1/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/AnnotationInfo((anon1),anon1,None,anon1,(anon1): true).suffix/scalar_1/source-map/lexical/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/anon1/scalar_1/source-map/lexical/element_0" } ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/AnnotationInfo(x-anon2,anon2,None,anon2,x-anon2: 2.3[).suffix/scalar_1/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/anon2/scalar_1/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/AnnotationInfo(x-anon2,anon2,None,anon2,x-anon2: 2.3[).suffix/scalar_1/source-map/lexical/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/anon2/scalar_1/source-map/lexical/element_0" } ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/AnnotationInfo((a.hey),a.hey,Some(a),hey,(a.hey): hey).suffix/scalar_1/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/hey/scalar_1/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/AnnotationInfo((a.hey),a.hey,Some(a),hey,(a.hey): hey).suffix/scalar_1/source-map/lexical/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/hey/scalar_1/source-map/lexical/element_0" } ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/AnnotationInfo(x-a-hey2,a-hey2,Some(a),hey2,x-a-hey2: 1).suffix/scalar_1/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/hey2/scalar_1/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/AnnotationInfo(x-a-hey2,a-hey2,Some(a),hey2,x-a-hey2: 1).suffix/scalar_1/source-map/lexical/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/hey2/scalar_1/source-map/lexical/element_0" } ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/AnnotationInfo((b.ho),b.ho,Some(b),ho,(b.ho): ho).suffix/scalar_1/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/ho/scalar_1/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/AnnotationInfo((b.ho),b.ho,Some(b),ho,(b.ho): ho).suffix/scalar_1/source-map/lexical/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/ho/scalar_1/source-map/lexical/element_0" } ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/AnnotationInfo(x-b-ho2,b-ho2,Some(b),ho2,x-b-ho2: 2).suffix/scalar_1/source-map", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/ho2/scalar_1/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/AnnotationInfo(x-b-ho2,b-ho2,Some(b),ho2,x-b-ho2: 2).suffix/scalar_1/source-map/lexical/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/ho2/scalar_1/source-map/lexical/element_0" } ] }, @@ -358,33 +358,33 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(12,0)-(13,0)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/AnnotationInfo((anon1),anon1,None,anon1,(anon1): true).suffix/scalar_1/source-map/lexical/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/AnnotationInfo((anon1),anon1,None,anon1,(anon1): true).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/anon1/scalar_1/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/anon1/scalar_1", "http://a.ml/vocabularies/document-source-maps#value": "[(11,9)-(11,13)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/AnnotationInfo(x-anon2,anon2,None,anon2,x-anon2: 2.3[).suffix/scalar_1/source-map/lexical/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/AnnotationInfo(x-anon2,anon2,None,anon2,x-anon2: 2.3[).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/anon2/scalar_1/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodes/anon2/scalar_1", "http://a.ml/vocabularies/document-source-maps#value": "[(13,9)-(13,13)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/AnnotationInfo((a.hey),a.hey,Some(a),hey,(a.hey): hey).suffix/scalar_1/source-map/lexical/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/AnnotationInfo((a.hey),a.hey,Some(a),hey,(a.hey): hey).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/hey/scalar_1/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/hey/scalar_1", "http://a.ml/vocabularies/document-source-maps#value": "[(3,9)-(3,12)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/AnnotationInfo(x-a-hey2,a-hey2,Some(a),hey2,x-a-hey2: 1).suffix/scalar_1/source-map/lexical/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/AnnotationInfo(x-a-hey2,a-hey2,Some(a),hey2,x-a-hey2: 1).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/hey2/scalar_1/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesa/hey2/scalar_1", "http://a.ml/vocabularies/document-source-maps#value": "[(7,10)-(7,11)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/AnnotationInfo((b.ho),b.ho,Some(b),ho,(b.ho): ho).suffix/scalar_1/source-map/lexical/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/AnnotationInfo((b.ho),b.ho,Some(b),ho,(b.ho): ho).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/ho/scalar_1/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/ho/scalar_1", "http://a.ml/vocabularies/document-source-maps#value": "[(5,8)-(5,10)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/AnnotationInfo(x-b-ho2,b-ho2,Some(b),ho2,x-b-ho2: 2).suffix/scalar_1/source-map/lexical/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/AnnotationInfo(x-b-ho2,b-ho2,Some(b),ho2,x-b-ho2: 2).suffix/scalar_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/ho2/scalar_1/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example1_annotations.yaml#/encodesb/ho2/scalar_1", "http://a.ml/vocabularies/document-source-maps#value": "[(9,9)-(9,10)]" }, { diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example24.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example24.expanded.jsonld index 80d61e83..93dc0a41 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example24.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example24.expanded.jsonld @@ -99,9 +99,9 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24.yaml#/source-map/aliases-array/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24.yaml#/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24.yaml" @@ -109,14 +109,14 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/instances/library24.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/instances/library24.yaml::library24.yaml" + "@value": "[(2,0)-(5,0)]" } ] } ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24.yaml#/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24.yaml#/source-map/aliases-array/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24.yaml" @@ -124,7 +124,7 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(2,0)-(5,0)]" + "@value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/instances/library24.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/instances/library24.yaml::library24.yaml" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example24.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example24.flattened.jsonld index c4f1ea11..c2a20d25 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example24.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example24.flattened.jsonld @@ -116,14 +116,14 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24.yaml#/source-map/aliases-array/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24.yaml#/source-map/lexical/element_0" } ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24.yaml#/source-map/lexical/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24.yaml#/source-map/aliases-array/element_0" } ], "http://a.ml/vocabularies/document-source-maps#aliases-location": [ @@ -173,14 +173,14 @@ ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24.yaml#/source-map/aliases-array/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24.yaml#/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24.yaml", - "http://a.ml/vocabularies/document-source-maps#value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/instances/library24.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/instances/library24.yaml::library24.yaml" + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(5,0)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24.yaml#/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24.yaml#/source-map/aliases-array/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24.yaml", - "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(5,0)]" + "http://a.ml/vocabularies/document-source-maps#value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/instances/library24.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/instances/library24.yaml::library24.yaml" }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24.yaml#/source-map/aliases-location/element_0", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.expanded.jsonld index 986c04db..cf9dcdca 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.expanded.jsonld @@ -62,9 +62,9 @@ ] } ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + "http://a.ml/vocabularies/document-source-maps#json-pointer-ref": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.yaml#/encodes/rb/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.yaml#/encodes/rb/source-map/json-pointer-ref/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.yaml#/encodes/rb" @@ -72,14 +72,14 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(9,0)-(10,0)]" + "@value": "true" } ] } ], - "http://a.ml/vocabularies/document-source-maps#json-pointer-ref": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.yaml#/encodes/rb/source-map/json-pointer-ref/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.yaml#/encodes/rb/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.yaml#/encodes/rb" @@ -87,7 +87,7 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "true" + "@value": "[(9,0)-(10,0)]" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.flattened.jsonld index 96558e08..5d5dc916 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.flattened.jsonld @@ -78,14 +78,14 @@ "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.yaml#/encodes/rb/source-map/synthesized-field/element_0" } ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + "http://a.ml/vocabularies/document-source-maps#json-pointer-ref": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.yaml#/encodes/rb/source-map/lexical/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.yaml#/encodes/rb/source-map/json-pointer-ref/element_0" } ], - "http://a.ml/vocabularies/document-source-maps#json-pointer-ref": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.yaml#/encodes/rb/source-map/json-pointer-ref/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.yaml#/encodes/rb/source-map/lexical/element_0" } ] }, @@ -110,14 +110,14 @@ "http://a.ml/vocabularies/document-source-maps#value": "true" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.yaml#/encodes/rb/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.yaml#/encodes/rb/source-map/json-pointer-ref/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.yaml#/encodes/rb", - "http://a.ml/vocabularies/document-source-maps#value": "[(9,0)-(10,0)]" + "http://a.ml/vocabularies/document-source-maps#value": "true" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.yaml#/encodes/rb/source-map/json-pointer-ref/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.yaml#/encodes/rb/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.yaml#/encodes/rb", - "http://a.ml/vocabularies/document-source-maps#value": "true" + "http://a.ml/vocabularies/document-source-maps#value": "[(9,0)-(10,0)]" }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example24c.yaml", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.expanded.jsonld index 75c0f74e..8bbebcfc 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.expanded.jsonld @@ -42,9 +42,9 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/encodes/union/source-map/from-union-node-mapping/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/encodes/union/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/encodes/union" @@ -52,35 +52,35 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect27.yaml#/declarations/UnionNode" + "@value": "[(10,0)-(12,0)]" } ] - } - ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/encodes/union/source-map/lexical/element_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/encodes/union/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/encodes/union" + "@value": "http://test.com/v3#b" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(10,0)-(12,0)]" + "@value": "[(10,2)-(11,0)]" } ] - }, + } + ], + "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/encodes/union/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/encodes/union/source-map/from-union-node-mapping/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://test.com/v3#b" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/encodes/union" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(10,2)-(11,0)]" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect27.yaml#/declarations/UnionNode" } ] } @@ -203,21 +203,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/a/source-map/from-union-node-mapping/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/a" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect27.yaml#/declarations/UnionNode" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/a/source-map/lexical/element_2", @@ -258,6 +243,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/a/source-map/from-union-node-mapping/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/a" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect27.yaml#/declarations/UnionNode" + } + ] + } ] } ] @@ -286,21 +286,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/let's%20go/source-map/from-union-node-mapping/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/let's%20go" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect27.yaml#/declarations/UnionNode" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/let's%20go/source-map/lexical/element_2", @@ -341,6 +326,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/let's%20go/source-map/from-union-node-mapping/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/let's%20go" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect27.yaml#/declarations/UnionNode" + } + ] + } ] } ] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.flattened.jsonld index 21527f50..2782c211 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.flattened.jsonld @@ -64,11 +64,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/encodes/union/source-map/from-union-node-mapping/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/encodes/union/source-map/lexical/element_1" @@ -76,6 +71,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/encodes/union/source-map/lexical/element_0" } + ], + "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/encodes/union/source-map/from-union-node-mapping/element_0" + } ] }, { @@ -88,11 +88,6 @@ "http://a.ml/vocabularies/document-source-maps#element": "http://test.com/v3#union", "http://a.ml/vocabularies/document-source-maps#value": "[(9,0)-(12,0)]" }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/encodes/union/source-map/from-union-node-mapping/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/encodes/union", - "http://a.ml/vocabularies/document-source-maps#value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect27.yaml#/declarations/UnionNode" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/encodes/union/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/encodes/union", @@ -103,6 +98,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "http://test.com/v3#b", "http://a.ml/vocabularies/document-source-maps#value": "[(10,2)-(11,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/encodes/union/source-map/from-union-node-mapping/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/encodes/union", + "http://a.ml/vocabularies/document-source-maps#value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect27.yaml#/declarations/UnionNode" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml", "http://a.ml/vocabularies/document#declares": [ @@ -186,11 +186,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/a/source-map/from-union-node-mapping/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/a/source-map/lexical/element_2" @@ -201,6 +196,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/a/source-map/lexical/element_1" } + ], + "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/a/source-map/from-union-node-mapping/element_0" + } ] }, { @@ -208,11 +208,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/let's%20go/source-map/from-union-node-mapping/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/let's%20go/source-map/lexical/element_2" @@ -223,6 +218,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/let's%20go/source-map/lexical/element_1" } + ], + "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/let's%20go/source-map/from-union-node-mapping/element_0" + } ] }, { @@ -230,11 +230,6 @@ "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(12,0)]" }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/a/source-map/from-union-node-mapping/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/a", - "http://a.ml/vocabularies/document-source-maps#value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect27.yaml#/declarations/UnionNode" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/a/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#declarationName", @@ -251,8 +246,8 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(4,0)-(6,0)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/let's%20go/source-map/from-union-node-mapping/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/let's%20go", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/a/source-map/from-union-node-mapping/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/a", "http://a.ml/vocabularies/document-source-maps#value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect27.yaml#/declarations/UnionNode" }, { @@ -269,6 +264,11 @@ "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/let's%20go/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/let's%20go", "http://a.ml/vocabularies/document-source-maps#value": "[(7,0)-(9,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/let's%20go/source-map/from-union-node-mapping/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example27a.yaml#/nodes/let's%20go", + "http://a.ml/vocabularies/document-source-maps#value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect27.yaml#/declarations/UnionNode" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example31.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example31.expanded.jsonld index 85e4f5a1..2b7dcbf8 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example31.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example31.expanded.jsonld @@ -144,21 +144,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/bType/source-map/from-union-node-mapping/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/bType" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect31.yaml#/declarations/Union" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/bType/source-map/lexical/element_3", @@ -212,6 +197,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/bType/source-map/from-union-node-mapping/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/bType" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect31.yaml#/declarations/Union" + } + ] + } ] } ] @@ -244,21 +244,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/cType/source-map/from-union-node-mapping/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/cType" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect31.yaml#/declarations/Union" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/cType/source-map/lexical/element_3", @@ -312,6 +297,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/cType/source-map/from-union-node-mapping/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/cType" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect31.yaml#/declarations/Union" + } + ] + } ] } ] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example31.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example31.flattened.jsonld index e6ddd7fd..7d371aa5 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example31.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example31.flattened.jsonld @@ -134,11 +134,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/bType/source-map/from-union-node-mapping/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/bType/source-map/lexical/element_3" @@ -152,6 +147,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/bType/source-map/lexical/element_2" } + ], + "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/bType/source-map/from-union-node-mapping/element_0" + } ] }, { @@ -159,11 +159,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/cType/source-map/from-union-node-mapping/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/cType/source-map/lexical/element_3" @@ -177,6 +172,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/cType/source-map/lexical/element_2" } + ], + "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/cType/source-map/from-union-node-mapping/element_0" + } ] }, { @@ -184,11 +184,6 @@ "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(10,0)]" }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/bType/source-map/from-union-node-mapping/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/bType", - "http://a.ml/vocabularies/document-source-maps#value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect31.yaml#/declarations/Union" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/bType/source-map/lexical/element_3", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#type", @@ -210,8 +205,8 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(4,0)-(6,0)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/cType/source-map/from-union-node-mapping/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/cType", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/bType/source-map/from-union-node-mapping/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/bType", "http://a.ml/vocabularies/document-source-maps#value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect31.yaml#/declarations/Union" }, { @@ -233,6 +228,11 @@ "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/cType/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/cType", "http://a.ml/vocabularies/document-source-maps#value": "[(7,0)-(9,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/cType/source-map/from-union-node-mapping/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example31.yaml#/decs/cType", + "http://a.ml/vocabularies/document-source-maps#value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect31.yaml#/declarations/Union" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example33.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example33.expanded.jsonld index 0a4bdc4b..de7acdb8 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example33.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example33.expanded.jsonld @@ -32,9 +32,9 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example33.yaml#/encodes/source-map/from-union-node-mapping/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example33.yaml#/encodes/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example33.yaml#/encodes" @@ -42,17 +42,15 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect33.yaml#/declarations/RootNode" + "@value": "[(2,0)-(2,18)]" } ] - } - ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example33.yaml#/encodes/source-map/lexical/element_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example33.yaml#/encodes/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example33.yaml#/encodes" + "@value": "http://a.ml/vocabularies/data#propertyX" } ], "http://a.ml/vocabularies/document-source-maps#value": [ @@ -60,17 +58,19 @@ "@value": "[(2,0)-(2,18)]" } ] - }, + } + ], + "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example33.yaml#/encodes/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example33.yaml#/encodes/source-map/from-union-node-mapping/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://a.ml/vocabularies/data#propertyX" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example33.yaml#/encodes" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(2,0)-(2,18)]" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect33.yaml#/declarations/RootNode" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example33.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example33.flattened.jsonld index 2d0ebc61..cbf0cbf0 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example33.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example33.flattened.jsonld @@ -32,11 +32,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example33.yaml#/encodes/source-map/from-union-node-mapping/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example33.yaml#/encodes/source-map/lexical/element_1" @@ -44,13 +39,13 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example33.yaml#/encodes/source-map/lexical/element_0" } + ], + "http://a.ml/vocabularies/document-source-maps#from-union-node-mapping": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example33.yaml#/encodes/source-map/from-union-node-mapping/element_0" + } ] }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example33.yaml#/encodes/source-map/from-union-node-mapping/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example33.yaml#/encodes", - "http://a.ml/vocabularies/document-source-maps#value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect33.yaml#/declarations/RootNode" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example33.yaml#/encodes/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example33.yaml#/encodes", @@ -61,6 +56,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#propertyX", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(2,18)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example33.yaml#/encodes/source-map/from-union-node-mapping/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example33.yaml#/encodes", + "http://a.ml/vocabularies/document-source-maps#value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect33.yaml#/declarations/RootNode" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example33.yaml", "@type": [ diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example5.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example5.expanded.jsonld index 408e11b4..0edc9818 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example5.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example5.expanded.jsonld @@ -83,7 +83,7 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(3,6)-(5,0)]" + "@value": "[(3,2)-(5,0)]" } ] } @@ -151,7 +151,7 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(5,7)-(7,0)]" + "@value": "[(5,2)-(7,0)]" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example5.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example5.flattened.jsonld index 0a6d97f4..7ccc4447 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example5.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example5.flattened.jsonld @@ -138,7 +138,7 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example5.yaml#/encodes/a/hey/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example5.yaml#/encodes/a/hey", - "http://a.ml/vocabularies/document-source-maps#value": "[(3,6)-(5,0)]" + "http://a.ml/vocabularies/document-source-maps#value": "[(3,2)-(5,0)]" }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example5.yaml#/encodes/a/lets/source-map/lexical/element_2", @@ -153,7 +153,7 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example5.yaml#/encodes/a/lets/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example5.yaml#/encodes/a/lets", - "http://a.ml/vocabularies/document-source-maps#value": "[(5,7)-(7,0)]" + "http://a.ml/vocabularies/document-source-maps#value": "[(5,2)-(7,0)]" }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example5.yaml", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example6.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example6.expanded.jsonld index 902a3e85..b34abb0d 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example6.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example6.expanded.jsonld @@ -83,7 +83,7 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(7,6)-(9,0)]" + "@value": "[(7,2)-(9,0)]" } ] } @@ -130,7 +130,7 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(9,8)-(9,10)]" + "@value": "[(9,2)-(10,0)]" } ] }, diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example6.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example6.flattened.jsonld index 20daaf33..6aaeddde 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example6.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example6.flattened.jsonld @@ -140,12 +140,12 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6.yaml#/encodes/a/hey/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6.yaml#/encodes/a/hey", - "http://a.ml/vocabularies/document-source-maps#value": "[(7,6)-(9,0)]" + "http://a.ml/vocabularies/document-source-maps#value": "[(7,2)-(9,0)]" }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6.yaml#/encodes/a/lets/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6.yaml#/encodes/a/lets", - "http://a.ml/vocabularies/document-source-maps#value": "[(9,8)-(9,10)]" + "http://a.ml/vocabularies/document-source-maps#value": "[(9,2)-(10,0)]" }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6.yaml#/encodes/a/lets/source-map/lexical/element_0", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.expanded.jsonld index 02aeec7b..9a29aef7 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.expanded.jsonld @@ -83,7 +83,7 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(7,6)-(9,0)]" + "@value": "[(7,2)-(9,0)]" } ] } @@ -120,9 +120,9 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#json-pointer-ref": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml#/encodes/a/lets/source-map/json-pointer-ref/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml#/encodes/a/lets/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml#/encodes/a/lets" @@ -130,35 +130,35 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "true" + "@value": "[(9,2)-(11,0)]" } ] - } - ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml#/encodes/a/lets/source-map/lexical/element_1", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml#/encodes/a/lets/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml#/encodes/a/lets" + "@value": "http://test.com/tmp#a1" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(10,0)-(11,0)]" + "@value": "[(9,2)-(9,6)]" } ] - }, + } + ], + "http://a.ml/vocabularies/document-source-maps#json-pointer-ref": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml#/encodes/a/lets/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml#/encodes/a/lets/source-map/json-pointer-ref/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://test.com/tmp#a1" + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml#/encodes/a/lets" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(9,2)-(9,6)]" + "@value": "true" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.flattened.jsonld index 9ae85a63..1ad7ef98 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.flattened.jsonld @@ -108,11 +108,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#json-pointer-ref": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml#/encodes/a/lets/source-map/json-pointer-ref/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml#/encodes/a/lets/source-map/lexical/element_1" @@ -120,6 +115,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml#/encodes/a/lets/source-map/lexical/element_0" } + ], + "http://a.ml/vocabularies/document-source-maps#json-pointer-ref": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml#/encodes/a/lets/source-map/json-pointer-ref/element_0" + } ] }, { @@ -145,23 +145,23 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml#/encodes/a/hey/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml#/encodes/a/hey", - "http://a.ml/vocabularies/document-source-maps#value": "[(7,6)-(9,0)]" - }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml#/encodes/a/lets/source-map/json-pointer-ref/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml#/encodes/a/lets", - "http://a.ml/vocabularies/document-source-maps#value": "true" + "http://a.ml/vocabularies/document-source-maps#value": "[(7,2)-(9,0)]" }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml#/encodes/a/lets/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml#/encodes/a/lets", - "http://a.ml/vocabularies/document-source-maps#value": "[(10,0)-(11,0)]" + "http://a.ml/vocabularies/document-source-maps#value": "[(9,2)-(11,0)]" }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml#/encodes/a/lets/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "http://test.com/tmp#a1", "http://a.ml/vocabularies/document-source-maps#value": "[(9,2)-(9,6)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml#/encodes/a/lets/source-map/json-pointer-ref/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml#/encodes/a/lets", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example6b.yaml", "http://a.ml/vocabularies/document#declares": [ diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.expanded.jsonld index f6d5877b..2bbc43ec 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.expanded.jsonld @@ -71,9 +71,9 @@ ] } ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + "http://a.ml/vocabularies/document-source-maps#ref-include": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.yaml#/encodes/b/a/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.yaml#/encodes/b/a/source-map/ref-include/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.yaml#/encodes/b/a" @@ -81,14 +81,14 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(3,4)-(5,0)]" + "@value": "true" } ] } ], - "http://a.ml/vocabularies/document-source-maps#ref-include": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.yaml#/encodes/b/a/source-map/ref-include/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.yaml#/encodes/b/a/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.yaml#/encodes/b/a" @@ -96,7 +96,7 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "true" + "@value": "[(3,4)-(5,0)]" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.flattened.jsonld index 30aef275..2d538a53 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.flattened.jsonld @@ -115,14 +115,14 @@ "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.yaml#/encodes/b/a/source-map/synthesized-field/element_0" } ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + "http://a.ml/vocabularies/document-source-maps#ref-include": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.yaml#/encodes/b/a/source-map/lexical/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.yaml#/encodes/b/a/source-map/ref-include/element_0" } ], - "http://a.ml/vocabularies/document-source-maps#ref-include": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.yaml#/encodes/b/a/source-map/ref-include/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.yaml#/encodes/b/a/source-map/lexical/element_0" } ] }, @@ -142,14 +142,14 @@ "http://a.ml/vocabularies/document-source-maps#value": "true" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.yaml#/encodes/b/a/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.yaml#/encodes/b/a/source-map/ref-include/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.yaml#/encodes/b/a", - "http://a.ml/vocabularies/document-source-maps#value": "[(3,4)-(5,0)]" + "http://a.ml/vocabularies/document-source-maps#value": "true" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.yaml#/encodes/b/a/source-map/ref-include/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.yaml#/encodes/b/a/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.yaml#/encodes/b/a", - "http://a.ml/vocabularies/document-source-maps#value": "true" + "http://a.ml/vocabularies/document-source-maps#value": "[(3,4)-(5,0)]" }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8b.yaml", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.expanded.jsonld index 4c815758..08d58c47 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.expanded.jsonld @@ -71,9 +71,9 @@ ] } ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + "http://a.ml/vocabularies/document-source-maps#json-pointer-ref": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.yaml#/encodes/b/a/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.yaml#/encodes/b/a/source-map/json-pointer-ref/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.yaml#/encodes/b/a" @@ -81,14 +81,14 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(4,0)-(5,0)]" + "@value": "true" } ] } ], - "http://a.ml/vocabularies/document-source-maps#json-pointer-ref": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.yaml#/encodes/b/a/source-map/json-pointer-ref/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.yaml#/encodes/b/a/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.yaml#/encodes/b/a" @@ -96,7 +96,7 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "true" + "@value": "[(4,0)-(5,0)]" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.flattened.jsonld index d1110412..c287b618 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.flattened.jsonld @@ -115,14 +115,14 @@ "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.yaml#/encodes/b/a/source-map/synthesized-field/element_0" } ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + "http://a.ml/vocabularies/document-source-maps#json-pointer-ref": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.yaml#/encodes/b/a/source-map/lexical/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.yaml#/encodes/b/a/source-map/json-pointer-ref/element_0" } ], - "http://a.ml/vocabularies/document-source-maps#json-pointer-ref": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.yaml#/encodes/b/a/source-map/json-pointer-ref/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.yaml#/encodes/b/a/source-map/lexical/element_0" } ] }, @@ -142,14 +142,14 @@ "http://a.ml/vocabularies/document-source-maps#value": "true" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.yaml#/encodes/b/a/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.yaml#/encodes/b/a/source-map/json-pointer-ref/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.yaml#/encodes/b/a", - "http://a.ml/vocabularies/document-source-maps#value": "[(4,0)-(5,0)]" + "http://a.ml/vocabularies/document-source-maps#value": "true" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.yaml#/encodes/b/a/source-map/json-pointer-ref/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.yaml#/encodes/b/a/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.yaml#/encodes/b/a", - "http://a.ml/vocabularies/document-source-maps#value": "true" + "http://a.ml/vocabularies/document-source-maps#value": "[(4,0)-(5,0)]" }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example8c.yaml", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example9.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example9.expanded.jsonld index df3c719d..23d8927b 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example9.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example9.expanded.jsonld @@ -153,9 +153,9 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9.yaml#/source-map/aliases-array/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9.yaml#/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9.yaml" @@ -163,14 +163,14 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/instances/library9.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/instances/library9.yaml::library9.yaml" + "@value": "[(2,0)-(8,0)]" } ] } ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9.yaml#/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9.yaml#/source-map/aliases-array/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9.yaml" @@ -178,7 +178,7 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(2,0)-(8,0)]" + "@value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/instances/library9.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/instances/library9.yaml::library9.yaml" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example9.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example9.flattened.jsonld index 8dd2ed0a..e711f58b 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example9.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example9.flattened.jsonld @@ -187,14 +187,14 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9.yaml#/source-map/aliases-array/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9.yaml#/source-map/lexical/element_0" } ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9.yaml#/source-map/lexical/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9.yaml#/source-map/aliases-array/element_0" } ], "http://a.ml/vocabularies/document-source-maps#aliases-location": [ @@ -282,14 +282,14 @@ ] }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9.yaml#/source-map/aliases-array/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9.yaml#/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9.yaml", - "http://a.ml/vocabularies/document-source-maps#value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/instances/library9.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/instances/library9.yaml::library9.yaml" + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(8,0)]" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9.yaml#/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9.yaml#/source-map/aliases-array/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9.yaml", - "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(8,0)]" + "http://a.ml/vocabularies/document-source-maps#value": "lib->file://amf-aml/shared/src/test/resources/vocabularies2/instances/library9.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/instances/library9.yaml::library9.yaml" }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9.yaml#/source-map/aliases-location/element_0", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.expanded.jsonld index df958fa7..1df9a31c 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.expanded.jsonld @@ -378,9 +378,9 @@ ] } ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + "http://a.ml/vocabularies/document-source-maps#json-pointer-ref": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.yaml#/Bs/Hey/a/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.yaml#/Bs/Hey/a/source-map/json-pointer-ref/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.yaml#/Bs/Hey/a" @@ -388,14 +388,14 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(5,0)-(6,0)]" + "@value": "true" } ] } ], - "http://a.ml/vocabularies/document-source-maps#json-pointer-ref": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.yaml#/Bs/Hey/a/source-map/json-pointer-ref/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.yaml#/Bs/Hey/a/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.yaml#/Bs/Hey/a" @@ -403,7 +403,7 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "true" + "@value": "[(5,0)-(6,0)]" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.flattened.jsonld index f2707af8..61e29da2 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.flattened.jsonld @@ -311,14 +311,14 @@ "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.yaml#/Bs/Hey/a/source-map/synthesized-field/element_0" } ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + "http://a.ml/vocabularies/document-source-maps#json-pointer-ref": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.yaml#/Bs/Hey/a/source-map/lexical/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.yaml#/Bs/Hey/a/source-map/json-pointer-ref/element_0" } ], - "http://a.ml/vocabularies/document-source-maps#json-pointer-ref": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.yaml#/Bs/Hey/a/source-map/json-pointer-ref/element_0" + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.yaml#/Bs/Hey/a/source-map/lexical/element_0" } ] }, @@ -363,14 +363,14 @@ "http://a.ml/vocabularies/document-source-maps#value": "true" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.yaml#/Bs/Hey/a/source-map/lexical/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.yaml#/Bs/Hey/a/source-map/json-pointer-ref/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.yaml#/Bs/Hey/a", - "http://a.ml/vocabularies/document-source-maps#value": "[(5,0)-(6,0)]" + "http://a.ml/vocabularies/document-source-maps#value": "true" }, { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.yaml#/Bs/Hey/a/source-map/json-pointer-ref/element_0", + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.yaml#/Bs/Hey/a/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/example9b.yaml#/Bs/Hey/a", - "http://a.ml/vocabularies/document-source-maps#value": "true" + "http://a.ml/vocabularies/document-source-maps#value": "[(5,0)-(6,0)]" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/id-template/if-then-else-2/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/id-template/if-then-else-2/dialect.yaml new file mode 100644 index 00000000..1b7fa79c --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/id-template/if-then-else-2/dialect.yaml @@ -0,0 +1,33 @@ +#%Dialect 1.0 +dialect: Test +version: "1.0" + +external: + schema-org: https://schema.org/ + +documents: + root: + encodes: RootMapping + +nodeMappings: + RootMapping: + conditional: + if: ConditionMapping + then: ThenMapping + else: ElseMapping + ConditionMapping: + mapping: + someField: + range: ThenMapping + enum: [ "conditional-value" ] + mandatory: true + ThenMapping: + mapping: + someField: + range: string + propertyTerm: schema-org.name + ElseMapping: + mapping: + someOtherField: + range: string + propertyTerm: schema-org.description diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/id-template/if-then-else-2/instance.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/id-template/if-then-else-2/instance.expanded.jsonld new file mode 100644 index 00000000..8339ffd0 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/id-template/if-then-else-2/instance.expanded.jsonld @@ -0,0 +1,119 @@ +[ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml", + "@type": [ + "http://a.ml/vocabularies/meta#DialectInstance", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#encodes": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml#/encodes", + "@type": [ + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/dialect.yaml#/declarations/ElseMapping", + "http://a.ml/vocabularies/meta#DialectDomainElement", + "http://a.ml/vocabularies/document#DomainElement" + ], + "https://schema.org/description": [ + { + "@value": "test" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml#/encodes/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml#/encodes/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml#/encodes" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml#/encodes/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "https://schema.org/description" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document#root": [ + { + "@value": true + } + ], + "http://a.ml/vocabularies/document#processingData": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#DialectInstanceProcessingData" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#transformed": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/document#sourceSpec": [ + { + "@value": "Test 1.0" + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + } + ] + } + ] + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/id-template/if-then-else-2/instance.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/id-template/if-then-else-2/instance.flattened.jsonld new file mode 100644 index 00000000..cf8a26ab --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/id-template/if-then-else-2/instance.flattened.jsonld @@ -0,0 +1,98 @@ +{ + "@graph": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#DialectInstanceProcessingData" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#transformed": false, + "http://a.ml/vocabularies/document#sourceSpec": "Test 1.0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml#/encodes", + "@type": [ + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/dialect.yaml#/declarations/ElseMapping", + "http://a.ml/vocabularies/meta#DialectDomainElement", + "http://a.ml/vocabularies/document#DomainElement" + ], + "https://schema.org/description": "test", + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml#/encodes/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml#/encodes/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml#/encodes/source-map/lexical/element_1" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml#/encodes/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml#/encodes/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml#/encodes", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(3,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml#/encodes/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "https://schema.org/description", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(3,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml", + "@type": [ + "http://a.ml/vocabularies/meta#DialectInstance", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#encodes": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml#/encodes" + }, + "http://a.ml/vocabularies/document#root": true, + "http://a.ml/vocabularies/document#processingData": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml/BaseUnitProcessingData" + }, + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml#/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-1/instance.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(3,0)]" + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/id-template/if-then-else-2/instance.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/id-template/if-then-else-2/instance.yaml new file mode 100644 index 00000000..18a6bd72 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/id-template/if-then-else-2/instance.yaml @@ -0,0 +1,2 @@ +#%Test 1.0 +someOtherField: test diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/dialect.yaml new file mode 100644 index 00000000..ecaa6393 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/dialect.yaml @@ -0,0 +1,32 @@ +#%Dialect 1.0 +dialect: Test +version: "1.0" + +external: + schema-org: https://schema.org/ + +documents: + root: + encodes: RootMapping + +nodeMappings: + RootMapping: + conditional: + if: ConditionMapping + then: ThenMapping + else: ElseMapping + ConditionMapping: + mapping: + someField: + range: string + enum: [notTest] + ThenMapping: + mapping: + someField: + range: string + propertyTerm: schema-org.name + ElseMapping: + mapping: + someOtherField: + range: string + propertyTerm: schema-org.description diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.expanded.jsonld new file mode 100644 index 00000000..dfc543c0 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.expanded.jsonld @@ -0,0 +1,119 @@ +[ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml", + "@type": [ + "http://a.ml/vocabularies/meta#DialectInstance", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#encodes": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml#/encodes", + "@type": [ + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/dialect.yaml#/declarations/ElseMapping", + "http://a.ml/vocabularies/meta#DialectDomainElement", + "http://a.ml/vocabularies/document#DomainElement" + ], + "https://schema.org/description": [ + { + "@value": "otherFieldThatShouldGetParsed" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml#/encodes/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml#/encodes/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml#/encodes" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(4,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml#/encodes/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "https://schema.org/description" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(3,0)-(4,0)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document#root": [ + { + "@value": true + } + ], + "http://a.ml/vocabularies/document#processingData": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#DialectInstanceProcessingData" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#transformed": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/document#sourceSpec": [ + { + "@value": "Test 1.0" + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(4,0)]" + } + ] + } + ] + } + ] + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.flattened.jsonld new file mode 100644 index 00000000..07a2a3ec --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.flattened.jsonld @@ -0,0 +1,98 @@ +{ + "@graph": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#DialectInstanceProcessingData" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#transformed": false, + "http://a.ml/vocabularies/document#sourceSpec": "Test 1.0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml#/encodes", + "@type": [ + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/dialect.yaml#/declarations/ElseMapping", + "http://a.ml/vocabularies/meta#DialectDomainElement", + "http://a.ml/vocabularies/document#DomainElement" + ], + "https://schema.org/description": "otherFieldThatShouldGetParsed", + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml#/encodes/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml#/encodes/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml#/encodes/source-map/lexical/element_1" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml#/encodes/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml#/encodes/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml#/encodes", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(4,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml#/encodes/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "https://schema.org/description", + "http://a.ml/vocabularies/document-source-maps#value": "[(3,0)-(4,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml", + "@type": [ + "http://a.ml/vocabularies/meta#DialectInstance", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#encodes": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml#/encodes" + }, + "http://a.ml/vocabularies/document#root": true, + "http://a.ml/vocabularies/document#processingData": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml/BaseUnitProcessingData" + }, + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml#/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(4,0)]" + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.multi-source.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.multi-source.yaml new file mode 100644 index 00000000..3f985aa1 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.multi-source.yaml @@ -0,0 +1,2 @@ +#%Test 1.0 +someOtherField: otherFieldThatShouldGetParsed diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml new file mode 100644 index 00000000..576614eb --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-invalid-if/instance.yaml @@ -0,0 +1,3 @@ +#%Test 1.0 +someField: test +someOtherField: otherFieldThatShouldGetParsed diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/dialect.yaml new file mode 100644 index 00000000..1b7fa79c --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/dialect.yaml @@ -0,0 +1,33 @@ +#%Dialect 1.0 +dialect: Test +version: "1.0" + +external: + schema-org: https://schema.org/ + +documents: + root: + encodes: RootMapping + +nodeMappings: + RootMapping: + conditional: + if: ConditionMapping + then: ThenMapping + else: ElseMapping + ConditionMapping: + mapping: + someField: + range: ThenMapping + enum: [ "conditional-value" ] + mandatory: true + ThenMapping: + mapping: + someField: + range: string + propertyTerm: schema-org.name + ElseMapping: + mapping: + someOtherField: + range: string + propertyTerm: schema-org.description diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.expanded.jsonld new file mode 100644 index 00000000..3349aa90 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.expanded.jsonld @@ -0,0 +1,119 @@ +[ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml", + "@type": [ + "http://a.ml/vocabularies/meta#DialectInstance", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#encodes": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml#/encodes", + "@type": [ + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/dialect.yaml#/declarations/ElseMapping", + "http://a.ml/vocabularies/meta#DialectDomainElement", + "http://a.ml/vocabularies/document#DomainElement" + ], + "https://schema.org/description": [ + { + "@value": "test" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml#/encodes/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml#/encodes/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml#/encodes" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml#/encodes/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "https://schema.org/description" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document#root": [ + { + "@value": true + } + ], + "http://a.ml/vocabularies/document#processingData": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#DialectInstanceProcessingData" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#transformed": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/document#sourceSpec": [ + { + "@value": "Test 1.0" + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + } + ] + } + ] + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.flattened.jsonld new file mode 100644 index 00000000..8f27755b --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.flattened.jsonld @@ -0,0 +1,98 @@ +{ + "@graph": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#DialectInstanceProcessingData" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#transformed": false, + "http://a.ml/vocabularies/document#sourceSpec": "Test 1.0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml#/encodes", + "@type": [ + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/dialect.yaml#/declarations/ElseMapping", + "http://a.ml/vocabularies/meta#DialectDomainElement", + "http://a.ml/vocabularies/document#DomainElement" + ], + "https://schema.org/description": "test", + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml#/encodes/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml#/encodes/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml#/encodes/source-map/lexical/element_1" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml#/encodes/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml#/encodes/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml#/encodes", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(3,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml#/encodes/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "https://schema.org/description", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(3,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml", + "@type": [ + "http://a.ml/vocabularies/meta#DialectInstance", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#encodes": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml#/encodes" + }, + "http://a.ml/vocabularies/document#root": true, + "http://a.ml/vocabularies/document#processingData": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml/BaseUnitProcessingData" + }, + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml#/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(3,0)]" + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.multi-source.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.multi-source.yaml new file mode 100644 index 00000000..18a6bd72 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.multi-source.yaml @@ -0,0 +1,2 @@ +#%Test 1.0 +someOtherField: test diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml new file mode 100644 index 00000000..18a6bd72 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-parsing-error/instance.yaml @@ -0,0 +1,2 @@ +#%Test 1.0 +someOtherField: test diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/dialect.yaml new file mode 100644 index 00000000..86d10c57 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/dialect.yaml @@ -0,0 +1,32 @@ +#%Dialect 1.0 +dialect: Test +version: "1.0" + +external: + schema-org: https://schema.org/ + +documents: + root: + encodes: RootMapping + +nodeMappings: + RootMapping: + conditional: + if: ConditionMapping + then: ThenMapping + else: ElseMapping + ConditionMapping: + mapping: + decidingField: + range: any + mandatory: true + ThenMapping: + mapping: + someField: + range: string + propertyTerm: schema-org.name + ElseMapping: + mapping: + someOtherField: + range: string + propertyTerm: schema-org.description diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.expanded.jsonld new file mode 100644 index 00000000..6ab56c8f --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.expanded.jsonld @@ -0,0 +1,119 @@ +[ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml", + "@type": [ + "http://a.ml/vocabularies/meta#DialectInstance", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#encodes": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml#/encodes", + "@type": [ + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/dialect.yaml#/declarations/ThenMapping", + "http://a.ml/vocabularies/meta#DialectDomainElement", + "http://a.ml/vocabularies/document#DomainElement" + ], + "https://schema.org/name": [ + { + "@value": "test" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml#/encodes/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml#/encodes/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml#/encodes" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(4,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml#/encodes/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "https://schema.org/name" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(3,0)-(4,0)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document#root": [ + { + "@value": true + } + ], + "http://a.ml/vocabularies/document#processingData": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#DialectInstanceProcessingData" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#transformed": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/document#sourceSpec": [ + { + "@value": "Test 1.0" + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(4,0)]" + } + ] + } + ] + } + ] + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.flattened.jsonld new file mode 100644 index 00000000..434c02a2 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.flattened.jsonld @@ -0,0 +1,98 @@ +{ + "@graph": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#DialectInstanceProcessingData" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#transformed": false, + "http://a.ml/vocabularies/document#sourceSpec": "Test 1.0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml#/encodes", + "@type": [ + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/dialect.yaml#/declarations/ThenMapping", + "http://a.ml/vocabularies/meta#DialectDomainElement", + "http://a.ml/vocabularies/document#DomainElement" + ], + "https://schema.org/name": "test", + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml#/encodes/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml#/encodes/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml#/encodes/source-map/lexical/element_1" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml#/encodes/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml#/encodes/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml#/encodes", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(4,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml#/encodes/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "https://schema.org/name", + "http://a.ml/vocabularies/document-source-maps#value": "[(3,0)-(4,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml", + "@type": [ + "http://a.ml/vocabularies/meta#DialectInstance", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#encodes": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml#/encodes" + }, + "http://a.ml/vocabularies/document#root": true, + "http://a.ml/vocabularies/document#processingData": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml/BaseUnitProcessingData" + }, + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml#/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(4,0)]" + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.multi-source.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.multi-source.yaml new file mode 100644 index 00000000..2f59ad00 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.multi-source.yaml @@ -0,0 +1,2 @@ +#%Test 1.0 +someField: test diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml new file mode 100644 index 00000000..e2c5b748 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/if-then-else-valid-if/instance.yaml @@ -0,0 +1,3 @@ +#%Test 1.0 +decidingField: true +someField: test diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-multiple-validations/invalid.json b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-multiple-validations/invalid.json new file mode 100644 index 00000000..2e1696a5 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-multiple-validations/invalid.json @@ -0,0 +1,38 @@ +{ + "$type": "Dialect 1.0", + "nodeMappings": { + "MyNodeMapping": { + "mapping": { + "propertyA": { + "range": "integer", + "mandatory": true, + "enum": [ + "some-enum-value" + ] + }, + "propertyB": { + "range": "boolean", + "mandatory": false, + "enum": [ + 60 + ] + }, + "propertyC": { + "range": "boolean", + "mandatory": false, + "enum": [ + 10000 + ] + } + }, + "additionalProperties": true + } + }, + "dialect": "Test", + "version": "1.0", + "documents": { + "root": { + "encodes": "MyNodeMapping" + } + } +} \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-multiple-validations/report.json b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-multiple-validations/report.json new file mode 100644 index 00000000..f70eae67 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-multiple-validations/report.json @@ -0,0 +1,180 @@ +{ + "@type": "http://www.w3.org/ns/shacl#ValidationReport", + "http://www.w3.org/ns/shacl#conforms": false, + "http://www.w3.org/ns/shacl#result": [ + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "anId" + }, + "http://www.w3.org/ns/shacl#resultPath": { + "@id": "http://a.ml/vocabularies/data#propertyA" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Cannot find expected range for property http://a.ml/vocabularies/data#propertyA (propertyA). Found 'http://www.w3.org/2001/XMLSchema#string', expected 'http://www.w3.org/2001/XMLSchema#integer'", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "http://a.ml/vocabularies/amf/aml#inconsistent-property-range-value" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 10, + "http://a.ml/vocabularies/amf/parser#column": 12 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 10, + "http://a.ml/vocabularies/amf/parser#column": 29 + } + } + }, + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-multiple-validations/invalid.json" + }, + "http://www.w3.org/ns/shacl#resultPath": { + "@id": "http://a.ml/vocabularies/data#propertyA" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Property 'propertyA' value must be of type http://www.w3.org/2001/XMLSchema#integer", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-multiple-validations/invalid.json#/declarations/MyNodeMapping_propertyA_dataRange_validation" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 10, + "http://a.ml/vocabularies/amf/parser#column": 12 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 10, + "http://a.ml/vocabularies/amf/parser#column": 29 + } + } + }, + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "anId" + }, + "http://www.w3.org/ns/shacl#resultPath": { + "@id": "http://a.ml/vocabularies/data#propertyB" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Cannot find expected range for property http://a.ml/vocabularies/data#propertyB (propertyB). Found 'http://www.w3.org/2001/XMLSchema#integer', expected 'http://www.w3.org/2001/XMLSchema#boolean'", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "http://a.ml/vocabularies/amf/aml#inconsistent-property-range-value" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 17, + "http://a.ml/vocabularies/amf/parser#column": 12 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 17, + "http://a.ml/vocabularies/amf/parser#column": 14 + } + } + }, + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-multiple-validations/invalid.json" + }, + "http://www.w3.org/ns/shacl#resultPath": { + "@id": "http://a.ml/vocabularies/data#propertyB" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Property 'propertyB' value must be of type http://www.w3.org/2001/XMLSchema#boolean", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-multiple-validations/invalid.json#/declarations/MyNodeMapping_propertyB_dataRange_validation" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 17, + "http://a.ml/vocabularies/amf/parser#column": 12 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 17, + "http://a.ml/vocabularies/amf/parser#column": 14 + } + } + }, + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "anId" + }, + "http://www.w3.org/ns/shacl#resultPath": { + "@id": "http://a.ml/vocabularies/data#propertyC" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Cannot find expected range for property http://a.ml/vocabularies/data#propertyC (propertyC). Found 'http://www.w3.org/2001/XMLSchema#integer', expected 'http://www.w3.org/2001/XMLSchema#boolean'", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "http://a.ml/vocabularies/amf/aml#inconsistent-property-range-value" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 24, + "http://a.ml/vocabularies/amf/parser#column": 12 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 24, + "http://a.ml/vocabularies/amf/parser#column": 17 + } + } + }, + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-multiple-validations/invalid.json" + }, + "http://www.w3.org/ns/shacl#resultPath": { + "@id": "http://a.ml/vocabularies/data#propertyC" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Property 'propertyC' value must be of type http://www.w3.org/2001/XMLSchema#boolean", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-multiple-validations/invalid.json#/declarations/MyNodeMapping_propertyC_dataRange_validation" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 24, + "http://a.ml/vocabularies/amf/parser#column": 12 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 24, + "http://a.ml/vocabularies/amf/parser#column": 17 + } + } + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-multiple-validations/valid.json b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-multiple-validations/valid.json new file mode 100644 index 00000000..a9283c39 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-multiple-validations/valid.json @@ -0,0 +1,38 @@ +{ + "$type": "Dialect 1.0", + "nodeMappings": { + "MyNodeMapping": { + "mapping": { + "propertyA": { + "range": "string", + "mandatory": true, + "enum": [ + "some-enum-value" + ] + }, + "propertyB": { + "range": "integer", + "mandatory": false, + "enum": [ + 60 + ] + }, + "propertyC": { + "range": "integer", + "mandatory": false, + "enum": [ + 10000 + ] + } + }, + "additionalProperties": true + } + }, + "dialect": "Test", + "version": "1.0", + "documents": { + "root": { + "encodes": "MyNodeMapping" + } + } +} \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-single-validations/invalid.json b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-single-validations/invalid.json new file mode 100644 index 00000000..9a83fb0c --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-single-validations/invalid.json @@ -0,0 +1,24 @@ +{ + "$type": "Dialect 1.0", + "nodeMappings": { + "MyNodeMapping": { + "mapping": { + "propertyA": { + "range": "integer", + "mandatory": true, + "enum": [ + "some-enum-value" + ] + } + }, + "additionalProperties": true + } + }, + "dialect": "Test", + "version": "1.0", + "documents": { + "root": { + "encodes": "MyNodeMapping" + } + } +} \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-single-validations/report.json b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-single-validations/report.json new file mode 100644 index 00000000..464c56b6 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-single-validations/report.json @@ -0,0 +1,64 @@ +{ + "@type": "http://www.w3.org/ns/shacl#ValidationReport", + "http://www.w3.org/ns/shacl#conforms": false, + "http://www.w3.org/ns/shacl#result": [ + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "anId" + }, + "http://www.w3.org/ns/shacl#resultPath": { + "@id": "http://a.ml/vocabularies/data#propertyA" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Cannot find expected range for property http://a.ml/vocabularies/data#propertyA (propertyA). Found 'http://www.w3.org/2001/XMLSchema#string', expected 'http://www.w3.org/2001/XMLSchema#integer'", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "http://a.ml/vocabularies/amf/aml#inconsistent-property-range-value" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 10, + "http://a.ml/vocabularies/amf/parser#column": 12 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 10, + "http://a.ml/vocabularies/amf/parser#column": 29 + } + } + }, + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-single-validations/invalid.json" + }, + "http://www.w3.org/ns/shacl#resultPath": { + "@id": "http://a.ml/vocabularies/data#propertyA" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Property 'propertyA' value must be of type http://www.w3.org/2001/XMLSchema#integer", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-single-validations/invalid.json#/declarations/MyNodeMapping_propertyA_dataRange_validation" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 10, + "http://a.ml/vocabularies/amf/parser#column": 12 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 10, + "http://a.ml/vocabularies/amf/parser#column": 29 + } + } + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-single-validations/valid.json b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-single-validations/valid.json new file mode 100644 index 00000000..d4f9525a --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/dialect-enum-single-validations/valid.json @@ -0,0 +1,24 @@ +{ + "$type": "Dialect 1.0", + "nodeMappings": { + "MyNodeMapping": { + "mapping": { + "propertyA": { + "range": "string", + "mandatory": true, + "enum": [ + "some-enum-value" + ] + } + }, + "additionalProperties": true + } + }, + "dialect": "Test", + "version": "1.0", + "documents": { + "root": { + "encodes": "MyNodeMapping" + } + } +} \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/id-directive-invalid/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/id-directive-invalid/dialect.yaml new file mode 100644 index 00000000..dc72cc16 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/id-directive-invalid/dialect.yaml @@ -0,0 +1,13 @@ +#%Dialect 1.0 +$id: + some: node +dialect: Test +version: 1.0 +nodeMappings: + RootNode: + mapping: + myProperty: + range: string +documents: + root: + encodes: RootNode \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/id-directive-invalid/report.txt b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/id-directive-invalid/report.txt new file mode 100644 index 00000000..6abcbfe2 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/id-directive-invalid/report.txt @@ -0,0 +1,14 @@ +ModelId: file://amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/id-directive-invalid/dialect.yaml +Profile: +Conforms: false +Number of results: 1 + +Level: Violation + +- Constraint: http://a.ml/vocabularies/amf/aml#dialect-error + Message: Invalid type !!map for $id directive. Expected !!str + Severity: Violation + Target: http://a.ml/amf/default_document/test/1.0 + Property: + Range: [(2,4)-(4,0)] + Location: file://amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/id-directive-invalid/dialect.yaml diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/id-directive-valid/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/id-directive-valid/dialect.yaml new file mode 100644 index 00000000..28951af4 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/id-directive-valid/dialect.yaml @@ -0,0 +1,18 @@ +#%Dialect 1.0 +$id: https://dialects.aml/test-1-0 +dialect: Test +version: "1.0" +uses: + lib: library.yaml +nodeMappings: + AnotherNodeFragment: !include fragment.yaml + AnotherNodeLibrary: lib.AnotherNode + RootNode: + mapping: + fragmentAnother: + range: AnotherNodeFragment + libraryAnother: + range: AnotherNodeLibrary +documents: + root: + encodes: RootNode \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/id-directive-valid/fragment.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/id-directive-valid/fragment.yaml new file mode 100644 index 00000000..42fbf1b9 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/id-directive-valid/fragment.yaml @@ -0,0 +1,5 @@ +#%NodeMapping/Dialect1.0 +$id: https://fragments.aml/test-1-0 +mapping: + anotherProperty: + range: string \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/id-directive-valid/library.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/id-directive-valid/library.yaml new file mode 100644 index 00000000..30fbce78 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/id-directive-valid/library.yaml @@ -0,0 +1,7 @@ +#%Library/Dialect1.0 +$id: https://libraries.aml/test-1-0 +nodeMappings: + AnotherNode: + mapping: + anotherProperty: + range: string \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/id-directive-valid/report.txt b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/id-directive-valid/report.txt new file mode 100644 index 00000000..cb1ce8a4 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/id-directive-valid/report.txt @@ -0,0 +1,4 @@ +ModelId: file://amf-aml/shared/src/test/resources/vocabularies2/instances/invalids/id-directive-valid/dialect.yaml +Profile: +Conforms: true +Number of results: 0 diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/json-root-union/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/json-root-union/dialect.yaml new file mode 100644 index 00000000..d1604046 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/json-root-union/dialect.yaml @@ -0,0 +1,27 @@ +#%Dialect 1.0 +nodeMappings: + Child: + union: + - SchemaNode + - SchemaNode_1 + SchemaNode_1: + classTerm: foaf.Location + mapping: + address: + range: string + propertyTerm: foaf.address + mandatory: false + SchemaNode: + classTerm: foaf.Something + mapping: + displayName: + range: string + propertyTerm: foaf.displayName + mandatory: false +external: + foaf: http://xmlns.com/foaf/0.1/ +dialect: amf-json-schema-generated-dialect +version: "1.0" +documents: + root: + encodes: Child diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/json-root-union/instance.golden.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/json-root-union/instance.golden.jsonld new file mode 100644 index 00000000..bb6406f7 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/json-root-union/instance.golden.jsonld @@ -0,0 +1,55 @@ +{ + "@graph": [ + { + "@id": "/BaseUnitProcessingData", + "@type": [ + "doc:DialectInstanceProcessingData" + ], + "meta:definedBy": [ + { + "@id": "./dialect.yaml" + } + ], + "doc:transformed": false, + "doc:sourceSpec": "amf-json-schema-generated-dialect 1.0" + }, + { + "@id": "#/encodes", + "@type": [ + "foaf:Something", + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/json-root-union/dialect.yaml#/declarations/SchemaNode", + "meta:DialectDomainElement", + "doc:DomainElement" + ], + "foaf:displayName": "Pepito" + }, + { + "@id": "", + "@type": [ + "meta:DialectInstance", + "doc:Document", + "doc:Fragment", + "doc:Module", + "doc:Unit" + ], + "meta:definedBy": [ + { + "@id": "./dialect.yaml" + } + ], + "doc:encodes": { + "@id": "#/encodes" + }, + "doc:root": true, + "doc:processingData": { + "@id": "/BaseUnitProcessingData" + } + } + ], + "@context": { + "@base": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/json-root-union/instance.json", + "doc": "http://a.ml/vocabularies/document#", + "meta": "http://a.ml/vocabularies/meta#", + "foaf": "http://xmlns.com/foaf/0.1/" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/json-root-union/instance.json b/amf-aml/shared/src/test/resources/vocabularies2/instances/json-root-union/instance.json new file mode 100644 index 00000000..a2bd4e67 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/json-root-union/instance.json @@ -0,0 +1,4 @@ +{ + "$dialect": "amf-json-schema-generated-dialect 1.0", + "displayName": "Pepito" +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/dialect.yaml new file mode 100644 index 00000000..9d2aa5c9 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/dialect.yaml @@ -0,0 +1,13 @@ +#%Dialect 1.0 +dialect: Long-Datatype +version: 1.0 + +documents: + root: + encodes: Root + +nodeMappings: + Root: + mapping: + something: + range: long \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.cycled.yaml new file mode 100644 index 00000000..21bd912c --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.cycled.yaml @@ -0,0 +1,2 @@ +#%Long-Datatype 1.0 +something: 294748364787978 diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.expanded.jsonld new file mode 100644 index 00000000..2d291a42 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.expanded.jsonld @@ -0,0 +1,119 @@ +[ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml", + "@type": [ + "http://a.ml/vocabularies/meta#DialectInstance", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#encodes": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml#/encodes", + "@type": [ + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/dialect.yaml#/declarations/Root", + "http://a.ml/vocabularies/meta#DialectDomainElement", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#something": [ + { + "@value": 294748364787978 + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml#/encodes/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml#/encodes/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml#/encodes" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml#/encodes/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/data#something" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document#root": [ + { + "@value": true + } + ], + "http://a.ml/vocabularies/document#processingData": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#DialectInstanceProcessingData" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#transformed": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/document#sourceSpec": [ + { + "@value": "Long-Datatype 1.0" + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,0)-(3,0)]" + } + ] + } + ] + } + ] + } +] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.flattened.jsonld new file mode 100644 index 00000000..b4cf6311 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.flattened.jsonld @@ -0,0 +1,98 @@ +{ + "@graph": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#DialectInstanceProcessingData" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#transformed": false, + "http://a.ml/vocabularies/document#sourceSpec": "Long-Datatype 1.0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml#/encodes", + "@type": [ + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/dialect.yaml#/declarations/Root", + "http://a.ml/vocabularies/meta#DialectDomainElement", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#something": 294748364787978, + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml#/encodes/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml#/encodes/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml#/encodes/source-map/lexical/element_1" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml#/encodes/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml#/encodes/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml#/encodes", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(3,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml#/encodes/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#something", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(3,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml", + "@type": [ + "http://a.ml/vocabularies/meta#DialectInstance", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#encodes": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml#/encodes" + }, + "http://a.ml/vocabularies/document#root": true, + "http://a.ml/vocabularies/document#processingData": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml/BaseUnitProcessingData" + }, + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml#/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(3,0)]" + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml new file mode 100644 index 00000000..21bd912c --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/long-datatype/instance.yaml @@ -0,0 +1,2 @@ +#%Long-Datatype 1.0 +something: 294748364787978 diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/native-links-with-native-target/instance.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/native-links-with-native-target/instance.expanded.jsonld index 710256c2..00ef039d 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/native-links-with-native-target/instance.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/native-links-with-native-target/instance.expanded.jsonld @@ -198,21 +198,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#custom-id": [ - { - "@id": "http://test.com/declarations/B1#/source-map/custom-id/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "http://test.com/declarations/B1" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "true" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "http://test.com/declarations/B1#/source-map/lexical/element_3", @@ -266,6 +251,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#custom-id": [ + { + "@id": "http://test.com/declarations/B1#/source-map/custom-id/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://test.com/declarations/B1" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } ] } ] diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/native-links-with-native-target/instance.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/native-links-with-native-target/instance.flattened.jsonld index 5bf4ec1f..99aa71c7 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/native-links-with-native-target/instance.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/native-links-with-native-target/instance.flattened.jsonld @@ -131,11 +131,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#custom-id": [ - { - "@id": "http://test.com/declarations/B1#/source-map/custom-id/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "http://test.com/declarations/B1#/source-map/lexical/element_3" @@ -149,6 +144,11 @@ { "@id": "http://test.com/declarations/B1#/source-map/lexical/element_2" } + ], + "http://a.ml/vocabularies/document-source-maps#custom-id": [ + { + "@id": "http://test.com/declarations/B1#/source-map/custom-id/element_0" + } ] }, { @@ -156,11 +156,6 @@ "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/native-links-with-native-target/instance.yaml", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(12,0)]" }, - { - "@id": "http://test.com/declarations/B1#/source-map/custom-id/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "http://test.com/declarations/B1", - "http://a.ml/vocabularies/document-source-maps#value": "true" - }, { "@id": "http://test.com/declarations/B1#/source-map/lexical/element_3", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#a", @@ -180,6 +175,11 @@ "@id": "http://test.com/declarations/B1#/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": "http://test.com/declarations/B1", "http://a.ml/vocabularies/document-source-maps#value": "[(3,2)-(7,0)]" + }, + { + "@id": "http://test.com/declarations/B1#/source-map/custom-id/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://test.com/declarations/B1", + "http://a.ml/vocabularies/document-source-maps#value": "true" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/native-links-with-template-ids/instance.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/native-links-with-template-ids/instance.expanded.jsonld index 14d09cec..c5fd4d3b 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/native-links-with-template-ids/instance.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/native-links-with-template-ids/instance.expanded.jsonld @@ -133,9 +133,9 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#custom-base": [ + "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://defined.by.me/embedOverwritten#/source-map/custom-base/element_0", + "@id": "http://defined.by.me/embedOverwritten#/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://defined.by.me/embedOverwritten" @@ -143,35 +143,35 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "http://defined.by.me/" + "@value": "[(14,0)-(16,0)]" } ] - } - ], - "http://a.ml/vocabularies/document-source-maps#lexical": [ + }, { - "@id": "http://defined.by.me/embedOverwritten#/source-map/lexical/element_1", + "@id": "http://defined.by.me/embedOverwritten#/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://defined.by.me/embedOverwritten" + "@value": "http://a.ml/vocabularies/data#id" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(14,0)-(16,0)]" + "@value": "[(14,4)-(15,0)]" } ] - }, + } + ], + "http://a.ml/vocabularies/document-source-maps#custom-base": [ { - "@id": "http://defined.by.me/embedOverwritten#/source-map/lexical/element_0", + "@id": "http://defined.by.me/embedOverwritten#/source-map/custom-base/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://a.ml/vocabularies/data#id" + "@value": "http://defined.by.me/embedOverwritten" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(14,4)-(15,0)]" + "@value": "http://defined.by.me/" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/native-links-with-template-ids/instance.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/native-links-with-template-ids/instance.flattened.jsonld index 0adc5de4..00931d29 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/instances/native-links-with-template-ids/instance.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/native-links-with-template-ids/instance.flattened.jsonld @@ -231,11 +231,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#custom-base": [ - { - "@id": "http://defined.by.me/embedOverwritten#/source-map/custom-base/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "http://defined.by.me/embedOverwritten#/source-map/lexical/element_1" @@ -243,6 +238,11 @@ { "@id": "http://defined.by.me/embedOverwritten#/source-map/lexical/element_0" } + ], + "http://a.ml/vocabularies/document-source-maps#custom-base": [ + { + "@id": "http://defined.by.me/embedOverwritten#/source-map/custom-base/element_0" + } ] }, { @@ -270,11 +270,6 @@ } ] }, - { - "@id": "http://defined.by.me/embedOverwritten#/source-map/custom-base/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "http://defined.by.me/embedOverwritten", - "http://a.ml/vocabularies/document-source-maps#value": "http://defined.by.me/" - }, { "@id": "http://defined.by.me/embedOverwritten#/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://defined.by.me/embedOverwritten", @@ -285,6 +280,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/data#id", "http://a.ml/vocabularies/document-source-maps#value": "[(14,4)-(15,0)]" }, + { + "@id": "http://defined.by.me/embedOverwritten#/source-map/custom-base/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://defined.by.me/embedOverwritten", + "http://a.ml/vocabularies/document-source-maps#value": "http://defined.by.me/" + }, { "@id": "http://test/simpleAlt#/source-map/custom-id/element_0", "http://a.ml/vocabularies/document-source-maps#element": "http://test/simpleAlt", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/dialect-union.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/dialect-union.yaml new file mode 100644 index 00000000..a02572c5 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/dialect-union.yaml @@ -0,0 +1,48 @@ +#%Dialect 1.0 +dialect: Rest Connector Descriptor +version: 1.0 +external: + aml: http://a.ml# +nodeMappings: + ConnectorDescriptor: + mapping: + triggers: + propertyTerm: aml.triggers + range: AllTrigger + mapTermKey: aml.name + + AllTrigger: + classTerm: aml.AllTrigger + union: + - Trigger + - NativeTrigger + + NativeTrigger: + classTerm: aml.NativeTrigger + mapping: + name: + propertyTerm: aml.name + range: string + mandatory: true + fqn: + propertyTerm: aml.fqn + range: string + mandatory: true + + Trigger: + classTerm: aml.Trigger + mapping: + name: + propertyTerm: aml.name + range: string + mandatory: true + base: + propertyTerm: aml.baseTrigger + range: string + path: + propertyTerm: aml.path + range: string + +documents: + root: + encodes: ConnectorDescriptor diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/dialect.yaml new file mode 100644 index 00000000..30925441 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/dialect.yaml @@ -0,0 +1,28 @@ +#%Dialect 1.0 +dialect: Rest Connector Descriptor +version: 1.0 +external: + aml: http://a.ml# +nodeMappings: + ConnectorDescriptor: + mapping: + triggers: + propertyTerm: aml.triggers + range: Trigger + mapTermKey: aml.name + Trigger: + classTerm: aml.Trigger + mapping: + name: + propertyTerm: aml.name + range: string + mandatory: true + base: + propertyTerm: aml.baseTrigger + range: string + path: + propertyTerm: aml.path + range: string +documents: + root: + encodes: ConnectorDescriptor diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.golden.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.golden.flattened.jsonld new file mode 100644 index 00000000..124f68e9 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.golden.flattened.jsonld @@ -0,0 +1,159 @@ +{ + "@graph": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#DialectInstanceProcessingData" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#transformed": false, + "http://a.ml/vocabularies/document#sourceSpec": "Rest Connector Descriptor 1.0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/encodes", + "@type": [ + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/dialect.yaml#/declarations/ConnectorDescriptor", + "http://a.ml/vocabularies/meta#DialectDomainElement", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml#triggers": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/encodes/triggers/triggersName" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/encodes/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/encodes/triggers/triggersName", + "@type": [ + "http://a.ml#Trigger", + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/dialect.yaml#/declarations/Trigger", + "http://a.ml/vocabularies/meta#DialectDomainElement", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml#name": "triggersName", + "http://a.ml#baseTrigger": "baseString", + "http://a.ml#path": "pathString", + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/encodes/triggers/triggersName/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/encodes/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/encodes/source-map/lexical/element_1" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/encodes/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/encodes/triggers/triggersName/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/encodes/triggers/triggersName/source-map/lexical/element_3" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/encodes/triggers/triggersName/source-map/lexical/element_1" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/encodes/triggers/triggersName/source-map/lexical/element_0" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/encodes/triggers/triggersName/source-map/lexical/element_2" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/encodes/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/encodes", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(6,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/encodes/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml#triggers", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(6,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/encodes/triggers/triggersName/source-map/lexical/element_3", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml#baseTrigger", + "http://a.ml/vocabularies/document-source-maps#value": "[(4,4)-(5,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/encodes/triggers/triggersName/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml#name", + "http://a.ml/vocabularies/document-source-maps#value": "[(3,2)-(3,14)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/encodes/triggers/triggersName/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml#path", + "http://a.ml/vocabularies/document-source-maps#value": "[(5,4)-(6,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/encodes/triggers/triggersName/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/encodes/triggers/triggersName", + "http://a.ml/vocabularies/document-source-maps#value": "[(3,15)-(6,0)]" + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml", + "@type": [ + "http://a.ml/vocabularies/meta#DialectInstance", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/meta#definedBy": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document#encodes": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/encodes" + }, + "http://a.ml/vocabularies/document#root": true, + "http://a.ml/vocabularies/document#processingData": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml/BaseUnitProcessingData" + }, + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/source-map" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml#/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(6,0)]" + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml new file mode 100644 index 00000000..6952a2de --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/rest-connector/instance.yaml @@ -0,0 +1,5 @@ +#%Rest Connector Descriptor 1.0 +triggers: + triggersName: + base: baseString + path: pathString diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/undefined-union-range-mapping.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/undefined-union-range-mapping.yaml new file mode 100644 index 00000000..2555a67e --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/undefined-union-range-mapping.yaml @@ -0,0 +1,2 @@ +#%Test 1.0 +unionProperty: diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/without-term-obj/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/without-term-obj/dialect.yaml new file mode 100644 index 00000000..774004cf --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/without-term-obj/dialect.yaml @@ -0,0 +1,17 @@ +#%Dialect 1.0 +dialect: amf-json-schema-generated-dialect +version: "1.0" +documents: + root: + encodes: A +nodeMappings: + A: + mapping: + a1: + range: B + mandatory: false + B: + mapping: + b1: + range: string + mandatory: false diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/without-term-obj/instance.golden.json b/amf-aml/shared/src/test/resources/vocabularies2/instances/without-term-obj/instance.golden.json new file mode 100644 index 00000000..4b5ff0f3 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/without-term-obj/instance.golden.json @@ -0,0 +1,5 @@ +{ + "a1": { + "b1": "something" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/without-term-obj/instance.json b/amf-aml/shared/src/test/resources/vocabularies2/instances/without-term-obj/instance.json new file mode 100644 index 00000000..0e606a1a --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/without-term-obj/instance.json @@ -0,0 +1,6 @@ +{ + "$dialect": "amf-json-schema-generated-dialect 1.0", + "a1": { + "b1": "something" + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/without-term-seq/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/instances/without-term-seq/dialect.yaml new file mode 100644 index 00000000..c6b0455a --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/without-term-seq/dialect.yaml @@ -0,0 +1,37 @@ +#%Dialect 1.0 +nodeMappings: + HeaderInjection: + mapping: + inboundHeaders: + range: SchemaNode + mandatory: false + allowMultiple: true + outboundHeaders: + range: SchemaNode_1 + mandatory: false + allowMultiple: true + SchemaNode: + mapping: + key: + range: string + mandatory: false + value: + range: string + mandatory: false + SchemaNode_1: + mapping: + key: + range: string + mandatory: false + value: + range: string + mandatory: false +external: + security: anypoint://vocabulary/policy.yaml# + config: anypoint://vocabulary/policy.yaml# + ns0: anypoint://vocabulary/policy.yaml# +dialect: amf-json-schema-generated-dialect +version: "1.0" +documents: + root: + encodes: HeaderInjection diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/without-term-seq/instance.golden.json b/amf-aml/shared/src/test/resources/vocabularies2/instances/without-term-seq/instance.golden.json new file mode 100644 index 00000000..793a8202 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/without-term-seq/instance.golden.json @@ -0,0 +1,8 @@ +{ + "inboundHeaders": [ + { + "key": "x-requests-id", + "value": "test" + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/instances/without-term-seq/instance.json b/amf-aml/shared/src/test/resources/vocabularies2/instances/without-term-seq/instance.json new file mode 100644 index 00000000..1ca57e34 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/instances/without-term-seq/instance.json @@ -0,0 +1,9 @@ +{ + "$dialect": "amf-json-schema-generated-dialect 1.0", + "inboundHeaders": [ + { + "key": "x-requests-id", + "value": "test" + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.expanded.jsonld index 470f764b..17a6ce1b 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.expanded.jsonld @@ -233,21 +233,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.yaml" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "\u4F7F\u7528\u3059\u308B->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.yaml#/source-map/lexical/element_3", @@ -301,6 +286,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "\u4F7F\u7528\u3059\u308B->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" + } + ] + } ] } ], @@ -424,6 +424,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/lexical/element_2", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.flattened.jsonld index b65d56fd..6454ea78 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.flattened.jsonld @@ -271,11 +271,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.yaml#/source-map/aliases-array/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.yaml#/source-map/lexical/element_3" @@ -289,6 +284,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.yaml#/source-map/lexical/element_2" } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.yaml#/source-map/aliases-array/element_0" + } ] }, { @@ -330,6 +330,11 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/lexical/element_2" @@ -417,11 +422,6 @@ } ] }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.yaml", - "http://a.ml/vocabularies/document-source-maps#value": "\u4F7F\u7528\u3059\u308B->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.yaml#/source-map/lexical/element_3", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#version", @@ -442,6 +442,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.yaml", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(23,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example1.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "\u4F7F\u7528\u3059\u308B->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" + }, { "@id": "http://a.ml/vocabularies/vocab2#\u30A8\u30A2\u30A6\u30A7\u30A4/source-map", "@type": [ @@ -464,6 +469,11 @@ } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#declares", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.expanded.jsonld index 330fca66..89ebf5c9 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.expanded.jsonld @@ -205,21 +205,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.yaml" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "\u4F7F\u7528\u3059\u308B->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.yaml#/source-map/lexical/element_3", @@ -273,6 +258,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "\u4F7F\u7528\u3059\u308B->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" + } + ] + } ] } ], @@ -396,6 +396,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/lexical/element_2", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.flattened.jsonld index c17f571b..20d42d9e 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.flattened.jsonld @@ -255,11 +255,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.yaml#/source-map/aliases-array/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.yaml#/source-map/lexical/element_3" @@ -273,6 +268,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.yaml#/source-map/lexical/element_2" } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.yaml#/source-map/aliases-array/element_0" + } ] }, { @@ -314,6 +314,11 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/lexical/element_2" @@ -401,11 +406,6 @@ } ] }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.yaml", - "http://a.ml/vocabularies/document-source-maps#value": "\u4F7F\u7528\u3059\u308B->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.yaml#/source-map/lexical/element_3", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#version", @@ -426,6 +426,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.yaml", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(23,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example2.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "\u4F7F\u7528\u3059\u308B->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" + }, { "@id": "http://a.ml/vocabularies/vocab2#\u30A8\u30A2\u30A6\u30A7\u30A4/source-map", "@type": [ @@ -448,6 +453,11 @@ } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#declares", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.expanded.jsonld index b8dedb01..337f52a2 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.expanded.jsonld @@ -281,21 +281,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.yaml" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "\u4F7F\u7528\u3059\u308B->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.yaml#/source-map/lexical/element_3", @@ -349,6 +334,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "\u4F7F\u7528\u3059\u308B->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" + } + ] + } ] } ], @@ -472,6 +472,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/lexical/element_2", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.flattened.jsonld index 73be1ee2..2197d385 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.flattened.jsonld @@ -311,11 +311,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.yaml#/source-map/aliases-array/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.yaml#/source-map/lexical/element_3" @@ -329,6 +324,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.yaml#/source-map/lexical/element_2" } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.yaml#/source-map/aliases-array/element_0" + } ] }, { @@ -370,6 +370,11 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/lexical/element_2" @@ -460,11 +465,6 @@ } ] }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.yaml", - "http://a.ml/vocabularies/document-source-maps#value": "\u4F7F\u7528\u3059\u308B->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.yaml#/source-map/lexical/element_3", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#version", @@ -485,6 +485,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.yaml", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(24,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example3.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "\u4F7F\u7528\u3059\u308B->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" + }, { "@id": "http://a.ml/vocabularies/vocab2#\u30A8\u30A2\u30A6\u30A7\u30A4/source-map", "@type": [ @@ -507,6 +512,11 @@ } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#declares", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example5.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example5.expanded.jsonld index 6dd2f8c3..11b30d1b 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example5.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example5.expanded.jsonld @@ -302,21 +302,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example5.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example5.yaml" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "\u4F7F2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example5.yaml#/source-map/lexical/element_4", @@ -383,6 +368,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example5.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example5.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "\u4F7F2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" + } + ] + } ] } ], @@ -506,6 +506,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/lexical/element_2", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example5.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example5.flattened.jsonld index d7a10538..badb32d6 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example5.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example5.flattened.jsonld @@ -323,11 +323,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example5.yaml#/source-map/aliases-array/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example5.yaml#/source-map/lexical/element_4" @@ -344,6 +339,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example5.yaml#/source-map/lexical/element_3" } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example5.yaml#/source-map/aliases-array/element_0" + } ] }, { @@ -385,6 +385,11 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/lexical/element_2" @@ -475,11 +480,6 @@ } ] }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example5.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example5.yaml", - "http://a.ml/vocabularies/document-source-maps#value": "\u4F7F2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example5.yaml#/source-map/lexical/element_4", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#externals", @@ -505,6 +505,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(3,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example5.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example5.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "\u4F7F2->http://a.ml/vocabularies/vocab2#::http://a.ml/vocabularies/vocab2#::vocab2.yaml" + }, { "@id": "http://a.ml/vocabularies/vocab2#\u30A8\u30A2\u30A6\u30A7\u30A4/source-map", "@type": [ @@ -527,6 +532,11 @@ } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#declares", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/vocab2.yaml#/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.expanded.jsonld index d1a99579..cd0112de 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.expanded.jsonld @@ -152,21 +152,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.yaml" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "\u56F3\u66F8\u9928->file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml::mappings_lib.yaml" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.yaml#/source-map/lexical/element_3", @@ -220,6 +205,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "\u56F3\u66F8\u9928->file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml::mappings_lib.yaml" + } + ] + } ] } ], @@ -474,6 +474,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml#/source-map/lexical/element_0", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.flattened.jsonld index 7696fe24..51285f1c 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.flattened.jsonld @@ -155,11 +155,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.yaml#/source-map/aliases-array/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.yaml#/source-map/lexical/element_3" @@ -173,6 +168,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.yaml#/source-map/lexical/element_2" } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.yaml#/source-map/aliases-array/element_0" + } ] }, { @@ -227,17 +227,17 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml#/source-map/lexical/element_0" } ] }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.yaml", - "http://a.ml/vocabularies/document-source-maps#value": "\u56F3\u66F8\u9928->file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml::mappings_lib.yaml" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.yaml#/source-map/lexical/element_3", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#version", @@ -258,6 +258,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.yaml", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(9,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example6.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "\u56F3\u66F8\u9928->file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml::mappings_lib.yaml" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml/externals/v2#/source-map", "@type": [ @@ -310,6 +315,11 @@ } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#declares", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml#/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.expanded.jsonld index 4ade6453..5f41b3f0 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.expanded.jsonld @@ -152,21 +152,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.yaml" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "\u56F3\u66F8\u9928->file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml::mappings_lib.yaml" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.yaml#/source-map/lexical/element_3", @@ -220,6 +205,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "\u56F3\u66F8\u9928->file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml::mappings_lib.yaml" + } + ] + } ] } ], @@ -474,6 +474,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml#/source-map/lexical/element_0", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.flattened.jsonld index 1d8f77ee..c538788a 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.flattened.jsonld @@ -228,11 +228,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.yaml#/source-map/aliases-array/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.yaml#/source-map/lexical/element_3" @@ -246,6 +241,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.yaml#/source-map/lexical/element_2" } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.yaml#/source-map/aliases-array/element_0" + } ] }, { @@ -300,6 +300,11 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml#/source-map/lexical/element_0" @@ -393,11 +398,6 @@ } ] }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.yaml", - "http://a.ml/vocabularies/document-source-maps#value": "\u56F3\u66F8\u9928->file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml::mappings_lib.yaml" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.yaml#/source-map/lexical/element_3", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#version", @@ -418,6 +418,11 @@ "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.yaml", "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(18,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/example7.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "\u56F3\u66F8\u9928->file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml::file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml::mappings_lib.yaml" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml/externals/v2#/source-map", "@type": [ @@ -470,6 +475,11 @@ } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#declares", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml#/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/mappings_lib.yaml", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/jsonldcycle/any-seq/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/jsonldcycle/any-seq/dialect.yaml new file mode 100644 index 00000000..235366f4 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/jsonldcycle/any-seq/dialect.yaml @@ -0,0 +1,21 @@ +#%Dialect 1.0 + +dialect: AnySeq +version: 1.0 + +external: + schema: https://schema.org/ + +documents: + root: + encodes: RootNode + +nodeMappings: + RootNode: + classTerm: schema.Root + + mapping: + in: + propertyTerm: schema.in + allowMultiple: true + range: any diff --git a/amf-aml/shared/src/test/resources/vocabularies2/jsonldcycle/any-seq/instance.yaml b/amf-aml/shared/src/test/resources/vocabularies2/jsonldcycle/any-seq/instance.yaml new file mode 100644 index 00000000..400421ac --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/jsonldcycle/any-seq/instance.yaml @@ -0,0 +1,5 @@ +#%AnySeq 1.0 + +in: + - 1 + - "2" \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/jsonldcycle/any-seq/instance.yaml.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/jsonldcycle/any-seq/instance.yaml.jsonld new file mode 100644 index 00000000..8dcccb16 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/jsonldcycle/any-seq/instance.yaml.jsonld @@ -0,0 +1,55 @@ +{ +"@graph": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/jsonldcycle/any-seq/instance.yaml/BaseUnitProcessingData", +"@type": [ +"http://a.ml/vocabularies/document#DialectInstanceProcessingData" +], +"http://a.ml/vocabularies/meta#definedBy": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/jsonldcycle/any-seq/dialect.yaml" +} +], +"http://a.ml/vocabularies/document#transformed": false, +"http://a.ml/vocabularies/document#sourceSpec": "AnySeq 1.0" +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/jsonldcycle/any-seq/instance.yaml#/encodes", +"@type": [ +"https://schema.org/Root", +"file://amf-aml/shared/src/test/resources/vocabularies2/jsonldcycle/any-seq/dialect.yaml#/declarations/RootNode", +"http://a.ml/vocabularies/meta#DialectDomainElement", +"http://a.ml/vocabularies/document#DomainElement" +], +"https://schema.org/in": [ +{ +"@value": "1", +"@type": "http://www.w3.org/2001/XMLSchema#integer" +}, +"2" +] +}, +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/jsonldcycle/any-seq/instance.yaml", +"@type": [ +"http://a.ml/vocabularies/meta#DialectInstance", +"http://a.ml/vocabularies/document#Document", +"http://a.ml/vocabularies/document#Fragment", +"http://a.ml/vocabularies/document#Module", +"http://a.ml/vocabularies/document#Unit" +], +"http://a.ml/vocabularies/meta#definedBy": [ +{ +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/jsonldcycle/any-seq/dialect.yaml" +} +], +"http://a.ml/vocabularies/document#encodes": { +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/jsonldcycle/any-seq/instance.yaml#/encodes" +}, +"http://a.ml/vocabularies/document#root": true, +"http://a.ml/vocabularies/document#processingData": { +"@id": "file://amf-aml/shared/src/test/resources/vocabularies2/jsonldcycle/any-seq/instance.yaml/BaseUnitProcessingData" +} +} +] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-dialect.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-dialect.expanded.jsonld index 19ac306a..1b888b45 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-dialect.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-dialect.expanded.jsonld @@ -539,21 +539,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-dialect.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-dialect.yaml" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "about->http://mulesoft.com/vocabularies/about#::http://mulesoft.com/vocabularies/about#::ABOUT-vocabulary.yaml" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-dialect.yaml#/source-map/lexical/element_4", @@ -620,6 +605,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-dialect.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-dialect.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "about->http://mulesoft.com/vocabularies/about#::http://mulesoft.com/vocabularies/about#::ABOUT-vocabulary.yaml" + } + ] + } ] } ], @@ -691,7 +691,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://mulesoft.com/vocabularies/about#ContinuousIntegration/source-map/lexical/element_0", + "@id": "http://mulesoft.com/vocabularies/about#ContinuousIntegration/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#ContinuousIntegration" @@ -702,6 +702,19 @@ "@value": "[(50,2)-(55,0)]" } ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#ContinuousIntegration/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(53,4)-(55,0)]" + } + ] } ] } @@ -749,15 +762,15 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://mulesoft.com/vocabularies/about#License/source-map/lexical/element_1", + "@id": "http://mulesoft.com/vocabularies/about#License/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://mulesoft.com/vocabularies/about#License" + "@value": "http://a.ml/vocabularies/meta#properties" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(60,2)-(68,0)]" + "@value": "[(64,4)-(68,0)]" } ] }, @@ -765,12 +778,25 @@ "@id": "http://mulesoft.com/vocabularies/about#License/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://a.ml/vocabularies/meta#properties" + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(64,4)-(68,0)]" + "@value": "[(63,4)-(64,0)]" + } + ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#License/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://mulesoft.com/vocabularies/about#License" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(60,2)-(68,0)]" } ] } @@ -886,15 +912,15 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://mulesoft.com/vocabularies/about#Contributor/source-map/lexical/element_1", + "@id": "http://mulesoft.com/vocabularies/about#Contributor/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://mulesoft.com/vocabularies/about#Contributor" + "@value": "http://a.ml/vocabularies/meta#properties" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(68,2)-(75,0)]" + "@value": "[(72,4)-(75,0)]" } ] }, @@ -902,12 +928,25 @@ "@id": "http://mulesoft.com/vocabularies/about#Contributor/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://a.ml/vocabularies/meta#properties" + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(72,4)-(75,0)]" + "@value": "[(71,4)-(72,0)]" + } + ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#Contributor/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://mulesoft.com/vocabularies/about#Contributor" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(68,2)-(75,0)]" } ] } @@ -949,7 +988,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://mulesoft.com/vocabularies/about#ProjectManagement/source-map/lexical/element_0", + "@id": "http://mulesoft.com/vocabularies/about#ProjectManagement/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#ProjectManagement" @@ -960,6 +999,19 @@ "@value": "[(55,2)-(60,0)]" } ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#ProjectManagement/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(58,4)-(60,0)]" + } + ] } ] } @@ -1103,7 +1155,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://mulesoft.com/vocabularies/about#serviceType/source-map/lexical/element_0", + "@id": "http://mulesoft.com/vocabularies/about#serviceType/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#serviceType" @@ -1114,6 +1166,19 @@ "@value": "[(102,2)-(107,0)]" } ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#serviceType/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(105,4)-(107,0)]" + } + ] } ] } @@ -1153,8 +1218,34 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#serviceSystemUrl/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(116,4)-(117,0)]" + } + ] + }, { "@id": "http://mulesoft.com/vocabularies/about#serviceSystemUrl/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(117,4)-(119,0)]" + } + ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#serviceSystemUrl/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#serviceSystemUrl" @@ -1204,8 +1295,34 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#contributor/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(207,4)-(208,0)]" + } + ] + }, { "@id": "http://mulesoft.com/vocabularies/about#contributor/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(208,4)-(208,30)]" + } + ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#contributor/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#contributor" @@ -1255,8 +1372,34 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#licenseType/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(128,4)-(129,0)]" + } + ] + }, { "@id": "http://mulesoft.com/vocabularies/about#licenseType/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(129,4)-(133,0)]" + } + ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#licenseType/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#licenseType" @@ -1343,7 +1486,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://mulesoft.com/vocabularies/about#hasPart/source-map/lexical/element_0", + "@id": "http://mulesoft.com/vocabularies/about#hasPart/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#hasPart" @@ -1354,6 +1497,19 @@ "@value": "[(161,2)-(166,0)]" } ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#hasPart/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(164,4)-(166,0)]" + } + ] } ] } @@ -1393,8 +1549,34 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#licenseName/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(122,4)-(123,0)]" + } + ] + }, { "@id": "http://mulesoft.com/vocabularies/about#licenseName/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(123,4)-(125,0)]" + } + ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#licenseName/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#licenseName" @@ -1444,8 +1626,34 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#role/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(153,4)-(154,0)]" + } + ] + }, { "@id": "http://mulesoft.com/vocabularies/about#role/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(154,4)-(156,0)]" + } + ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#role/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#role" @@ -1495,8 +1703,34 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#continuousIntegration/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(189,4)-(190,0)]" + } + ] + }, { "@id": "http://mulesoft.com/vocabularies/about#continuousIntegration/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(190,4)-(192,0)]" + } + ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#continuousIntegration/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#continuousIntegration" @@ -1546,8 +1780,34 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#serviceName/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(99,4)-(100,0)]" + } + ] + }, { "@id": "http://mulesoft.com/vocabularies/about#serviceName/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(100,4)-(102,0)]" + } + ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#serviceName/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#serviceName" @@ -1597,8 +1857,34 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#discussionChannelName/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(82,4)-(83,0)]" + } + ] + }, { "@id": "http://mulesoft.com/vocabularies/about#discussionChannelName/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(83,4)-(85,0)]" + } + ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#discussionChannelName/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#discussionChannelName" @@ -1644,7 +1930,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://mulesoft.com/vocabularies/about#discussionChannelType/source-map/lexical/element_0", + "@id": "http://mulesoft.com/vocabularies/about#discussionChannelType/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#discussionChannelType" @@ -1655,6 +1941,19 @@ "@value": "[(85,2)-(90,0)]" } ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#discussionChannelType/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(88,4)-(90,0)]" + } + ] } ] } @@ -1694,8 +1993,34 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#projectManagementTool/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(195,4)-(196,0)]" + } + ] + }, { "@id": "http://mulesoft.com/vocabularies/about#projectManagementTool/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(196,4)-(198,0)]" + } + ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#projectManagementTool/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#projectManagementTool" @@ -1741,7 +2066,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://mulesoft.com/vocabularies/about#sameAs/source-map/lexical/element_0", + "@id": "http://mulesoft.com/vocabularies/about#sameAs/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#sameAs" @@ -1752,6 +2077,19 @@ "@value": "[(166,2)-(171,0)]" } ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#sameAs/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(169,4)-(171,0)]" + } + ] } ] } @@ -1791,8 +2129,34 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#keyword/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(142,4)-(144,0)]" + } + ] + }, { "@id": "http://mulesoft.com/vocabularies/about#keyword/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(141,4)-(142,0)]" + } + ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#keyword/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#keyword" @@ -1842,8 +2206,34 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#license/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(201,4)-(202,0)]" + } + ] + }, { "@id": "http://mulesoft.com/vocabularies/about#license/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(202,4)-(204,0)]" + } + ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#license/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#license" @@ -1893,8 +2283,34 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#serviceUrl/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(110,4)-(111,0)]" + } + ] + }, { "@id": "http://mulesoft.com/vocabularies/about#serviceUrl/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(111,4)-(113,0)]" + } + ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#serviceUrl/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#serviceUrl" @@ -1944,8 +2360,34 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#homepage/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(148,4)-(150,0)]" + } + ] + }, { "@id": "http://mulesoft.com/vocabularies/about#homepage/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(147,4)-(148,0)]" + } + ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#homepage/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#homepage" @@ -1991,7 +2433,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://mulesoft.com/vocabularies/about#partOf/source-map/lexical/element_0", + "@id": "http://mulesoft.com/vocabularies/about#partOf/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#partOf" @@ -2002,6 +2444,19 @@ "@value": "[(156,2)-(161,0)]" } ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#partOf/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(159,4)-(161,0)]" + } + ] } ] } @@ -2037,7 +2492,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://mulesoft.com/vocabularies/about#developmentStatus/source-map/lexical/element_0", + "@id": "http://mulesoft.com/vocabularies/about#developmentStatus/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#developmentStatus" @@ -2048,6 +2503,19 @@ "@value": "[(133,2)-(138,0)]" } ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#developmentStatus/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(136,4)-(138,0)]" + } + ] } ] } @@ -2083,7 +2551,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://mulesoft.com/vocabularies/about#forkedFrom/source-map/lexical/element_0", + "@id": "http://mulesoft.com/vocabularies/about#forkedFrom/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#forkedFrom" @@ -2094,6 +2562,19 @@ "@value": "[(171,2)-(176,0)]" } ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#forkedFrom/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(174,4)-(176,0)]" + } + ] } ] } @@ -2133,8 +2614,34 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#discussionChannel/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(183,4)-(184,0)]" + } + ] + }, { "@id": "http://mulesoft.com/vocabularies/about#discussionChannel/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(184,4)-(186,0)]" + } + ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#discussionChannel/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#discussionChannel" @@ -2184,8 +2691,34 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#discussionChannelUrl/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(93,4)-(94,0)]" + } + ] + }, { "@id": "http://mulesoft.com/vocabularies/about#discussionChannelUrl/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(94,4)-(96,0)]" + } + ] + }, + { + "@id": "http://mulesoft.com/vocabularies/about#discussionChannelUrl/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/about#discussionChannelUrl" @@ -2247,6 +2780,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-vocabulary.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-vocabulary.yaml#/source-map/lexical/element_3", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-dialect.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-dialect.flattened.jsonld index 3d9623fb..6dd910be 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-dialect.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-dialect.flattened.jsonld @@ -814,11 +814,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-dialect.yaml#/source-map/aliases-array/element_0" - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-dialect.yaml#/source-map/lexical/element_4" @@ -835,6 +830,11 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-dialect.yaml#/source-map/lexical/element_3" } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-dialect.yaml#/source-map/aliases-array/element_0" + } ] }, { @@ -1544,6 +1544,11 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-vocabulary.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-vocabulary.yaml#/source-map/lexical/element_3" @@ -2596,11 +2601,6 @@ } ] }, - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-dialect.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-dialect.yaml", - "http://a.ml/vocabularies/document-source-maps#value": "about->http://mulesoft.com/vocabularies/about#::http://mulesoft.com/vocabularies/about#::ABOUT-vocabulary.yaml" - }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-dialect.yaml#/source-map/lexical/element_4", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#externals", @@ -2626,12 +2626,20 @@ "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#name", "http://a.ml/vocabularies/document-source-maps#value": "[(4,0)-(6,0)]" }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-dialect.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-dialect.yaml", + "http://a.ml/vocabularies/document-source-maps#value": "about->http://mulesoft.com/vocabularies/about#::http://mulesoft.com/vocabularies/about#::ABOUT-vocabulary.yaml" + }, { "@id": "http://mulesoft.com/vocabularies/about#ContinuousIntegration/source-map", "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#ContinuousIntegration/source-map/lexical/element_1" + }, { "@id": "http://mulesoft.com/vocabularies/about#ContinuousIntegration/source-map/lexical/element_0" } @@ -2644,10 +2652,13 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://mulesoft.com/vocabularies/about#License/source-map/lexical/element_1" + "@id": "http://mulesoft.com/vocabularies/about#License/source-map/lexical/element_2" }, { "@id": "http://mulesoft.com/vocabularies/about#License/source-map/lexical/element_0" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#License/source-map/lexical/element_1" } ] }, @@ -2672,10 +2683,13 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://mulesoft.com/vocabularies/about#Contributor/source-map/lexical/element_1" + "@id": "http://mulesoft.com/vocabularies/about#Contributor/source-map/lexical/element_2" }, { "@id": "http://mulesoft.com/vocabularies/about#Contributor/source-map/lexical/element_0" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#Contributor/source-map/lexical/element_1" } ] }, @@ -2685,6 +2699,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#ProjectManagement/source-map/lexical/element_1" + }, { "@id": "http://mulesoft.com/vocabularies/about#ProjectManagement/source-map/lexical/element_0" } @@ -2721,6 +2738,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#serviceType/source-map/lexical/element_1" + }, { "@id": "http://mulesoft.com/vocabularies/about#serviceType/source-map/lexical/element_0" } @@ -2732,8 +2752,14 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#serviceSystemUrl/source-map/lexical/element_2" + }, { "@id": "http://mulesoft.com/vocabularies/about#serviceSystemUrl/source-map/lexical/element_0" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#serviceSystemUrl/source-map/lexical/element_1" } ] }, @@ -2743,8 +2769,14 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#contributor/source-map/lexical/element_2" + }, { "@id": "http://mulesoft.com/vocabularies/about#contributor/source-map/lexical/element_0" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#contributor/source-map/lexical/element_1" } ] }, @@ -2754,8 +2786,14 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#licenseType/source-map/lexical/element_2" + }, { "@id": "http://mulesoft.com/vocabularies/about#licenseType/source-map/lexical/element_0" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#licenseType/source-map/lexical/element_1" } ] }, @@ -2776,6 +2814,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#hasPart/source-map/lexical/element_1" + }, { "@id": "http://mulesoft.com/vocabularies/about#hasPart/source-map/lexical/element_0" } @@ -2787,8 +2828,14 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#licenseName/source-map/lexical/element_2" + }, { "@id": "http://mulesoft.com/vocabularies/about#licenseName/source-map/lexical/element_0" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#licenseName/source-map/lexical/element_1" } ] }, @@ -2798,8 +2845,14 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#role/source-map/lexical/element_2" + }, { "@id": "http://mulesoft.com/vocabularies/about#role/source-map/lexical/element_0" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#role/source-map/lexical/element_1" } ] }, @@ -2809,8 +2862,14 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#continuousIntegration/source-map/lexical/element_2" + }, { "@id": "http://mulesoft.com/vocabularies/about#continuousIntegration/source-map/lexical/element_0" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#continuousIntegration/source-map/lexical/element_1" } ] }, @@ -2820,8 +2879,14 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#serviceName/source-map/lexical/element_2" + }, { "@id": "http://mulesoft.com/vocabularies/about#serviceName/source-map/lexical/element_0" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#serviceName/source-map/lexical/element_1" } ] }, @@ -2831,8 +2896,14 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#discussionChannelName/source-map/lexical/element_2" + }, { "@id": "http://mulesoft.com/vocabularies/about#discussionChannelName/source-map/lexical/element_0" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#discussionChannelName/source-map/lexical/element_1" } ] }, @@ -2842,6 +2913,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#discussionChannelType/source-map/lexical/element_1" + }, { "@id": "http://mulesoft.com/vocabularies/about#discussionChannelType/source-map/lexical/element_0" } @@ -2853,8 +2927,14 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#projectManagementTool/source-map/lexical/element_2" + }, { "@id": "http://mulesoft.com/vocabularies/about#projectManagementTool/source-map/lexical/element_0" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#projectManagementTool/source-map/lexical/element_1" } ] }, @@ -2864,6 +2944,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#sameAs/source-map/lexical/element_1" + }, { "@id": "http://mulesoft.com/vocabularies/about#sameAs/source-map/lexical/element_0" } @@ -2875,8 +2958,14 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#keyword/source-map/lexical/element_2" + }, { "@id": "http://mulesoft.com/vocabularies/about#keyword/source-map/lexical/element_0" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#keyword/source-map/lexical/element_1" } ] }, @@ -2886,8 +2975,14 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#license/source-map/lexical/element_2" + }, { "@id": "http://mulesoft.com/vocabularies/about#license/source-map/lexical/element_0" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#license/source-map/lexical/element_1" } ] }, @@ -2897,8 +2992,14 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#serviceUrl/source-map/lexical/element_2" + }, { "@id": "http://mulesoft.com/vocabularies/about#serviceUrl/source-map/lexical/element_0" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#serviceUrl/source-map/lexical/element_1" } ] }, @@ -2908,8 +3009,14 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#homepage/source-map/lexical/element_2" + }, { "@id": "http://mulesoft.com/vocabularies/about#homepage/source-map/lexical/element_0" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#homepage/source-map/lexical/element_1" } ] }, @@ -2919,6 +3026,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#partOf/source-map/lexical/element_1" + }, { "@id": "http://mulesoft.com/vocabularies/about#partOf/source-map/lexical/element_0" } @@ -2930,6 +3040,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#developmentStatus/source-map/lexical/element_1" + }, { "@id": "http://mulesoft.com/vocabularies/about#developmentStatus/source-map/lexical/element_0" } @@ -2941,6 +3054,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#forkedFrom/source-map/lexical/element_1" + }, { "@id": "http://mulesoft.com/vocabularies/about#forkedFrom/source-map/lexical/element_0" } @@ -2952,8 +3068,14 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#discussionChannel/source-map/lexical/element_2" + }, { "@id": "http://mulesoft.com/vocabularies/about#discussionChannel/source-map/lexical/element_0" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#discussionChannel/source-map/lexical/element_1" } ] }, @@ -2963,11 +3085,22 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://mulesoft.com/vocabularies/about#discussionChannelUrl/source-map/lexical/element_2" + }, { "@id": "http://mulesoft.com/vocabularies/about#discussionChannelUrl/source-map/lexical/element_0" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#discussionChannelUrl/source-map/lexical/element_1" } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-vocabulary.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#declares", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/ABOUT/ABOUT-vocabulary.yaml#/source-map/lexical/element_3", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#base", @@ -4038,20 +4171,30 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(190,2)-(202,0)]" }, { - "@id": "http://mulesoft.com/vocabularies/about#ContinuousIntegration/source-map/lexical/element_0", + "@id": "http://mulesoft.com/vocabularies/about#ContinuousIntegration/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#ContinuousIntegration", "http://a.ml/vocabularies/document-source-maps#value": "[(50,2)-(55,0)]" }, { - "@id": "http://mulesoft.com/vocabularies/about#License/source-map/lexical/element_1", - "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#License", - "http://a.ml/vocabularies/document-source-maps#value": "[(60,2)-(68,0)]" + "@id": "http://mulesoft.com/vocabularies/about#ContinuousIntegration/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subClassOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(53,4)-(55,0)]" }, { - "@id": "http://mulesoft.com/vocabularies/about#License/source-map/lexical/element_0", + "@id": "http://mulesoft.com/vocabularies/about#License/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#properties", "http://a.ml/vocabularies/document-source-maps#value": "[(64,4)-(68,0)]" }, + { + "@id": "http://mulesoft.com/vocabularies/about#License/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subClassOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(63,4)-(64,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#License/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#License", + "http://a.ml/vocabularies/document-source-maps#value": "[(60,2)-(68,0)]" + }, { "@id": "http://mulesoft.com/vocabularies/about#DiscussionChannel/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#DiscussionChannel", @@ -4062,20 +4205,30 @@ "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#properties", "http://a.ml/vocabularies/document-source-maps#value": "[(37,4)-(42,0)]" }, + { + "@id": "http://mulesoft.com/vocabularies/about#Contributor/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#properties", + "http://a.ml/vocabularies/document-source-maps#value": "[(72,4)-(75,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#Contributor/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subClassOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(71,4)-(72,0)]" + }, { "@id": "http://mulesoft.com/vocabularies/about#Contributor/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#Contributor", "http://a.ml/vocabularies/document-source-maps#value": "[(68,2)-(75,0)]" }, { - "@id": "http://mulesoft.com/vocabularies/about#Contributor/source-map/lexical/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/meta#properties", - "http://a.ml/vocabularies/document-source-maps#value": "[(72,4)-(75,0)]" + "@id": "http://mulesoft.com/vocabularies/about#ProjectManagement/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#ProjectManagement", + "http://a.ml/vocabularies/document-source-maps#value": "[(55,2)-(60,0)]" }, { "@id": "http://mulesoft.com/vocabularies/about#ProjectManagement/source-map/lexical/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#ProjectManagement", - "http://a.ml/vocabularies/document-source-maps#value": "[(55,2)-(60,0)]" + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subClassOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(58,4)-(60,0)]" }, { "@id": "http://mulesoft.com/vocabularies/about#Service/source-map/lexical/element_0", @@ -4093,22 +4246,57 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(21,4)-(34,0)]" }, { - "@id": "http://mulesoft.com/vocabularies/about#serviceType/source-map/lexical/element_0", + "@id": "http://mulesoft.com/vocabularies/about#serviceType/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#serviceType", "http://a.ml/vocabularies/document-source-maps#value": "[(102,2)-(107,0)]" }, + { + "@id": "http://mulesoft.com/vocabularies/about#serviceType/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(105,4)-(107,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#serviceSystemUrl/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(116,4)-(117,0)]" + }, { "@id": "http://mulesoft.com/vocabularies/about#serviceSystemUrl/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(117,4)-(119,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#serviceSystemUrl/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#serviceSystemUrl", "http://a.ml/vocabularies/document-source-maps#value": "[(113,2)-(119,0)]" }, + { + "@id": "http://mulesoft.com/vocabularies/about#contributor/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(207,4)-(208,0)]" + }, { "@id": "http://mulesoft.com/vocabularies/about#contributor/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(208,4)-(208,30)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#contributor/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#contributor", "http://a.ml/vocabularies/document-source-maps#value": "[(204,2)-(208,30)]" }, + { + "@id": "http://mulesoft.com/vocabularies/about#licenseType/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(128,4)-(129,0)]" + }, { "@id": "http://mulesoft.com/vocabularies/about#licenseType/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(129,4)-(133,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#licenseType/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#licenseType", "http://a.ml/vocabularies/document-source-maps#value": "[(125,2)-(133,0)]" }, @@ -4118,92 +4306,242 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(176,2)-(180,0)]" }, { - "@id": "http://mulesoft.com/vocabularies/about#hasPart/source-map/lexical/element_0", + "@id": "http://mulesoft.com/vocabularies/about#hasPart/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#hasPart", "http://a.ml/vocabularies/document-source-maps#value": "[(161,2)-(166,0)]" }, + { + "@id": "http://mulesoft.com/vocabularies/about#hasPart/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(164,4)-(166,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#licenseName/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(122,4)-(123,0)]" + }, { "@id": "http://mulesoft.com/vocabularies/about#licenseName/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(123,4)-(125,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#licenseName/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#licenseName", "http://a.ml/vocabularies/document-source-maps#value": "[(119,2)-(125,0)]" }, + { + "@id": "http://mulesoft.com/vocabularies/about#role/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(153,4)-(154,0)]" + }, { "@id": "http://mulesoft.com/vocabularies/about#role/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(154,4)-(156,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#role/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#role", "http://a.ml/vocabularies/document-source-maps#value": "[(150,2)-(156,0)]" }, + { + "@id": "http://mulesoft.com/vocabularies/about#continuousIntegration/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(189,4)-(190,0)]" + }, { "@id": "http://mulesoft.com/vocabularies/about#continuousIntegration/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(190,4)-(192,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#continuousIntegration/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#continuousIntegration", "http://a.ml/vocabularies/document-source-maps#value": "[(186,2)-(192,0)]" }, + { + "@id": "http://mulesoft.com/vocabularies/about#serviceName/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(99,4)-(100,0)]" + }, { "@id": "http://mulesoft.com/vocabularies/about#serviceName/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(100,4)-(102,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#serviceName/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#serviceName", "http://a.ml/vocabularies/document-source-maps#value": "[(96,2)-(102,0)]" }, + { + "@id": "http://mulesoft.com/vocabularies/about#discussionChannelName/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(82,4)-(83,0)]" + }, { "@id": "http://mulesoft.com/vocabularies/about#discussionChannelName/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(83,4)-(85,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#discussionChannelName/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#discussionChannelName", "http://a.ml/vocabularies/document-source-maps#value": "[(79,2)-(85,0)]" }, { - "@id": "http://mulesoft.com/vocabularies/about#discussionChannelType/source-map/lexical/element_0", + "@id": "http://mulesoft.com/vocabularies/about#discussionChannelType/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#discussionChannelType", "http://a.ml/vocabularies/document-source-maps#value": "[(85,2)-(90,0)]" }, + { + "@id": "http://mulesoft.com/vocabularies/about#discussionChannelType/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(88,4)-(90,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#projectManagementTool/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(195,4)-(196,0)]" + }, { "@id": "http://mulesoft.com/vocabularies/about#projectManagementTool/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(196,4)-(198,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#projectManagementTool/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#projectManagementTool", "http://a.ml/vocabularies/document-source-maps#value": "[(192,2)-(198,0)]" }, { - "@id": "http://mulesoft.com/vocabularies/about#sameAs/source-map/lexical/element_0", + "@id": "http://mulesoft.com/vocabularies/about#sameAs/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#sameAs", "http://a.ml/vocabularies/document-source-maps#value": "[(166,2)-(171,0)]" }, + { + "@id": "http://mulesoft.com/vocabularies/about#sameAs/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(169,4)-(171,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#keyword/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(142,4)-(144,0)]" + }, { "@id": "http://mulesoft.com/vocabularies/about#keyword/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(141,4)-(142,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#keyword/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#keyword", "http://a.ml/vocabularies/document-source-maps#value": "[(138,2)-(144,0)]" }, + { + "@id": "http://mulesoft.com/vocabularies/about#license/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(201,4)-(202,0)]" + }, { "@id": "http://mulesoft.com/vocabularies/about#license/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(202,4)-(204,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#license/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#license", "http://a.ml/vocabularies/document-source-maps#value": "[(198,2)-(204,0)]" }, + { + "@id": "http://mulesoft.com/vocabularies/about#serviceUrl/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(110,4)-(111,0)]" + }, { "@id": "http://mulesoft.com/vocabularies/about#serviceUrl/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(111,4)-(113,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#serviceUrl/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#serviceUrl", "http://a.ml/vocabularies/document-source-maps#value": "[(107,2)-(113,0)]" }, + { + "@id": "http://mulesoft.com/vocabularies/about#homepage/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(148,4)-(150,0)]" + }, { "@id": "http://mulesoft.com/vocabularies/about#homepage/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(147,4)-(148,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#homepage/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#homepage", "http://a.ml/vocabularies/document-source-maps#value": "[(144,2)-(150,0)]" }, { - "@id": "http://mulesoft.com/vocabularies/about#partOf/source-map/lexical/element_0", + "@id": "http://mulesoft.com/vocabularies/about#partOf/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#partOf", "http://a.ml/vocabularies/document-source-maps#value": "[(156,2)-(161,0)]" }, { - "@id": "http://mulesoft.com/vocabularies/about#developmentStatus/source-map/lexical/element_0", + "@id": "http://mulesoft.com/vocabularies/about#partOf/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(159,4)-(161,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#developmentStatus/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#developmentStatus", "http://a.ml/vocabularies/document-source-maps#value": "[(133,2)-(138,0)]" }, { - "@id": "http://mulesoft.com/vocabularies/about#forkedFrom/source-map/lexical/element_0", + "@id": "http://mulesoft.com/vocabularies/about#developmentStatus/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(136,4)-(138,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#forkedFrom/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#forkedFrom", "http://a.ml/vocabularies/document-source-maps#value": "[(171,2)-(176,0)]" }, + { + "@id": "http://mulesoft.com/vocabularies/about#forkedFrom/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(174,4)-(176,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#discussionChannel/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(183,4)-(184,0)]" + }, { "@id": "http://mulesoft.com/vocabularies/about#discussionChannel/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(184,4)-(186,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#discussionChannel/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#discussionChannel", "http://a.ml/vocabularies/document-source-maps#value": "[(180,2)-(186,0)]" }, + { + "@id": "http://mulesoft.com/vocabularies/about#discussionChannelUrl/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(93,4)-(94,0)]" + }, { "@id": "http://mulesoft.com/vocabularies/about#discussionChannelUrl/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(94,4)-(96,0)]" + }, + { + "@id": "http://mulesoft.com/vocabularies/about#discussionChannelUrl/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://mulesoft.com/vocabularies/about#discussionChannelUrl", "http://a.ml/vocabularies/document-source-maps#value": "[(90,2)-(96,0)]" }, diff --git a/amf-aml/shared/src/test/resources/vocabularies2/production/Instagram/dialect.json b/amf-aml/shared/src/test/resources/vocabularies2/production/Instagram/dialect.json index 93f6e011..4c0ce743 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/production/Instagram/dialect.json +++ b/amf-aml/shared/src/test/resources/vocabularies2/production/Instagram/dialect.json @@ -288,21 +288,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/Instagram/dialect.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/production/Instagram/dialect.yaml" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "learning->http://mulesoft.com/vocabularies/amf-learning#::http://mulesoft.com/vocabularies/amf-learning#::vocabulary.yaml" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/Instagram/dialect.yaml#/source-map/lexical/element_4", @@ -369,6 +354,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/Instagram/dialect.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/production/Instagram/dialect.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "learning->http://mulesoft.com/vocabularies/amf-learning#::http://mulesoft.com/vocabularies/amf-learning#::vocabulary.yaml" + } + ] + } ] } ], @@ -479,7 +479,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://mulesoft.com/vocabularies/amf-learning#name/source-map/lexical/element_0", + "@id": "http://mulesoft.com/vocabularies/amf-learning#name/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://mulesoft.com/vocabularies/amf-learning#name" @@ -490,6 +490,19 @@ "@value": "[(25,2)-(28,17)]" } ] + }, + { + "@id": "http://mulesoft.com/vocabularies/amf-learning#name/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(28,4)-(28,17)]" + } + ] } ] } @@ -540,6 +553,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/Instagram/vocabulary.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/Instagram/vocabulary.yaml#/source-map/lexical/element_3", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/production/asyncapi/dialect2.yaml b/amf-aml/shared/src/test/resources/vocabularies2/production/asyncapi/dialect2.yaml index 8e342f29..f34b95b1 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/production/asyncapi/dialect2.yaml +++ b/amf-aml/shared/src/test/resources/vocabularies2/production/asyncapi/dialect2.yaml @@ -44,4 +44,4 @@ nodeMappings: documents: root: - encodes: AsyncAPIObject + encodes: AsyncAPIObject \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example1_instance.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example1_instance.expanded.jsonld index 48158058..a4eb735e 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example1_instance.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example1_instance.expanded.jsonld @@ -142,7 +142,7 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(6,0)-(12,0)]" + "@value": "[(5,2)-(12,0)]" } ] }, @@ -300,7 +300,7 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(13,0)-(19,0)]" + "@value": "[(12,2)-(19,0)]" } ] }, diff --git a/amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example1_instance.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example1_instance.flattened.jsonld index f9321d9e..db3d4fb7 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example1_instance.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example1_instance.flattened.jsonld @@ -189,7 +189,7 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example1_instance.yaml#/encodes/assets/vdp-binary/source-map/lexical/element_3", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example1_instance.yaml#/encodes/assets/vdp-binary", - "http://a.ml/vocabularies/document-source-maps#value": "[(6,0)-(12,0)]" + "http://a.ml/vocabularies/document-source-maps#value": "[(5,2)-(12,0)]" }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example1_instance.yaml#/encodes/assets/vdp-binary/source-map/lexical/element_5", @@ -229,7 +229,7 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example1_instance.yaml#/encodes/assets/vdp-key/source-map/lexical/element_4", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example1_instance.yaml#/encodes/assets/vdp-key", - "http://a.ml/vocabularies/document-source-maps#value": "[(13,0)-(19,0)]" + "http://a.ml/vocabularies/document-source-maps#value": "[(12,2)-(19,0)]" }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example1_instance.yaml#/encodes/assets/vdp-key/source-map/lexical/element_6", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example2_instance.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example2_instance.expanded.jsonld index d5700357..6b51136f 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example2_instance.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example2_instance.expanded.jsonld @@ -142,7 +142,7 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(6,0)-(13,0)]" + "@value": "[(5,2)-(13,0)]" } ] }, @@ -300,7 +300,7 @@ ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(14,0)-(21,0)]" + "@value": "[(13,2)-(21,0)]" } ] }, diff --git a/amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example2_instance.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example2_instance.flattened.jsonld index 2742c3f0..06c3dc52 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example2_instance.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example2_instance.flattened.jsonld @@ -189,7 +189,7 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example2_instance.yaml#/encodes/assets/vdp-binary/source-map/lexical/element_3", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example2_instance.yaml#/encodes/assets/vdp-binary", - "http://a.ml/vocabularies/document-source-maps#value": "[(6,0)-(13,0)]" + "http://a.ml/vocabularies/document-source-maps#value": "[(5,2)-(13,0)]" }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example2_instance.yaml#/encodes/assets/vdp-binary/source-map/lexical/element_5", @@ -229,7 +229,7 @@ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example2_instance.yaml#/encodes/assets/vdp-key/source-map/lexical/element_4", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example2_instance.yaml#/encodes/assets/vdp-key", - "http://a.ml/vocabularies/document-source-maps#value": "[(14,0)-(21,0)]" + "http://a.ml/vocabularies/document-source-maps#value": "[(13,2)-(21,0)]" }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/cfg/example2_instance.yaml#/encodes/assets/vdp-key/source-map/lexical/element_6", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/production/streams/activity.json b/amf-aml/shared/src/test/resources/vocabularies2/production/streams/activity.json index 8563e104..ac81d3d3 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/production/streams/activity.json +++ b/amf-aml/shared/src/test/resources/vocabularies2/production/streams/activity.json @@ -221,21 +221,6 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], - "http://a.ml/vocabularies/document-source-maps#aliases-array": [ - { - "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/streams/activity.yaml#/source-map/aliases-array/element_0", - "http://a.ml/vocabularies/document-source-maps#element": [ - { - "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/production/streams/activity.yaml" - } - ], - "http://a.ml/vocabularies/document-source-maps#value": [ - { - "@value": "crm->http://crm.com/vocabularies/core#::http://crm.com/vocabularies/core#::crm.yaml" - } - ] - } - ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/streams/activity.yaml#/source-map/lexical/element_4", @@ -302,6 +287,21 @@ } ] } + ], + "http://a.ml/vocabularies/document-source-maps#aliases-array": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/streams/activity.yaml#/source-map/aliases-array/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-aml/shared/src/test/resources/vocabularies2/production/streams/activity.yaml" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "crm->http://crm.com/vocabularies/core#::http://crm.com/vocabularies/core#::crm.yaml" + } + ] + } ] } ], @@ -343,7 +343,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#PersonalValueType/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#PersonalValueType/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#PersonalValueType" @@ -354,6 +354,19 @@ "@value": "[(129,2)-(132,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#PersonalValueType/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(130,4)-(132,0)]" + } + ] } ] } @@ -383,7 +396,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#GlobalParty/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#GlobalParty/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#GlobalParty" @@ -394,6 +407,19 @@ "@value": "[(105,2)-(108,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#GlobalParty/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(106,4)-(108,0)]" + } + ] } ] } @@ -423,7 +449,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#Country/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#Country/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#Country" @@ -434,6 +460,19 @@ "@value": "[(111,2)-(114,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#Country/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(112,4)-(114,0)]" + } + ] } ] } @@ -463,7 +502,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#Hobby/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#Hobby/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#Hobby" @@ -474,6 +513,19 @@ "@value": "[(171,2)-(174,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#Hobby/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(172,4)-(174,0)]" + } + ] } ] } @@ -503,7 +555,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#Ethnicity/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#Ethnicity/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#Ethnicity" @@ -514,6 +566,19 @@ "@value": "[(156,2)-(159,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#Ethnicity/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(157,4)-(159,0)]" + } + ] } ] } @@ -761,15 +826,15 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#Individual/source-map/lexical/element_1", + "@id": "http://crm.com/vocabularies/core#Individual/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://crm.com/vocabularies/core#Individual" + "@value": "http://a.ml/vocabularies/meta#properties" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(28,2)-(105,0)]" + "@value": "[(30,4)-(105,0)]" } ] }, @@ -777,12 +842,25 @@ "@id": "http://crm.com/vocabularies/core#Individual/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://a.ml/vocabularies/meta#properties" + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(30,4)-(105,0)]" + "@value": "[(29,4)-(30,0)]" + } + ] + }, + { + "@id": "http://crm.com/vocabularies/core#Individual/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://crm.com/vocabularies/core#Individual" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(28,2)-(105,0)]" } ] } @@ -814,7 +892,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#Religion/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#Religion/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#Religion" @@ -825,6 +903,19 @@ "@value": "[(165,2)-(168,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#Religion/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(166,4)-(168,0)]" + } + ] } ] } @@ -854,7 +945,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#IncomeRange/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#IncomeRange/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#IncomeRange" @@ -865,6 +956,19 @@ "@value": "[(123,2)-(126,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#IncomeRange/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(124,4)-(126,0)]" + } + ] } ] } @@ -894,7 +998,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#PersonLifeStage/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#PersonLifeStage/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#PersonLifeStage" @@ -905,6 +1009,19 @@ "@value": "[(153,2)-(156,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#PersonLifeStage/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(154,4)-(156,0)]" + } + ] } ] } @@ -997,7 +1114,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#LifeAttitudeType/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#LifeAttitudeType/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#LifeAttitudeType" @@ -1008,6 +1125,19 @@ "@value": "[(135,2)-(138,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#LifeAttitudeType/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(136,4)-(138,0)]" + } + ] } ] } @@ -1037,7 +1167,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#LifeStyleType/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#LifeStyleType/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#LifeStyleType" @@ -1048,6 +1178,19 @@ "@value": "[(132,2)-(135,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#LifeStyleType/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(133,4)-(135,0)]" + } + ] } ] } @@ -1077,7 +1220,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#MilitaryStatus/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#MilitaryStatus/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#MilitaryStatus" @@ -1088,6 +1231,19 @@ "@value": "[(168,2)-(171,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#MilitaryStatus/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(169,4)-(171,0)]" + } + ] } ] } @@ -1117,7 +1273,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#Language/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#Language/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#Language" @@ -1128,6 +1284,19 @@ "@value": "[(117,2)-(120,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#Language/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(118,4)-(120,0)]" + } + ] } ] } @@ -1157,7 +1326,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#Currency/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#Currency/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#Currency" @@ -1168,6 +1337,19 @@ "@value": "[(120,2)-(123,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#Currency/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(121,4)-(123,0)]" + } + ] } ] } @@ -1197,7 +1379,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#DietaryHabitType/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#DietaryHabitType/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#DietaryHabitType" @@ -1208,6 +1390,19 @@ "@value": "[(138,2)-(141,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#DietaryHabitType/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(139,4)-(141,0)]" + } + ] } ] } @@ -1237,7 +1432,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#DisabilityType/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#DisabilityType/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#DisabilityType" @@ -1248,6 +1443,19 @@ "@value": "[(141,2)-(144,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#DisabilityType/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(142,4)-(144,0)]" + } + ] } ] } @@ -1277,7 +1485,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#PartyNoMergeReason/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#PartyNoMergeReason/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#PartyNoMergeReason" @@ -1288,6 +1496,19 @@ "@value": "[(108,2)-(111,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#PartyNoMergeReason/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(109,4)-(111,0)]" + } + ] } ] } @@ -1317,7 +1538,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#DoNotProcessReason/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#DoNotProcessReason/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#DoNotProcessReason" @@ -1328,6 +1549,19 @@ "@value": "[(114,2)-(117,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#DoNotProcessReason/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(115,4)-(117,0)]" + } + ] } ] } @@ -1357,7 +1591,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#HeightUOM/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#HeightUOM/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#HeightUOM" @@ -1368,7 +1602,20 @@ "@value": "[(144,2)-(147,0)]" } ] - } + }, + { + "@id": "http://crm.com/vocabularies/core#HeightUOM/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(145,4)-(147,0)]" + } + ] + } ] } ] @@ -1397,7 +1644,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#Organization/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#Organization/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#Organization" @@ -1408,6 +1655,19 @@ "@value": "[(25,2)-(28,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#Organization/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(26,4)-(28,0)]" + } + ] } ] } @@ -1437,7 +1697,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#WeightUOM/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#WeightUOM/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#WeightUOM" @@ -1448,6 +1708,19 @@ "@value": "[(147,2)-(150,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#WeightUOM/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(148,4)-(150,0)]" + } + ] } ] } @@ -1477,7 +1750,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#Gender/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#Gender/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#Gender" @@ -1488,6 +1761,19 @@ "@value": "[(162,2)-(165,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#Gender/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(163,4)-(165,0)]" + } + ] } ] } @@ -1517,7 +1803,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#Household/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#Household/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#Household" @@ -1528,6 +1814,19 @@ "@value": "[(159,2)-(162,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#Household/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(160,4)-(162,0)]" + } + ] } ] } @@ -1557,7 +1856,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#PersonalityType/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#PersonalityType/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#PersonalityType" @@ -1568,6 +1867,19 @@ "@value": "[(126,2)-(129,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#PersonalityType/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(127,4)-(129,0)]" + } + ] } ] } @@ -1597,7 +1909,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#MaritalStatus/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#MaritalStatus/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#MaritalStatus" @@ -1608,6 +1920,19 @@ "@value": "[(150,2)-(153,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#MaritalStatus/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(151,4)-(153,0)]" + } + ] } ] } @@ -1654,15 +1979,15 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#Party/source-map/lexical/element_1", + "@id": "http://crm.com/vocabularies/core#Party/source-map/lexical/element_2", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://crm.com/vocabularies/core#Party" + "@value": "http://a.ml/vocabularies/meta#properties" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(16,2)-(25,0)]" + "@value": "[(18,4)-(25,0)]" } ] }, @@ -1670,12 +1995,25 @@ "@id": "http://crm.com/vocabularies/core#Party/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://a.ml/vocabularies/meta#properties" + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(18,4)-(25,0)]" + "@value": "[(17,4)-(18,0)]" + } + ] + }, + { + "@id": "http://crm.com/vocabularies/core#Party/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://crm.com/vocabularies/core#Party" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(16,2)-(25,0)]" } ] } @@ -1713,7 +2051,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#MainDietaryHabitType/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#MainDietaryHabitType/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#MainDietaryHabitType" @@ -1724,6 +2062,19 @@ "@value": "[(431,4)-(436,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#MainDietaryHabitType/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(434,6)-(436,0)]" + } + ] } ] } @@ -1759,7 +2110,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#NameSuffix/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#NameSuffix/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#NameSuffix" @@ -1770,6 +2121,19 @@ "@value": "[(241,4)-(246,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#NameSuffix/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(244,6)-(246,0)]" + } + ] } ] } @@ -1805,7 +2169,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#YearlyIncome/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#YearlyIncome/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#YearlyIncome" @@ -1816,6 +2180,19 @@ "@value": "[(386,4)-(391,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#YearlyIncome/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(389,6)-(391,0)]" + } + ] } ] } @@ -1851,7 +2228,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#Id/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#Id/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#Id" @@ -1862,6 +2239,19 @@ "@value": "[(176,4)-(181,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#Id/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(179,6)-(181,0)]" + } + ] } ] } @@ -1897,7 +2287,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#MiddleName/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#MiddleName/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#MiddleName" @@ -1908,6 +2298,19 @@ "@value": "[(226,4)-(231,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#MiddleName/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(229,6)-(231,0)]" + } + ] } ] } @@ -1943,7 +2346,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#DeletionCode/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#DeletionCode/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#DeletionCode" @@ -1954,6 +2357,19 @@ "@value": "[(366,4)-(371,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#DeletionCode/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(369,6)-(371,0)]" + } + ] } ] } @@ -1989,7 +2405,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#GenderCode/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#GenderCode/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#GenderCode" @@ -2000,6 +2416,19 @@ "@value": "[(511,4)-(516,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#GenderCode/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(514,6)-(516,0)]" + } + ] } ] } @@ -2035,7 +2464,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#YearlyIncomeCurrencyCode/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#YearlyIncomeCurrencyCode/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#YearlyIncomeCurrencyCode" @@ -2046,6 +2475,19 @@ "@value": "[(391,4)-(396,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#YearlyIncomeCurrencyCode/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(394,6)-(396,0)]" + } + ] } ] } @@ -2081,7 +2523,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#WebSiteURL/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#WebSiteURL/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#WebSiteURL" @@ -2092,6 +2534,19 @@ "@value": "[(561,4)-(565,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#WebSiteURL/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(564,6)-(565,0)]" + } + ] } ] } @@ -2127,7 +2582,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#MainDisabilityType/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#MainDisabilityType/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#MainDisabilityType" @@ -2138,6 +2593,19 @@ "@value": "[(436,4)-(441,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#MainDisabilityType/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(439,6)-(441,0)]" + } + ] } ] } @@ -2173,7 +2641,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#PrimaryHouseholdId/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#PrimaryHouseholdId/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#PrimaryHouseholdId" @@ -2184,6 +2652,19 @@ "@value": "[(501,4)-(506,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#PrimaryHouseholdId/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(504,6)-(506,0)]" + } + ] } ] } @@ -2219,7 +2700,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#NetWorth/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#NetWorth/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#NetWorth" @@ -2230,6 +2711,19 @@ "@value": "[(381,4)-(386,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#NetWorth/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(384,6)-(386,0)]" + } + ] } ] } @@ -2265,7 +2759,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#HasOptedOutProfiling/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#HasOptedOutProfiling/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#HasOptedOutProfiling" @@ -2276,6 +2770,19 @@ "@value": "[(306,4)-(311,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#HasOptedOutProfiling/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(309,6)-(311,0)]" + } + ] } ] } @@ -2311,7 +2818,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#NoMergeReasonCode/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#NoMergeReasonCode/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#NoMergeReasonCode" @@ -2322,6 +2829,19 @@ "@value": "[(191,4)-(196,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#NoMergeReasonCode/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(194,6)-(196,0)]" + } + ] } ] } @@ -2357,7 +2877,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#ReligionCode/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#ReligionCode/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#ReligionCode" @@ -2368,6 +2888,19 @@ "@value": "[(516,4)-(521,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#ReligionCode/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(519,6)-(521,0)]" + } + ] } ] } @@ -2402,16 +2935,29 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://crm.com/vocabularies/core#MainPersonalityType/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://crm.com/vocabularies/core#MainPersonalityType" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(411,4)-(416,0)]" + } + ] + }, { "@id": "http://crm.com/vocabularies/core#MainPersonalityType/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://crm.com/vocabularies/core#MainPersonalityType" + "@value": "http://www.w3.org/2000/01/rdf-schema#range" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(411,4)-(416,0)]" + "@value": "[(414,6)-(416,0)]" } ] } @@ -2449,7 +2995,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#OccupationTypeCode/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#OccupationTypeCode/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#OccupationTypeCode" @@ -2460,6 +3006,19 @@ "@value": "[(536,4)-(541,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#OccupationTypeCode/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(539,6)-(541,0)]" + } + ] } ] } @@ -2495,7 +3054,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#LastKnownLocation/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#LastKnownLocation/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#LastKnownLocation" @@ -2506,6 +3065,19 @@ "@value": "[(481,4)-(486,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#LastKnownLocation/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(484,6)-(486,0)]" + } + ] } ] } @@ -2541,7 +3113,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#Occupation/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#Occupation/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#Occupation" @@ -2552,6 +3124,19 @@ "@value": "[(551,4)-(556,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#Occupation/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(554,6)-(556,0)]" + } + ] } ] } @@ -2587,7 +3172,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#FirstName/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#FirstName/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#FirstName" @@ -2598,6 +3183,19 @@ "@value": "[(221,4)-(226,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#FirstName/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(224,6)-(226,0)]" + } + ] } ] } @@ -2633,7 +3231,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#MaritalStatusCode/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#MaritalStatusCode/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#MaritalStatusCode" @@ -2644,6 +3242,19 @@ "@value": "[(486,4)-(491,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#MaritalStatusCode/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(489,6)-(491,0)]" + } + ] } ] } @@ -2679,7 +3290,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#HasOptedOutTracking/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#HasOptedOutTracking/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#HasOptedOutTracking" @@ -2690,6 +3301,19 @@ "@value": "[(276,4)-(281,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#HasOptedOutTracking/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(279,6)-(281,0)]" + } + ] } ] } @@ -2725,7 +3349,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#ResidenceCaptureMethodCode/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#ResidenceCaptureMethodCode/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#ResidenceCaptureMethodCode" @@ -2736,6 +3360,19 @@ "@value": "[(271,4)-(276,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#ResidenceCaptureMethodCode/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(274,6)-(276,0)]" + } + ] } ] } @@ -2771,7 +3408,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#EthnicityCode/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#EthnicityCode/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#EthnicityCode" @@ -2782,6 +3419,19 @@ "@value": "[(496,4)-(501,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#EthnicityCode/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(499,6)-(501,0)]" + } + ] } ] } @@ -2817,7 +3467,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#DoNotTrackLocationUpdateDate/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#DoNotTrackLocationUpdateDate/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#DoNotTrackLocationUpdateDate" @@ -2828,6 +3478,19 @@ "@value": "[(291,4)-(296,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#DoNotTrackLocationUpdateDate/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(294,6)-(296,0)]" + } + ] } ] } @@ -2863,7 +3526,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#PrimaryHobbyCode/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#PrimaryHobbyCode/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#PrimaryHobbyCode" @@ -2874,6 +3537,19 @@ "@value": "[(556,4)-(561,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#PrimaryHobbyCode/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(559,6)-(561,0)]" + } + ] } ] } @@ -2909,7 +3585,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#SourceSystemId/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#SourceSystemId/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#SourceSystemId" @@ -2920,6 +3596,19 @@ "@value": "[(196,4)-(201,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#SourceSystemId/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(199,6)-(201,0)]" + } + ] } ] } @@ -2955,7 +3644,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#PersonName/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#PersonName/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#PersonName" @@ -2966,6 +3655,19 @@ "@value": "[(211,4)-(216,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#PersonName/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(214,6)-(216,0)]" + } + ] } ] } @@ -3001,7 +3703,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#BirthDate/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#BirthDate/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#BirthDate" @@ -3012,6 +3714,19 @@ "@value": "[(356,4)-(361,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#BirthDate/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(359,6)-(361,0)]" + } + ] } ] } @@ -3047,7 +3762,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#ConsumerCreditScoreProviderName/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#ConsumerCreditScoreProviderName/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#ConsumerCreditScoreProviderName" @@ -3058,6 +3773,19 @@ "@value": "[(406,4)-(411,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#ConsumerCreditScoreProviderName/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(409,6)-(411,0)]" + } + ] } ] } @@ -3093,7 +3821,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#DoNotProcessFromUpdateDate/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#DoNotProcessFromUpdateDate/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#DoNotProcessFromUpdateDate" @@ -3104,6 +3832,19 @@ "@value": "[(321,4)-(326,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#DoNotProcessFromUpdateDate/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(324,6)-(326,0)]" + } + ] } ] } @@ -3139,7 +3880,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#Salutation/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#Salutation/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#Salutation" @@ -3150,6 +3891,19 @@ "@value": "[(216,4)-(221,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#Salutation/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(219,6)-(221,0)]" + } + ] } ] } @@ -3185,7 +3939,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#OfficialName/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#OfficialName/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#OfficialName" @@ -3196,6 +3950,19 @@ "@value": "[(246,4)-(251,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#OfficialName/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(249,6)-(251,0)]" + } + ] } ] } @@ -3231,7 +3998,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#DeathDate/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#DeathDate/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#DeathDate" @@ -3242,6 +4009,19 @@ "@value": "[(506,4)-(511,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#DeathDate/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(509,6)-(511,0)]" + } + ] } ] } @@ -3277,7 +4057,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#DoNotProcessReasonCode/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#DoNotProcessReasonCode/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#DoNotProcessReasonCode" @@ -3288,6 +4068,19 @@ "@value": "[(326,4)-(331,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#DoNotProcessReasonCode/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(329,6)-(331,0)]" + } + ] } ] } @@ -3323,7 +4116,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#MailingName/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#MailingName/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#MailingName" @@ -3334,6 +4127,19 @@ "@value": "[(251,4)-(256,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#MailingName/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(254,6)-(256,0)]" + } + ] } ] } @@ -3368,16 +4174,29 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://crm.com/vocabularies/core#PrimaryLanguageCode/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://crm.com/vocabularies/core#PrimaryLanguageCode" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(376,4)-(381,0)]" + } + ] + }, { "@id": "http://crm.com/vocabularies/core#PrimaryLanguageCode/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://crm.com/vocabularies/core#PrimaryLanguageCode" + "@value": "http://www.w3.org/2000/01/rdf-schema#range" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(376,4)-(381,0)]" + "@value": "[(379,6)-(381,0)]" } ] } @@ -3415,7 +4234,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#PartyType/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#PartyType/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#PartyType" @@ -3426,6 +4245,19 @@ "@value": "[(181,4)-(186,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#PartyType/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(184,6)-(186,0)]" + } + ] } ] } @@ -3461,7 +4293,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#PersonHeight/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#PersonHeight/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#PersonHeight" @@ -3472,6 +4304,19 @@ "@value": "[(441,4)-(446,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#PersonHeight/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(444,6)-(446,0)]" + } + ] } ] } @@ -3507,7 +4352,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#PersonWeightUnitofMeasure/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#PersonWeightUnitofMeasure/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#PersonWeightUnitofMeasure" @@ -3518,6 +4363,19 @@ "@value": "[(456,4)-(461,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#PersonWeightUnitofMeasure/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(459,6)-(461,0)]" + } + ] } ] } @@ -3553,7 +4411,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#HasOptedOutSolicit/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#HasOptedOutSolicit/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#HasOptedOutSolicit" @@ -3564,6 +4422,19 @@ "@value": "[(296,4)-(301,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#HasOptedOutSolicit/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(299,6)-(301,0)]" + } + ] } ] } @@ -3599,7 +4470,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#ConsumerCreditScore/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#ConsumerCreditScore/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#ConsumerCreditScore" @@ -3610,6 +4481,19 @@ "@value": "[(401,4)-(406,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#ConsumerCreditScore/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(404,6)-(406,0)]" + } + ] } ] } @@ -3645,7 +4529,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#DoNotTrackUpdateDate/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#DoNotTrackUpdateDate/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#DoNotTrackUpdateDate" @@ -3656,6 +4540,19 @@ "@value": "[(281,4)-(286,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#DoNotTrackUpdateDate/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(284,6)-(286,0)]" + } + ] } ] } @@ -3691,7 +4588,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#ChildrenCount/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#ChildrenCount/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#ChildrenCount" @@ -3702,6 +4599,19 @@ "@value": "[(531,4)-(536,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#ChildrenCount/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(534,6)-(536,0)]" + } + ] } ] } @@ -3737,7 +4647,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#MainPersonalValueType/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#MainPersonalValueType/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#MainPersonalValueType" @@ -3748,6 +4658,19 @@ "@value": "[(416,4)-(421,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#MainPersonalValueType/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(419,6)-(421,0)]" + } + ] } ] } @@ -3783,7 +4706,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#DoNotProfileFromUpdateDate/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#DoNotProfileFromUpdateDate/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#DoNotProfileFromUpdateDate" @@ -3794,6 +4717,19 @@ "@value": "[(311,4)-(316,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#DoNotProfileFromUpdateDate/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(314,6)-(316,0)]" + } + ] } ] } @@ -3829,7 +4765,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#PersonHeightUnitofMeasure/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#PersonHeightUnitofMeasure/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#PersonHeightUnitofMeasure" @@ -3840,6 +4776,19 @@ "@value": "[(446,4)-(451,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#PersonHeightUnitofMeasure/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(449,6)-(451,0)]" + } + ] } ] } @@ -3875,7 +4824,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#MilitaryStatusCode/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#MilitaryStatusCode/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#MilitaryStatusCode" @@ -3886,6 +4835,19 @@ "@value": "[(546,4)-(551,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#MilitaryStatusCode/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(549,6)-(551,0)]" + } + ] } ] } @@ -3921,7 +4883,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#InfluencerRating/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#InfluencerRating/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#InfluencerRating" @@ -3932,6 +4894,19 @@ "@value": "[(371,4)-(376,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#InfluencerRating/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(374,6)-(376,0)]" + } + ] } ] } @@ -3967,7 +4942,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#SecondFamilyName/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#SecondFamilyName/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#SecondFamilyName" @@ -3978,6 +4953,19 @@ "@value": "[(236,4)-(241,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#SecondFamilyName/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(239,6)-(241,0)]" + } + ] } ] } @@ -4013,7 +5001,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#HasOptedOutGeoTracking/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#HasOptedOutGeoTracking/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#HasOptedOutGeoTracking" @@ -4024,6 +5012,19 @@ "@value": "[(286,4)-(291,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#HasOptedOutGeoTracking/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(289,6)-(291,0)]" + } + ] } ] } @@ -4059,7 +5060,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#BirthPlace/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#BirthPlace/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#BirthPlace" @@ -4070,6 +5071,19 @@ "@value": "[(471,4)-(476,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#BirthPlace/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(474,6)-(476,0)]" + } + ] } ] } @@ -4105,7 +5119,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#CountryofOrigin/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#CountryofOrigin/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#CountryofOrigin" @@ -4116,6 +5130,19 @@ "@value": "[(466,4)-(471,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#CountryofOrigin/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(469,6)-(471,0)]" + } + ] } ] } @@ -4151,7 +5178,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#MainLifeAttitudeType/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#MainLifeAttitudeType/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#MainLifeAttitudeType" @@ -4162,6 +5189,19 @@ "@value": "[(426,4)-(431,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#MainLifeAttitudeType/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(429,6)-(431,0)]" + } + ] } ] } @@ -4197,7 +5237,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#ResidenceCountryCode/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#ResidenceCountryCode/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#ResidenceCountryCode" @@ -4208,6 +5248,19 @@ "@value": "[(266,4)-(271,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#ResidenceCountryCode/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(269,6)-(271,0)]" + } + ] } ] } @@ -4243,7 +5296,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#IsHomeOwner/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#IsHomeOwner/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#IsHomeOwner" @@ -4254,6 +5307,19 @@ "@value": "[(526,4)-(531,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#IsHomeOwner/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(529,6)-(531,0)]" + } + ] } ] } @@ -4289,7 +5355,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#ShouldForget/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#ShouldForget/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#ShouldForget" @@ -4300,6 +5366,19 @@ "@value": "[(331,4)-(336,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#ShouldForget/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(334,6)-(336,0)]" + } + ] } ] } @@ -4334,16 +5413,29 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://crm.com/vocabularies/core#NickName/source-map/lexical/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://crm.com/vocabularies/core#NickName" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(261,4)-(266,0)]" + } + ] + }, { "@id": "http://crm.com/vocabularies/core#NickName/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://crm.com/vocabularies/core#NickName" + "@value": "http://www.w3.org/2000/01/rdf-schema#range" } ], "http://a.ml/vocabularies/document-source-maps#value": [ { - "@value": "[(261,4)-(266,0)]" + "@value": "[(264,6)-(266,0)]" } ] } @@ -4381,7 +5473,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#FamilyName/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#FamilyName/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#FamilyName" @@ -4392,6 +5484,19 @@ "@value": "[(231,4)-(236,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#FamilyName/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(234,6)-(236,0)]" + } + ] } ] } @@ -4427,7 +5532,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#OrderingName/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#OrderingName/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#OrderingName" @@ -4438,6 +5543,19 @@ "@value": "[(256,4)-(261,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#OrderingName/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(259,6)-(261,0)]" + } + ] } ] } @@ -4473,7 +5591,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#SourceRecordId/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#SourceRecordId/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#SourceRecordId" @@ -4484,6 +5602,19 @@ "@value": "[(201,4)-(206,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#SourceRecordId/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(204,6)-(206,0)]" + } + ] } ] } @@ -4519,7 +5650,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#OverAgeNumber/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#OverAgeNumber/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#OverAgeNumber" @@ -4530,6 +5661,19 @@ "@value": "[(361,4)-(366,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#OverAgeNumber/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(364,6)-(366,0)]" + } + ] } ] } @@ -4565,7 +5709,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#SendIndividualData/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#SendIndividualData/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#SendIndividualData" @@ -4576,6 +5720,19 @@ "@value": "[(341,4)-(346,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#SendIndividualData/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(344,6)-(346,0)]" + } + ] } ] } @@ -4611,7 +5768,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#GlobalPartyId/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#GlobalPartyId/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#GlobalPartyId" @@ -4622,6 +5779,19 @@ "@value": "[(186,4)-(191,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#GlobalPartyId/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(189,6)-(191,0)]" + } + ] } ] } @@ -4657,7 +5827,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#DoExtractMyDataUpdateDate/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#DoExtractMyDataUpdateDate/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#DoExtractMyDataUpdateDate" @@ -4668,6 +5838,19 @@ "@value": "[(346,4)-(351,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#DoExtractMyDataUpdateDate/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(349,6)-(351,0)]" + } + ] } ] } @@ -4703,7 +5886,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#DoNotMarketFromUpdateDate/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#DoNotMarketFromUpdateDate/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#DoNotMarketFromUpdateDate" @@ -4714,6 +5897,19 @@ "@value": "[(301,4)-(306,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#DoNotMarketFromUpdateDate/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(304,6)-(306,0)]" + } + ] } ] } @@ -4749,7 +5945,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#YearlyIncomeRangeCode/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#YearlyIncomeRangeCode/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#YearlyIncomeRangeCode" @@ -4760,6 +5956,19 @@ "@value": "[(396,4)-(401,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#YearlyIncomeRangeCode/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(399,6)-(401,0)]" + } + ] } ] } @@ -4795,7 +6004,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#DoForgetMeFromUpdateDate/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#DoForgetMeFromUpdateDate/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#DoForgetMeFromUpdateDate" @@ -4806,6 +6015,19 @@ "@value": "[(336,4)-(341,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#DoForgetMeFromUpdateDate/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(339,6)-(341,0)]" + } + ] } ] } @@ -4841,7 +6063,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#PhotoURL/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#PhotoURL/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#PhotoURL" @@ -4852,6 +6074,19 @@ "@value": "[(206,4)-(211,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#PhotoURL/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(209,6)-(211,0)]" + } + ] } ] } @@ -4887,7 +6122,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#HasOptedOutProcessing/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#HasOptedOutProcessing/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#HasOptedOutProcessing" @@ -4898,6 +6133,19 @@ "@value": "[(316,4)-(321,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#HasOptedOutProcessing/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(319,6)-(321,0)]" + } + ] } ] } @@ -4933,7 +6181,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#PrimaryCitizenshipCountryCode/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#PrimaryCitizenshipCountryCode/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#PrimaryCitizenshipCountryCode" @@ -4944,6 +6192,19 @@ "@value": "[(461,4)-(466,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#PrimaryCitizenshipCountryCode/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(464,6)-(466,0)]" + } + ] } ] } @@ -4979,7 +6240,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#PersonWeight/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#PersonWeight/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#PersonWeight" @@ -4990,6 +6251,19 @@ "@value": "[(451,4)-(456,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#PersonWeight/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(454,6)-(456,0)]" + } + ] } ] } @@ -5025,7 +6299,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#PersonLifeStageCode/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#PersonLifeStageCode/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#PersonLifeStageCode" @@ -5036,6 +6310,19 @@ "@value": "[(491,4)-(496,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#PersonLifeStageCode/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(494,6)-(496,0)]" + } + ] } ] } @@ -5071,7 +6358,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#ConvictionsCount/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#ConvictionsCount/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#ConvictionsCount" @@ -5082,6 +6369,19 @@ "@value": "[(521,4)-(526,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#ConvictionsCount/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(524,6)-(526,0)]" + } + ] } ] } @@ -5117,7 +6417,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#MilitaryServiceFlag/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#MilitaryServiceFlag/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#MilitaryServiceFlag" @@ -5128,6 +6428,19 @@ "@value": "[(541,4)-(546,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#MilitaryServiceFlag/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(544,6)-(546,0)]" + } + ] } ] } @@ -5163,7 +6476,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#MainLifeStyleType/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#MainLifeStyleType/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#MainLifeStyleType" @@ -5174,6 +6487,19 @@ "@value": "[(421,4)-(426,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#MainLifeStyleType/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(424,6)-(426,0)]" + } + ] } ] } @@ -5209,7 +6535,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#DeathPlace/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#DeathPlace/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#DeathPlace" @@ -5220,6 +6546,19 @@ "@value": "[(476,4)-(481,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#DeathPlace/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(479,6)-(481,0)]" + } + ] } ] } @@ -5255,7 +6594,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://crm.com/vocabularies/core#CanStorePIIElsewhere/source-map/lexical/element_0", + "@id": "http://crm.com/vocabularies/core#CanStorePIIElsewhere/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://crm.com/vocabularies/core#CanStorePIIElsewhere" @@ -5266,6 +6605,19 @@ "@value": "[(351,4)-(356,0)]" } ] + }, + { + "@id": "http://crm.com/vocabularies/core#CanStorePIIElsewhere/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(354,6)-(356,0)]" + } + ] } ] } @@ -5311,6 +6663,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/streams/crm.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/production/streams/crm.yaml#/source-map/lexical/element_2", diff --git a/amf-aml/shared/src/test/resources/vocabularies2/rendering/double-scientific-notation/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/rendering/double-scientific-notation/dialect.yaml new file mode 100644 index 00000000..3f459249 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/rendering/double-scientific-notation/dialect.yaml @@ -0,0 +1,11 @@ +#%Dialect 1.0 +dialect: Double +version: "1.0" +nodeMappings: + Root: + mapping: + doubleValue: + range: double +documents: + root: + encodes: Root \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/rendering/double-scientific-notation/instance-golden.yaml b/amf-aml/shared/src/test/resources/vocabularies2/rendering/double-scientific-notation/instance-golden.yaml new file mode 100644 index 00000000..98424eb7 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/rendering/double-scientific-notation/instance-golden.yaml @@ -0,0 +1,2 @@ +#%Double 1.0 +doubleValue: 372036854775807 diff --git a/amf-aml/shared/src/test/resources/vocabularies2/rendering/double-scientific-notation/instance.yaml b/amf-aml/shared/src/test/resources/vocabularies2/rendering/double-scientific-notation/instance.yaml new file mode 100644 index 00000000..ca16a863 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/rendering/double-scientific-notation/instance.yaml @@ -0,0 +1,2 @@ +#%Double 1.0 +doubleValue: 372036854775807 \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/semantic/instance.cycled.yaml b/amf-aml/shared/src/test/resources/vocabularies2/semantic/instance.cycled.yaml new file mode 100644 index 00000000..372f583d --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/semantic/instance.cycled.yaml @@ -0,0 +1,10 @@ +#%Github Repository 1.0 +name: MyRepo +(maintainer): + users: + - + username: tomsfernandez + contributor: true + - + username: looseale + contributor: false diff --git a/amf-aml/shared/src/test/resources/vocabularies2/semantic/validation/instances/invalid-obj-link.yaml b/amf-aml/shared/src/test/resources/vocabularies2/semantic/validation/instances/invalid-obj-link.yaml new file mode 100644 index 00000000..e0c06cdd --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/semantic/validation/instances/invalid-obj-link.yaml @@ -0,0 +1,4 @@ +#%Github Repository 1.0 +name: MyRepo +(maintainer): + users: something diff --git a/amf-aml/shared/src/test/resources/vocabularies2/semantic/validation/reports/invalid-obj-link.report b/amf-aml/shared/src/test/resources/vocabularies2/semantic/validation/reports/invalid-obj-link.report new file mode 100644 index 00000000..3f0d823d --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/semantic/validation/reports/invalid-obj-link.report @@ -0,0 +1,14 @@ +ModelId: file://amf-aml/shared/src/test/resources/vocabularies2/semantic/validation/instances/invalid-obj-link.yaml +Profile: +Conforms: false +Number of results: 1 + +Level: Violation + +- Constraint: http://a.ml/vocabularies/amf/core#unresolved-reference + Message: Unresolved reference 'something' + Severity: Violation + Target: file://amf-aml/shared/src/test/resources/vocabularies2/semantic/validation/instances/invalid-obj-link.yaml#/encodes/maintainer/(maintainer)/users/0 + Property: + Range: [(4,9)-(4,18)] + Location: file://amf-aml/shared/src/test/resources/vocabularies2/semantic/validation/instances/invalid-obj-link.yaml diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-boolean/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-boolean/dialect.yaml new file mode 100644 index 00000000..4abfffdc --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-boolean/dialect.yaml @@ -0,0 +1,18 @@ +#%Dialect 1.0 +dialect: BooleanEnums +version: "1.0" +documents: + root: + encodes: MultipleEnums + +nodeMappings: + MultipleEnums: + mapping: + validEnum: + range: boolean + enum: + - true + invalidEnum: + range: boolean + enum: + - true diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-boolean/instance.yaml b/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-boolean/instance.yaml new file mode 100644 index 00000000..4585c625 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-boolean/instance.yaml @@ -0,0 +1,3 @@ +#%BooleanEnums 1.0 +validEnum: true +invalidEnum: false diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-boolean/report.json b/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-boolean/report.json new file mode 100644 index 00000000..da4c13d0 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-boolean/report.json @@ -0,0 +1,35 @@ +{ + "@type": "http://www.w3.org/ns/shacl#ValidationReport", + "http://www.w3.org/ns/shacl#conforms": false, + "http://www.w3.org/ns/shacl#result": [ + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/validation/enum-boolean/instance.yaml#/encodes" + }, + "http://www.w3.org/ns/shacl#resultPath": { + "@id": "http://a.ml/vocabularies/data#invalidEnum" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Property 'invalidEnum' must match some value in true", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "http://a.ml/vocabularies/data#file://amf-aml/shared/src/test/resources/vocabularies2/validation/enum-boolean/dialect.yaml#/declarations/MultipleEnums_invalidEnum_enum_validation" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 3, + "http://a.ml/vocabularies/amf/parser#column": 13 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 3, + "http://a.ml/vocabularies/amf/parser#column": 18 + } + } + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-double/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-double/dialect.yaml new file mode 100644 index 00000000..bf6810bc --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-double/dialect.yaml @@ -0,0 +1,18 @@ +#%Dialect 1.0 +dialect: DoubleEnums +version: "1.0" +documents: + root: + encodes: MultipleEnums + +nodeMappings: + MultipleEnums: + mapping: + validEnum: + range: double + enum: + - 5.78 + invalidEnum: + range: double + enum: + - 5.78 diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-double/instance.yaml b/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-double/instance.yaml new file mode 100644 index 00000000..7580f1fe --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-double/instance.yaml @@ -0,0 +1,3 @@ +#%DoubleEnums 1.0 +validEnum: 5.78 +invalidEnum: 7.9223 diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-double/report.json b/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-double/report.json new file mode 100644 index 00000000..095504b3 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-double/report.json @@ -0,0 +1,35 @@ +{ + "@type": "http://www.w3.org/ns/shacl#ValidationReport", + "http://www.w3.org/ns/shacl#conforms": false, + "http://www.w3.org/ns/shacl#result": [ + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/validation/enum-double/instance.yaml#/encodes" + }, + "http://www.w3.org/ns/shacl#resultPath": { + "@id": "http://a.ml/vocabularies/data#invalidEnum" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Property 'invalidEnum' must match some value in 5.78", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "http://a.ml/vocabularies/data#file://amf-aml/shared/src/test/resources/vocabularies2/validation/enum-double/dialect.yaml#/declarations/MultipleEnums_invalidEnum_enum_validation" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 3, + "http://a.ml/vocabularies/amf/parser#column": 13 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 3, + "http://a.ml/vocabularies/amf/parser#column": 19 + } + } + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-integer/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-integer/dialect.yaml new file mode 100644 index 00000000..8b3531a0 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-integer/dialect.yaml @@ -0,0 +1,18 @@ +#%Dialect 1.0 +dialect: IntegerEnums +version: "1.0" +documents: + root: + encodes: MultipleEnums + +nodeMappings: + MultipleEnums: + mapping: + validEnum: + range: integer + enum: + - 5 + invalidEnum: + range: integer + enum: + - 5 diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-integer/instance.yaml b/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-integer/instance.yaml new file mode 100644 index 00000000..3783f665 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-integer/instance.yaml @@ -0,0 +1,3 @@ +#%IntegerEnums 1.0 +validEnum: 5 +invalidEnum: 7 diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-integer/report.json b/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-integer/report.json new file mode 100644 index 00000000..9c351217 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/enum-integer/report.json @@ -0,0 +1,35 @@ +{ + "@type": "http://www.w3.org/ns/shacl#ValidationReport", + "http://www.w3.org/ns/shacl#conforms": false, + "http://www.w3.org/ns/shacl#result": [ + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/validation/enum-integer/instance.yaml#/encodes" + }, + "http://www.w3.org/ns/shacl#resultPath": { + "@id": "http://a.ml/vocabularies/data#invalidEnum" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Property 'invalidEnum' must match some value in 5", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "http://a.ml/vocabularies/data#file://amf-aml/shared/src/test/resources/vocabularies2/validation/enum-integer/dialect.yaml#/declarations/MultipleEnums_invalidEnum_enum_validation" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 3, + "http://a.ml/vocabularies/amf/parser#column": 13 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 3, + "http://a.ml/vocabularies/amf/parser#column": 14 + } + } + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/instance9_incorrect1.yaml b/amf-aml/shared/src/test/resources/vocabularies2/validation/instance9_incorrect1.yaml index 73a695c0..e78cc8a7 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/validation/instance9_incorrect1.yaml +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/instance9_incorrect1.yaml @@ -1,4 +1,4 @@ -#%Validation Example 1.9 +#%ValidationExample 1.9 a: hey ho optiona: lets go \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-0-mandatory-true/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-0-mandatory-true/dialect.yaml new file mode 100644 index 00000000..a1755add --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-0-mandatory-true/dialect.yaml @@ -0,0 +1,15 @@ +#%Dialect 1.0 +dialect: MinItems +version: "1.0" +documents: + root: + encodes: Root + +nodeMappings: + Root: + mapping: + arrayProperty: + range: string + allowMultiple: true + minItems: 0 + mandatory: true \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-0-mandatory-true/instance-invalid.yaml b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-0-mandatory-true/instance-invalid.yaml new file mode 100644 index 00000000..7cb40027 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-0-mandatory-true/instance-invalid.yaml @@ -0,0 +1 @@ +#%MinItems 1.0 \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-0-mandatory-true/instance-valid.yaml b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-0-mandatory-true/instance-valid.yaml new file mode 100644 index 00000000..7d7dd623 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-0-mandatory-true/instance-valid.yaml @@ -0,0 +1,2 @@ +#%MinItems 1.0 +arrayProperty: [] \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-0-mandatory-true/report.json b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-0-mandatory-true/report.json new file mode 100644 index 00000000..2ac54a10 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-0-mandatory-true/report.json @@ -0,0 +1,35 @@ +{ + "@type": "http://www.w3.org/ns/shacl#ValidationReport", + "http://www.w3.org/ns/shacl#conforms": false, + "http://www.w3.org/ns/shacl#result": [ + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-0-mandatory-true/instance-invalid.yaml#/encodes" + }, + "http://www.w3.org/ns/shacl#resultPath": { + "@id": "http://a.ml/vocabularies/data#arrayProperty" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Property 'arrayProperty' is mandatory", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "http://a.ml/vocabularies/data#file://amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-0-mandatory-true/dialect.yaml#/declarations/Root_arrayProperty_required_validation" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 1, + "http://a.ml/vocabularies/amf/parser#column": 0 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 1, + "http://a.ml/vocabularies/amf/parser#column": 0 + } + } + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-false/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-false/dialect.yaml new file mode 100644 index 00000000..12e9b903 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-false/dialect.yaml @@ -0,0 +1,14 @@ +#%Dialect 1.0 +dialect: MinItems +version: "1.0" +documents: + root: + encodes: Root + +nodeMappings: + Root: + mapping: + arrayProperty: + range: string + allowMultiple: true + minItems: 5 \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-false/instance-invalid.yaml b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-false/instance-invalid.yaml new file mode 100644 index 00000000..45bb79b0 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-false/instance-invalid.yaml @@ -0,0 +1,4 @@ +#%MinItems 1.0 +arrayProperty: + - a + - b \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-false/instance-valid-1.yaml b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-false/instance-valid-1.yaml new file mode 100644 index 00000000..7cb40027 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-false/instance-valid-1.yaml @@ -0,0 +1 @@ +#%MinItems 1.0 \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-false/instance-valid-2.yaml b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-false/instance-valid-2.yaml new file mode 100644 index 00000000..b01a2238 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-false/instance-valid-2.yaml @@ -0,0 +1,8 @@ +#%MinItems 1.0 +arrayProperty: + - a + - b + - c + - d + - e + - f \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-false/report.json b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-false/report.json new file mode 100644 index 00000000..e654af70 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-false/report.json @@ -0,0 +1,35 @@ +{ + "@type": "http://www.w3.org/ns/shacl#ValidationReport", + "http://www.w3.org/ns/shacl#conforms": false, + "http://www.w3.org/ns/shacl#result": [ + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-false/instance-invalid.yaml#/encodes" + }, + "http://www.w3.org/ns/shacl#resultPath": { + "@id": "http://a.ml/vocabularies/data#arrayProperty" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Array must have a minimum of 5 items", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "http://a.ml/vocabularies/data#file://amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-false/dialect.yaml#/declarations/Root_arrayProperty_required_validation" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 2, + "http://a.ml/vocabularies/amf/parser#column": 14 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 4, + "http://a.ml/vocabularies/amf/parser#column": 5 + } + } + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-true/dialect.yaml b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-true/dialect.yaml new file mode 100644 index 00000000..e2b37e28 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-true/dialect.yaml @@ -0,0 +1,15 @@ +#%Dialect 1.0 +dialect: MinItems +version: "1.0" +documents: + root: + encodes: Root + +nodeMappings: + Root: + mapping: + arrayProperty: + range: string + allowMultiple: true + minItems: 5 + mandatory: true \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-true/instance-invalid.yaml b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-true/instance-invalid.yaml new file mode 100644 index 00000000..7cb40027 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-true/instance-invalid.yaml @@ -0,0 +1 @@ +#%MinItems 1.0 \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-true/instance-valid.yaml b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-true/instance-valid.yaml new file mode 100644 index 00000000..b01a2238 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-true/instance-valid.yaml @@ -0,0 +1,8 @@ +#%MinItems 1.0 +arrayProperty: + - a + - b + - c + - d + - e + - f \ No newline at end of file diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-true/report.json b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-true/report.json new file mode 100644 index 00000000..5159fc1e --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-true/report.json @@ -0,0 +1,35 @@ +{ + "@type": "http://www.w3.org/ns/shacl#ValidationReport", + "http://www.w3.org/ns/shacl#conforms": false, + "http://www.w3.org/ns/shacl#result": [ + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-true/instance-invalid.yaml#/encodes" + }, + "http://www.w3.org/ns/shacl#resultPath": { + "@id": "http://a.ml/vocabularies/data#arrayProperty" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Property 'arrayProperty' is mandatory", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "http://a.ml/vocabularies/data#file://amf-aml/shared/src/test/resources/vocabularies2/validation/minItems-n-mandatory-true/dialect.yaml#/declarations/Root_arrayProperty_required_validation" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 1, + "http://a.ml/vocabularies/amf/parser#column": 0 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 1, + "http://a.ml/vocabularies/amf/parser#column": 0 + } + } + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validations/vocabularies/parser-errors/class-term-with-null-entries.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/validations/vocabularies/parser-errors/class-term-with-null-entries.jsonld new file mode 100644 index 00000000..d263e06b --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validations/vocabularies/parser-errors/class-term-with-null-entries.jsonld @@ -0,0 +1,32 @@ +{ + "@type": "http://www.w3.org/ns/shacl#ValidationReport", + "http://www.w3.org/ns/shacl#conforms": false, + "http://www.w3.org/ns/shacl#result": [ + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Expecting !!str, !!null provided", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "http://a.ml/vocabularies/amf/core#syaml-error" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 6, + "http://a.ml/vocabularies/amf/parser#column": 16 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 6, + "http://a.ml/vocabularies/amf/parser#column": 16 + } + } + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validations/vocabularies/parser-errors/class-term-with-null-entries.yaml b/amf-aml/shared/src/test/resources/vocabularies2/validations/vocabularies/parser-errors/class-term-with-null-entries.yaml new file mode 100644 index 00000000..0c49ed56 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validations/vocabularies/parser-errors/class-term-with-null-entries.yaml @@ -0,0 +1,6 @@ +#%Vocabulary 1.0 +vocabulary: Test Vocab +base: ftp://some-url +classTerms: + t: + description: diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validations/vocabularies/parser-errors/property-term-with-null-entries.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/validations/vocabularies/parser-errors/property-term-with-null-entries.jsonld new file mode 100644 index 00000000..d263e06b --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validations/vocabularies/parser-errors/property-term-with-null-entries.jsonld @@ -0,0 +1,32 @@ +{ + "@type": "http://www.w3.org/ns/shacl#ValidationReport", + "http://www.w3.org/ns/shacl#conforms": false, + "http://www.w3.org/ns/shacl#result": [ + { + "@type": "http://www.w3.org/ns/shacl#ValidationResult", + "http://www.w3.org/ns/shacl#resultSeverity": { + "@id": "http://www.w3.org/ns/shacl#Violation" + }, + "http://www.w3.org/ns/shacl#focusNode": { + "@id": "" + }, + "http://www.w3.org/ns/shacl#resultMessage": "Expecting !!str, !!null provided", + "http://www.w3.org/ns/shacl#sourceShape": { + "@id": "http://a.ml/vocabularies/amf/core#syaml-error" + }, + "http://a.ml/vocabularies/amf/parser#lexicalPosition": { + "@type": "http://a.ml/vocabularies/amf/parser#Position", + "http://a.ml/vocabularies/amf/parser#start": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 6, + "http://a.ml/vocabularies/amf/parser#column": 16 + }, + "http://a.ml/vocabularies/amf/parser#end": { + "@type": "http://a.ml/vocabularies/amf/parser#Location", + "http://a.ml/vocabularies/amf/parser#line": 6, + "http://a.ml/vocabularies/amf/parser#column": 16 + } + } + } + ] +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/validations/vocabularies/parser-errors/property-term-with-null-entries.yaml b/amf-aml/shared/src/test/resources/vocabularies2/validations/vocabularies/parser-errors/property-term-with-null-entries.yaml new file mode 100644 index 00000000..e7325b71 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/validations/vocabularies/parser-errors/property-term-with-null-entries.yaml @@ -0,0 +1,6 @@ +#%Vocabulary 1.0 +vocabulary: Test Vocab +base: ftp://some-url +propertyTerms: + prop1: + displayName: diff --git a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example3.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example3.expanded.jsonld index d31ae78d..633e49d1 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example3.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example3.expanded.jsonld @@ -131,7 +131,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test2#C/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test2#C/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test2#C" @@ -142,6 +142,19 @@ "@value": "[(5,2)-(11,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test2#C/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(8,4)-(11,0)]" + } + ] } ] } @@ -226,7 +239,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test2#B/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test2#B/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test2#B" @@ -237,6 +250,19 @@ "@value": "[(14,2)-(18,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test2#B/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(17,4)-(18,0)]" + } + ] } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example3.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example3.flattened.jsonld index fc3fdc7a..67a7fd21 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example3.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example3.flattened.jsonld @@ -120,6 +120,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test2#C/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test2#C/source-map/lexical/element_0" } @@ -142,6 +145,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test2#B/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test2#B/source-map/lexical/element_0" } @@ -163,19 +169,29 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(18,0)]" }, { - "@id": "http://a.ml/vocabularies/test2#C/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test2#C/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test2#C", "http://a.ml/vocabularies/document-source-maps#value": "[(5,2)-(11,0)]" }, + { + "@id": "http://a.ml/vocabularies/test2#C/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subClassOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(8,4)-(11,0)]" + }, { "@id": "http://a.ml/vocabularies/test2#A/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test2#A", "http://a.ml/vocabularies/document-source-maps#value": "[(11,2)-(14,0)]" }, { - "@id": "http://a.ml/vocabularies/test2#B/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test2#B/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test2#B", "http://a.ml/vocabularies/document-source-maps#value": "[(14,2)-(18,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test2#B/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subClassOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(17,4)-(18,0)]" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example4.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example4.expanded.jsonld index 7af616f9..123b450f 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example4.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example4.expanded.jsonld @@ -166,8 +166,34 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test4#c/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(13,4)-(14,0)]" + } + ] + }, { "@id": "http://a.ml/vocabularies/test4#c/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(10,4)-(13,0)]" + } + ] + }, + { + "@id": "http://a.ml/vocabularies/test4#c/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test4#c" @@ -213,7 +239,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test4#a/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test4#a/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test4#a" @@ -224,6 +250,19 @@ "@value": "[(14,2)-(18,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test4#a/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(17,4)-(18,0)]" + } + ] } ] } @@ -263,8 +302,34 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test4#b/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(22,4)-(23,0)]" + } + ] + }, { "@id": "http://a.ml/vocabularies/test4#b/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(21,4)-(22,0)]" + } + ] + }, + { + "@id": "http://a.ml/vocabularies/test4#b/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test4#b" @@ -310,7 +375,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test4#d/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test4#d/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test4#d" @@ -321,6 +386,19 @@ "@value": "[(23,2)-(27,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test4#d/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(26,4)-(27,0)]" + } + ] } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example4.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example4.flattened.jsonld index c36226b6..90a74391 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example4.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example4.flattened.jsonld @@ -185,8 +185,14 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test4#c/source-map/lexical/element_2" + }, { "@id": "http://a.ml/vocabularies/test4#c/source-map/lexical/element_0" + }, + { + "@id": "http://a.ml/vocabularies/test4#c/source-map/lexical/element_1" } ] }, @@ -196,6 +202,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test4#a/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test4#a/source-map/lexical/element_0" } @@ -207,8 +216,14 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test4#b/source-map/lexical/element_2" + }, { "@id": "http://a.ml/vocabularies/test4#b/source-map/lexical/element_0" + }, + { + "@id": "http://a.ml/vocabularies/test4#b/source-map/lexical/element_1" } ] }, @@ -218,6 +233,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test4#d/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test4#d/source-map/lexical/element_0" } @@ -243,25 +261,55 @@ "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test4#D", "http://a.ml/vocabularies/document-source-maps#value": "[(5,2)-(6,0)]" }, + { + "@id": "http://a.ml/vocabularies/test4#c/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(13,4)-(14,0)]" + }, { "@id": "http://a.ml/vocabularies/test4#c/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(10,4)-(13,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test4#c/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test4#c", "http://a.ml/vocabularies/document-source-maps#value": "[(7,2)-(14,0)]" }, { - "@id": "http://a.ml/vocabularies/test4#a/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test4#a/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test4#a", "http://a.ml/vocabularies/document-source-maps#value": "[(14,2)-(18,0)]" }, + { + "@id": "http://a.ml/vocabularies/test4#a/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(17,4)-(18,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test4#b/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(22,4)-(23,0)]" + }, { "@id": "http://a.ml/vocabularies/test4#b/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(21,4)-(22,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test4#b/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test4#b", "http://a.ml/vocabularies/document-source-maps#value": "[(18,2)-(23,0)]" }, { - "@id": "http://a.ml/vocabularies/test4#d/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test4#d/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test4#d", "http://a.ml/vocabularies/document-source-maps#value": "[(23,2)-(27,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test4#d/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(26,4)-(27,0)]" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example5.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example5.expanded.jsonld index 5a1b67ff..9b1d45af 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example5.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example5.expanded.jsonld @@ -138,7 +138,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test5#D/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test5#D/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test5#D" @@ -149,6 +149,19 @@ "@value": "[(7,2)-(9,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test5#D/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(8,4)-(9,0)]" + } + ] } ] } @@ -188,8 +201,34 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test5#c/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(14,4)-(15,0)]" + } + ] + }, { "@id": "http://a.ml/vocabularies/test5#c/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(13,4)-(14,0)]" + } + ] + }, + { + "@id": "http://a.ml/vocabularies/test5#c/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test5#c" @@ -235,7 +274,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test5#d/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test5#d/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test5#d" @@ -246,6 +285,19 @@ "@value": "[(15,2)-(19,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test5#d/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(18,4)-(19,0)]" + } + ] } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example5.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example5.flattened.jsonld index b469f579..37398e77 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example5.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example5.flattened.jsonld @@ -140,6 +140,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test5#D/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test5#D/source-map/lexical/element_0" } @@ -151,8 +154,14 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test5#c/source-map/lexical/element_2" + }, { "@id": "http://a.ml/vocabularies/test5#c/source-map/lexical/element_0" + }, + { + "@id": "http://a.ml/vocabularies/test5#c/source-map/lexical/element_1" } ] }, @@ -162,6 +171,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test5#d/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test5#d/source-map/lexical/element_0" } @@ -183,19 +195,39 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(19,0)]" }, { - "@id": "http://a.ml/vocabularies/test5#D/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test5#D/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test5#D", "http://a.ml/vocabularies/document-source-maps#value": "[(7,2)-(9,0)]" }, + { + "@id": "http://a.ml/vocabularies/test5#D/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subClassOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(8,4)-(9,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test5#c/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(14,4)-(15,0)]" + }, { "@id": "http://a.ml/vocabularies/test5#c/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(13,4)-(14,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test5#c/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test5#c", "http://a.ml/vocabularies/document-source-maps#value": "[(10,2)-(15,0)]" }, { - "@id": "http://a.ml/vocabularies/test5#d/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test5#d/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test5#d", "http://a.ml/vocabularies/document-source-maps#value": "[(15,2)-(19,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test5#d/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(18,4)-(19,0)]" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example6.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example6.expanded.jsonld index e937dfca..7fadce9c 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example6.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example6.expanded.jsonld @@ -168,7 +168,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test2#C/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test2#C/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test2#C" @@ -179,6 +179,19 @@ "@value": "[(5,2)-(11,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test2#C/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(8,4)-(11,0)]" + } + ] } ] } @@ -263,7 +276,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test2#B/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test2#B/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test2#B" @@ -274,6 +287,19 @@ "@value": "[(14,2)-(18,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test2#B/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(17,4)-(18,0)]" + } + ] } ] } @@ -319,6 +345,21 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example3.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#declares" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], "http://a.ml/vocabularies/document-source-maps#aliases-array": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example3.yaml#/source-map/aliases-array/element_0", @@ -404,7 +445,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test6#D/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test6#D/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test6#D" @@ -415,6 +456,19 @@ "@value": "[(7,2)-(9,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test6#D/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(8,4)-(9,0)]" + } + ] } ] } @@ -450,7 +504,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test6#d/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test6#d/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test6#d" @@ -461,6 +515,19 @@ "@value": "[(10,2)-(14,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test6#d/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(13,4)-(14,0)]" + } + ] } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example6.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example6.flattened.jsonld index 668f4b7e..7fe3121c 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example6.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example6.flattened.jsonld @@ -213,6 +213,11 @@ "@type": [ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example3.yaml#/source-map/virtual-element/element_0" + } + ], "http://a.ml/vocabularies/document-source-maps#aliases-array": [ { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example3.yaml#/source-map/aliases-array/element_0" @@ -236,6 +241,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test6#D/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test6#D/source-map/lexical/element_0" } @@ -247,6 +255,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test6#d/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test6#d/source-map/lexical/element_0" } @@ -273,6 +284,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test2#C/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test2#C/source-map/lexical/element_0" } @@ -295,11 +309,19 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test2#B/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test2#B/source-map/lexical/element_0" } ] }, + { + "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example3.yaml#/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#declares", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, { "@id": "file://amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example3.yaml#/source-map/aliases-array/element_0", "http://a.ml/vocabularies/document-source-maps#element": "file://amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example3.yaml", @@ -321,29 +343,49 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(18,0)]" }, { - "@id": "http://a.ml/vocabularies/test6#D/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test6#D/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test6#D", "http://a.ml/vocabularies/document-source-maps#value": "[(7,2)-(9,0)]" }, { - "@id": "http://a.ml/vocabularies/test6#d/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test6#D/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subClassOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(8,4)-(9,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test6#d/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test6#d", "http://a.ml/vocabularies/document-source-maps#value": "[(10,2)-(14,0)]" }, { - "@id": "http://a.ml/vocabularies/test2#C/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test6#d/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(13,4)-(14,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test2#C/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test2#C", "http://a.ml/vocabularies/document-source-maps#value": "[(5,2)-(11,0)]" }, + { + "@id": "http://a.ml/vocabularies/test2#C/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subClassOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(8,4)-(11,0)]" + }, { "@id": "http://a.ml/vocabularies/test2#A/source-map/lexical/element_0", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test2#A", "http://a.ml/vocabularies/document-source-maps#value": "[(11,2)-(14,0)]" }, { - "@id": "http://a.ml/vocabularies/test2#B/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test2#B/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test2#B", "http://a.ml/vocabularies/document-source-maps#value": "[(14,2)-(18,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test2#B/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subClassOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(17,4)-(18,0)]" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example7.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example7.expanded.jsonld index 285a9658..ee3ffca3 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example7.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example7.expanded.jsonld @@ -114,7 +114,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test7#any/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#any/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test7#any" @@ -125,6 +125,19 @@ "@value": "[(5,2)-(7,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test7#any/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(6,4)-(7,0)]" + } + ] } ] } @@ -150,7 +163,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test7#guid/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#guid/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test7#guid" @@ -161,6 +174,19 @@ "@value": "[(7,2)-(9,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test7#guid/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(8,4)-(9,0)]" + } + ] } ] } @@ -186,7 +212,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test7#float/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#float/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test7#float" @@ -197,6 +223,19 @@ "@value": "[(9,2)-(11,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test7#float/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(10,4)-(11,0)]" + } + ] } ] } @@ -222,7 +261,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test7#uri/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#uri/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test7#uri" @@ -233,6 +272,19 @@ "@value": "[(11,2)-(13,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test7#uri/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(12,4)-(13,0)]" + } + ] } ] } @@ -258,7 +310,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test7#string/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#string/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test7#string" @@ -269,6 +321,19 @@ "@value": "[(13,2)-(15,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test7#string/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(14,4)-(15,0)]" + } + ] } ] } @@ -294,7 +359,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test7#dateTime/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#dateTime/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test7#dateTime" @@ -305,6 +370,19 @@ "@value": "[(15,2)-(17,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test7#dateTime/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(16,4)-(17,0)]" + } + ] } ] } @@ -330,7 +408,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test7#double/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#double/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test7#double" @@ -341,6 +419,19 @@ "@value": "[(17,2)-(19,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test7#double/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(18,4)-(19,0)]" + } + ] } ] } @@ -366,7 +457,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test7#long/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#long/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test7#long" @@ -377,6 +468,19 @@ "@value": "[(19,2)-(21,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test7#long/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(20,4)-(21,0)]" + } + ] } ] } @@ -402,7 +506,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test7#boolean/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#boolean/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test7#boolean" @@ -413,6 +517,19 @@ "@value": "[(21,2)-(23,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test7#boolean/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(22,4)-(23,0)]" + } + ] } ] } @@ -438,7 +555,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test7#date/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#date/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test7#date" @@ -449,6 +566,19 @@ "@value": "[(23,2)-(25,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test7#date/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(24,4)-(25,0)]" + } + ] } ] } @@ -474,7 +604,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test7#integer/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#integer/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test7#integer" @@ -485,6 +615,19 @@ "@value": "[(25,2)-(27,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test7#integer/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(26,4)-(27,0)]" + } + ] } ] } @@ -510,7 +653,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test7#time/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#time/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test7#time" @@ -521,6 +664,19 @@ "@value": "[(27,2)-(29,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test7#time/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(28,4)-(29,0)]" + } + ] } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example7.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example7.flattened.jsonld index a3e1a9fc..4789cde9 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example7.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example7.flattened.jsonld @@ -305,6 +305,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test7#any/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test7#any/source-map/lexical/element_0" } @@ -316,6 +319,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test7#guid/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test7#guid/source-map/lexical/element_0" } @@ -327,6 +333,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test7#float/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test7#float/source-map/lexical/element_0" } @@ -338,6 +347,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test7#uri/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test7#uri/source-map/lexical/element_0" } @@ -349,6 +361,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test7#string/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test7#string/source-map/lexical/element_0" } @@ -360,6 +375,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test7#dateTime/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test7#dateTime/source-map/lexical/element_0" } @@ -371,6 +389,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test7#double/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test7#double/source-map/lexical/element_0" } @@ -382,6 +403,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test7#long/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test7#long/source-map/lexical/element_0" } @@ -393,6 +417,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test7#boolean/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test7#boolean/source-map/lexical/element_0" } @@ -404,6 +431,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test7#date/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test7#date/source-map/lexical/element_0" } @@ -415,6 +445,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test7#integer/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test7#integer/source-map/lexical/element_0" } @@ -426,6 +459,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test7#time/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test7#time/source-map/lexical/element_0" } @@ -447,64 +483,124 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(29,0)]" }, { - "@id": "http://a.ml/vocabularies/test7#any/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#any/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test7#any", "http://a.ml/vocabularies/document-source-maps#value": "[(5,2)-(7,0)]" }, { - "@id": "http://a.ml/vocabularies/test7#guid/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#any/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(6,4)-(7,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test7#guid/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test7#guid", "http://a.ml/vocabularies/document-source-maps#value": "[(7,2)-(9,0)]" }, { - "@id": "http://a.ml/vocabularies/test7#float/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#guid/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(8,4)-(9,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test7#float/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test7#float", "http://a.ml/vocabularies/document-source-maps#value": "[(9,2)-(11,0)]" }, { - "@id": "http://a.ml/vocabularies/test7#uri/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#float/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(10,4)-(11,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test7#uri/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test7#uri", "http://a.ml/vocabularies/document-source-maps#value": "[(11,2)-(13,0)]" }, { - "@id": "http://a.ml/vocabularies/test7#string/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#uri/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(12,4)-(13,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test7#string/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test7#string", "http://a.ml/vocabularies/document-source-maps#value": "[(13,2)-(15,0)]" }, { - "@id": "http://a.ml/vocabularies/test7#dateTime/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#string/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(14,4)-(15,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test7#dateTime/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test7#dateTime", "http://a.ml/vocabularies/document-source-maps#value": "[(15,2)-(17,0)]" }, { - "@id": "http://a.ml/vocabularies/test7#double/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#dateTime/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(16,4)-(17,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test7#double/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test7#double", "http://a.ml/vocabularies/document-source-maps#value": "[(17,2)-(19,0)]" }, { - "@id": "http://a.ml/vocabularies/test7#long/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#double/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(18,4)-(19,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test7#long/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test7#long", "http://a.ml/vocabularies/document-source-maps#value": "[(19,2)-(21,0)]" }, { - "@id": "http://a.ml/vocabularies/test7#boolean/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#long/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(20,4)-(21,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test7#boolean/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test7#boolean", "http://a.ml/vocabularies/document-source-maps#value": "[(21,2)-(23,0)]" }, { - "@id": "http://a.ml/vocabularies/test7#date/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#boolean/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(22,4)-(23,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test7#date/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test7#date", "http://a.ml/vocabularies/document-source-maps#value": "[(23,2)-(25,0)]" }, { - "@id": "http://a.ml/vocabularies/test7#integer/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#date/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(24,4)-(25,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test7#integer/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test7#integer", "http://a.ml/vocabularies/document-source-maps#value": "[(25,2)-(27,0)]" }, { - "@id": "http://a.ml/vocabularies/test7#time/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test7#integer/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(26,4)-(27,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test7#time/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test7#time", "http://a.ml/vocabularies/document-source-maps#value": "[(27,2)-(29,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test7#time/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(28,4)-(29,0)]" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example8.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example8.expanded.jsonld index 82f1cd0d..7de3fae9 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example8.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example8.expanded.jsonld @@ -114,7 +114,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test8#emptyExtend/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test8#emptyExtend/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test8#emptyExtend" @@ -125,6 +125,19 @@ "@value": "[(9,2)-(10,12)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test8#emptyExtend/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(10,4)-(10,12)]" + } + ] } ] } @@ -146,7 +159,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test8#emptyExtends/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test8#emptyExtends/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test8#emptyExtends" @@ -157,6 +170,19 @@ "@value": "[(5,2)-(8,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test8#emptyExtends/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(6,4)-(8,0)]" + } + ] } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example8.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example8.flattened.jsonld index b7a03042..c75288d7 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example8.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/example8.flattened.jsonld @@ -87,6 +87,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test8#emptyExtend/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test8#emptyExtend/source-map/lexical/element_0" } @@ -98,6 +101,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test8#emptyExtends/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test8#emptyExtends/source-map/lexical/element_0" } @@ -119,14 +125,24 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(2,0)-(10,12)]" }, { - "@id": "http://a.ml/vocabularies/test8#emptyExtend/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test8#emptyExtend/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test8#emptyExtend", "http://a.ml/vocabularies/document-source-maps#value": "[(9,2)-(10,12)]" }, { - "@id": "http://a.ml/vocabularies/test8#emptyExtends/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test8#emptyExtend/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subClassOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(10,4)-(10,12)]" + }, + { + "@id": "http://a.ml/vocabularies/test8#emptyExtends/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test8#emptyExtends", "http://a.ml/vocabularies/document-source-maps#value": "[(5,2)-(8,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test8#emptyExtends/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(6,4)-(8,0)]" } ] } diff --git a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/json/vocabulary.json b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/json/vocabulary.json new file mode 100644 index 00000000..d6dac340 --- /dev/null +++ b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/json/vocabulary.json @@ -0,0 +1,22 @@ +{ + "$type": "Vocabulary 1.0", + "base": "http://myvocabulary.org#", + "vocabulary": "My Vocabulary", + "usage": "Example vocabulary", + "classTerms": { + "MyClass": { + "displayName": "My Class", + "description": "Some class", + "properties": [ + "myProperty" + ] + } + }, + "propertyTerms": { + "myProperty": { + "displayName": "My Property", + "description": "Some property", + "range": "string" + } + } +} diff --git a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/multiple-extends/vocabulary.expanded.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/multiple-extends/vocabulary.expanded.jsonld index 2445da48..924ff01e 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/multiple-extends/vocabulary.expanded.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/multiple-extends/vocabulary.expanded.jsonld @@ -221,7 +221,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test#ChildClass/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test#ChildClass/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test#ChildClass" @@ -232,6 +232,19 @@ "@value": "[(14,2)-(21,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test#ChildClass/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subClassOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(17,4)-(21,0)]" + } + ] } ] } @@ -267,7 +280,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test#ParentPropA/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test#ParentPropA/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test#ParentPropA" @@ -278,6 +291,19 @@ "@value": "[(22,2)-(27,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test#ParentPropA/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(25,4)-(27,0)]" + } + ] } ] } @@ -313,7 +339,7 @@ ], "http://a.ml/vocabularies/document-source-maps#lexical": [ { - "@id": "http://a.ml/vocabularies/test#ParentPropB/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test#ParentPropB/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test#ParentPropB" @@ -324,6 +350,19 @@ "@value": "[(27,2)-(32,0)]" } ] + }, + { + "@id": "http://a.ml/vocabularies/test#ParentPropB/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(30,4)-(32,0)]" + } + ] } ] } @@ -366,8 +405,34 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test#ChildProp/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#range" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(35,4)-(36,0)]" + } + ] + }, { "@id": "http://a.ml/vocabularies/test#ChildProp/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(36,4)-(39,0)]" + } + ] + }, + { + "@id": "http://a.ml/vocabularies/test#ChildProp/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": [ { "@value": "http://a.ml/vocabularies/test#ChildProp" diff --git a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/multiple-extends/vocabulary.flattened.jsonld b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/multiple-extends/vocabulary.flattened.jsonld index 87bf5469..ecd2a666 100644 --- a/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/multiple-extends/vocabulary.flattened.jsonld +++ b/amf-aml/shared/src/test/resources/vocabularies2/vocabularies/multiple-extends/vocabulary.flattened.jsonld @@ -214,6 +214,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test#ChildClass/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test#ChildClass/source-map/lexical/element_0" } @@ -225,6 +228,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test#ParentPropA/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test#ParentPropA/source-map/lexical/element_0" } @@ -236,6 +242,9 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test#ParentPropB/source-map/lexical/element_1" + }, { "@id": "http://a.ml/vocabularies/test#ParentPropB/source-map/lexical/element_0" } @@ -247,8 +256,14 @@ "http://a.ml/vocabularies/document-source-maps#SourceMap" ], "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "http://a.ml/vocabularies/test#ChildProp/source-map/lexical/element_2" + }, { "@id": "http://a.ml/vocabularies/test#ChildProp/source-map/lexical/element_0" + }, + { + "@id": "http://a.ml/vocabularies/test#ChildProp/source-map/lexical/element_1" } ] }, @@ -278,22 +293,47 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(10,2)-(14,0)]" }, { - "@id": "http://a.ml/vocabularies/test#ChildClass/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test#ChildClass/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test#ChildClass", "http://a.ml/vocabularies/document-source-maps#value": "[(14,2)-(21,0)]" }, { - "@id": "http://a.ml/vocabularies/test#ParentPropA/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test#ChildClass/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subClassOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(17,4)-(21,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test#ParentPropA/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test#ParentPropA", "http://a.ml/vocabularies/document-source-maps#value": "[(22,2)-(27,0)]" }, { - "@id": "http://a.ml/vocabularies/test#ParentPropB/source-map/lexical/element_0", + "@id": "http://a.ml/vocabularies/test#ParentPropA/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(25,4)-(27,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test#ParentPropB/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test#ParentPropB", "http://a.ml/vocabularies/document-source-maps#value": "[(27,2)-(32,0)]" }, + { + "@id": "http://a.ml/vocabularies/test#ParentPropB/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(30,4)-(32,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test#ChildProp/source-map/lexical/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#range", + "http://a.ml/vocabularies/document-source-maps#value": "[(35,4)-(36,0)]" + }, { "@id": "http://a.ml/vocabularies/test#ChildProp/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", + "http://a.ml/vocabularies/document-source-maps#value": "[(36,4)-(39,0)]" + }, + { + "@id": "http://a.ml/vocabularies/test#ChildProp/source-map/lexical/element_1", "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/test#ChildProp", "http://a.ml/vocabularies/document-source-maps#value": "[(32,2)-(39,0)]" } diff --git a/amf-aml/shared/src/test/scala/amf/core/common/AsyncFunSuiteWithPlatformGlobalExecutionContext.scala b/amf-aml/shared/src/test/scala/amf/core/common/AsyncFunSuiteWithPlatformGlobalExecutionContext.scala new file mode 100644 index 00000000..84b6405e --- /dev/null +++ b/amf-aml/shared/src/test/scala/amf/core/common/AsyncFunSuiteWithPlatformGlobalExecutionContext.scala @@ -0,0 +1,10 @@ +package amf.core.common + +import amf.core.internal.unsafe.PlatformSecrets +import org.scalatest.funsuite.AsyncFunSuite + +import scala.concurrent.ExecutionContext + +trait AsyncFunSuiteWithPlatformGlobalExecutionContext extends AsyncFunSuite with PlatformSecrets { + override implicit def executionContext: ExecutionContext = platform.globalExecutionContext +} diff --git a/amf-aml/shared/src/test/scala/amf/core/io/FileAssertionTest.scala b/amf-aml/shared/src/test/scala/amf/core/io/FileAssertionTest.scala index 7196365a..ac2deb31 100644 --- a/amf-aml/shared/src/test/scala/amf/core/io/FileAssertionTest.scala +++ b/amf-aml/shared/src/test/scala/amf/core/io/FileAssertionTest.scala @@ -1,15 +1,13 @@ package amf.core.io -import amf.core.internal.unsafe.PlatformSecrets +import amf.core.common.AsyncFunSuiteWithPlatformGlobalExecutionContext import org.mulesoft.common.io.{AsyncFile, FileSystem} import org.mulesoft.common.test.Tests.checkDiff import org.scalatest.Assertion -import scala.concurrent.{ExecutionContext, Future} +import scala.concurrent.Future -trait FileAssertionTest extends PlatformSecrets { - - private implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global +trait FileAssertionTest extends AsyncFunSuiteWithPlatformGlobalExecutionContext { protected val fs: FileSystem = platform.fs diff --git a/amf-aml/shared/src/test/scala/amf/testing/common/cycling/BuildCycleRdfTests.scala b/amf-aml/shared/src/test/scala/amf/testing/common/cycling/BuildCycleRdfTests.scala index 3379798b..11ef60f6 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/common/cycling/BuildCycleRdfTests.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/common/cycling/BuildCycleRdfTests.scala @@ -14,13 +14,14 @@ import scala.concurrent.Future trait BuildCycleRdfTests extends BuildCycleTestCommon { - def cycleFullRdf(source: String, - golden: String, - directory: String = basePath, - amlConfig: AMLConfiguration = - AMLConfiguration.predefined().withErrorHandlerProvider(() => UnhandledErrorHandler), - syntax: Option[Syntax] = None, - pipeline: Option[String] = None): Future[Assertion] = { + def cycleFullRdf( + source: String, + golden: String, + directory: String = basePath, + amlConfig: AMLConfiguration = AMLConfiguration.predefined().withErrorHandlerProvider(() => UnhandledErrorHandler), + syntax: Option[Syntax] = None, + pipeline: Option[String] = None + ): Future[Assertion] = { val config = CycleConfig(source, golden, directory, syntax, pipeline, None) @@ -34,13 +35,15 @@ trait BuildCycleRdfTests extends BuildCycleTestCommon { } /** Compile source with specified hint. Render to temporary file and assert against golden. */ - def cycleRdf(source: String, - golden: String, - amlConfig: AMLConfiguration, - directory: String = basePath, - syntax: Option[Syntax] = None, - pipeline: Option[String] = None, - transformWith: Option[Spec] = None): Future[Assertion] = { + def cycleRdf( + source: String, + golden: String, + amlConfig: AMLConfiguration, + directory: String = basePath, + syntax: Option[Syntax] = None, + pipeline: Option[String] = None, + transformWith: Option[Spec] = None + ): Future[Assertion] = { val config = CycleConfig(source, golden, directory, syntax, pipeline, transformWith) diff --git a/amf-aml/shared/src/test/scala/amf/testing/common/cycling/BuildCycleTestCommon.scala b/amf-aml/shared/src/test/scala/amf/testing/common/cycling/BuildCycleTestCommon.scala index 6dc1de00..b7d60d09 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/common/cycling/BuildCycleTestCommon.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/common/cycling/BuildCycleTestCommon.scala @@ -2,27 +2,27 @@ package amf.testing.common.cycling import amf.aml.client.scala.AMLConfiguration import amf.core.client.scala.AMFGraphConfiguration -import amf.core.io.FileAssertionTest import amf.core.client.scala.model.document.BaseUnit -import amf.core.internal.remote.Syntax.Syntax -import amf.core.internal.remote.{Hint, Spec} import amf.core.internal.parser.{AMFCompiler, CompilerContextBuilder} +import amf.core.internal.remote.Spec +import amf.core.internal.remote.Syntax.Syntax +import amf.core.io.FileAssertionTest import amf.testing.common.utils.AMFRenderer -import scala.concurrent.{ExecutionContext, Future} +import scala.concurrent.Future trait BuildCycleTestCommon extends FileAssertionTest { - implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global - def basePath: String - case class CycleConfig(source: String, - golden: String, - directory: String = basePath, - syntax: Option[Syntax] = None, - pipeline: Option[String] = None, - transformWith: Option[Spec] = None) { + case class CycleConfig( + source: String, + golden: String, + directory: String = basePath, + syntax: Option[Syntax] = None, + pipeline: Option[String] = None, + transformWith: Option[Spec] = None + ) { val sourcePath: String = directory + source val goldenPath: String = directory + golden } diff --git a/amf-aml/shared/src/test/scala/amf/testing/common/cycling/BuildCycleTests.scala b/amf-aml/shared/src/test/scala/amf/testing/common/cycling/BuildCycleTests.scala index 2027012e..fd42084b 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/common/cycling/BuildCycleTests.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/common/cycling/BuildCycleTests.scala @@ -28,21 +28,18 @@ trait BuildCycleTests extends BuildCycleTestCommon { /** Compile source with specified hint. Dump to target and assert against same source file. */ def cycle(source: String, golden: String, directory: String, eh: AMFErrorHandler): Future[Assertion] = - cycle(source, - golden, - None, - directory, - amlConfig = AMLConfiguration.predefined().withErrorHandlerProvider(() => eh)) + cycle(source, golden, None, directory, amlConfig = AMLConfiguration.predefined().withErrorHandlerProvider(() => eh)) /** Compile source with specified hint. Render to temporary file and assert against golden. */ - final def cycle(source: String, - golden: String, - syntax: Option[Syntax], - directory: String = basePath, - amlConfig: AMLConfiguration = - AMLConfiguration.predefined().withErrorHandlerProvider(() => UnhandledErrorHandler), - pipeline: Option[String] = None, - transformWith: Option[Spec] = None): Future[Assertion] = { + final def cycle( + source: String, + golden: String, + syntax: Option[Syntax], + directory: String = basePath, + amlConfig: AMLConfiguration = AMLConfiguration.predefined().withErrorHandlerProvider(() => UnhandledErrorHandler), + pipeline: Option[String] = None, + transformWith: Option[Spec] = None + ): Future[Assertion] = { val config = CycleConfig(source, golden, directory, syntax, pipeline, transformWith) diff --git a/amf-aml/shared/src/test/scala/amf/testing/common/cycling/FunSuiteCycleTests.scala b/amf-aml/shared/src/test/scala/amf/testing/common/cycling/FunSuiteCycleTests.scala index 19ad375e..3e50f3bd 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/common/cycling/FunSuiteCycleTests.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/common/cycling/FunSuiteCycleTests.scala @@ -2,8 +2,4 @@ package amf.testing.common.cycling import amf.testing.common.jsonld.MultiJsonLDAsyncFunSuite -import scala.concurrent.ExecutionContext - -abstract class FunSuiteCycleTests extends MultiJsonLDAsyncFunSuite with BuildCycleTests { - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global -} +abstract class FunSuiteCycleTests extends MultiJsonLDAsyncFunSuite with BuildCycleTests {} diff --git a/amf-aml/shared/src/test/scala/amf/testing/common/cycling/FunSuiteRdfCycleTests.scala b/amf-aml/shared/src/test/scala/amf/testing/common/cycling/FunSuiteRdfCycleTests.scala index 59ea437d..bf9ade9e 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/common/cycling/FunSuiteRdfCycleTests.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/common/cycling/FunSuiteRdfCycleTests.scala @@ -2,8 +2,4 @@ package amf.testing.common.cycling import amf.testing.common.jsonld.MultiJsonLDAsyncFunSuite -import scala.concurrent.ExecutionContext - -abstract class FunSuiteRdfCycleTests extends MultiJsonLDAsyncFunSuite with BuildCycleRdfTests { - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global -} +abstract class FunSuiteRdfCycleTests extends MultiJsonLDAsyncFunSuite with BuildCycleRdfTests {} diff --git a/amf-aml/shared/src/test/scala/amf/testing/common/jsonld/MultiJsonLDAsyncFunSuite.scala b/amf-aml/shared/src/test/scala/amf/testing/common/jsonld/MultiJsonLDAsyncFunSuite.scala index 1e6f2dc2..a290aed6 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/common/jsonld/MultiJsonLDAsyncFunSuite.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/common/jsonld/MultiJsonLDAsyncFunSuite.scala @@ -1,17 +1,17 @@ package amf.testing.common.jsonld import amf.core.client.scala.config.RenderOptions +import amf.core.common.AsyncFunSuiteWithPlatformGlobalExecutionContext import amf.core.internal.plugins.document.graph.{EmbeddedForm, FlattenedForm, JsonLdDocumentForm} import amf.testing.common.jsonld import org.scalactic.Fail -import org.scalatest.{Assertion, AsyncFunSuite} +import org.scalatest.Assertion import scala.concurrent.Future -/** - * Cycle tests using temporary file and directory creator +/** Cycle tests using temporary file and directory creator */ -abstract class MultiJsonLDAsyncFunSuite extends AsyncFunSuite { +abstract class MultiJsonLDAsyncFunSuite extends AsyncFunSuiteWithPlatformGlobalExecutionContext { def testedForms: Seq[JsonLdDocumentForm] = Seq(FlattenedForm, EmbeddedForm) def defaultRenderOptions: RenderOptions = RenderOptions() @@ -33,7 +33,8 @@ abstract class MultiJsonLDAsyncFunSuite extends AsyncFunSuite { // Single source, multiple JSON-LD outputs def multiGoldenTest(testText: String, goldenNamePattern: String)( - testFn: WithJsonLDGoldenConfig => Future[Assertion]): Unit = { + testFn: WithJsonLDGoldenConfig => Future[Assertion] + ): Unit = { testedForms.foreach { form => validatePattern(goldenNamePattern, "goldenNamePattern") val golden = goldenNamePattern.format(form.extension) @@ -44,7 +45,8 @@ abstract class MultiJsonLDAsyncFunSuite extends AsyncFunSuite { // Multiple JSON-LD sources, single output def multiSourceTest(testText: String, sourceNamePattern: String)( - testFn: WithJsonLDSourceConfig => Future[Assertion]): Unit = { + testFn: WithJsonLDSourceConfig => Future[Assertion] + ): Unit = { testedForms.foreach { form => validatePattern(sourceNamePattern, "sourceNamePattern") val source = sourceNamePattern.format(form.extension) @@ -55,7 +57,8 @@ abstract class MultiJsonLDAsyncFunSuite extends AsyncFunSuite { // Multiple JSON-LD sources, multiple JSON-LD outputs. Each source matches exactly one output def multiTest(testText: String, sourceNamePattern: String, goldenNamePattern: String)( - testFn: WithJsonLDGoldenAndSourceConfig => Future[Assertion]): Unit = { + testFn: WithJsonLDGoldenAndSourceConfig => Future[Assertion] + ): Unit = { testedForms.foreach { form => validatePattern(sourceNamePattern, "sourceNamePattern") validatePattern(goldenNamePattern, "goldenNamePattern") diff --git a/amf-aml/shared/src/test/scala/amf/testing/common/jsonld/WithJsonLDGoldenAndSourceConfig.scala b/amf-aml/shared/src/test/scala/amf/testing/common/jsonld/WithJsonLDGoldenAndSourceConfig.scala index 6ecead98..3654dce3 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/common/jsonld/WithJsonLDGoldenAndSourceConfig.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/common/jsonld/WithJsonLDGoldenAndSourceConfig.scala @@ -3,8 +3,9 @@ package amf.testing.common.jsonld import amf.core.client.scala.config.RenderOptions import amf.core.internal.plugins.document.graph.JsonLdDocumentForm -case class WithJsonLDGoldenAndSourceConfig(source: String, - golden: String, - renderOptions: RenderOptions, - jsonLdDocumentForm: JsonLdDocumentForm) - extends WithJsonLDConfig(jsonLdDocumentForm) +case class WithJsonLDGoldenAndSourceConfig( + source: String, + golden: String, + renderOptions: RenderOptions, + jsonLdDocumentForm: JsonLdDocumentForm +) extends WithJsonLDConfig(jsonLdDocumentForm) diff --git a/amf-aml/shared/src/test/scala/amf/testing/common/utils/AMLParsingHelper.scala b/amf-aml/shared/src/test/scala/amf/testing/common/utils/AMLParsingHelper.scala index c5569b98..8672778f 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/common/utils/AMLParsingHelper.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/common/utils/AMLParsingHelper.scala @@ -9,13 +9,15 @@ import scala.concurrent.{ExecutionContext, Future} trait AMLParsingHelper { - final def parse(uri: String, platform: Platform, configuration: AMLConfiguration)( - implicit ec: ExecutionContext): Future[BaseUnit] = + final def parse(uri: String, platform: Platform, configuration: AMLConfiguration)(implicit + ec: ExecutionContext + ): Future[BaseUnit] = new AMFCompiler(new CompilerContextBuilder(uri, platform, configuration.compilerConfiguration).build()) .build() - final def parse(uri: String, platform: Platform, spec: Option[String], configuration: AMLConfiguration)( - implicit ec: ExecutionContext): Future[BaseUnit] = + final def parse(uri: String, platform: Platform, spec: Option[String], configuration: AMLConfiguration)(implicit + ec: ExecutionContext + ): Future[BaseUnit] = new AMFCompiler(new CompilerContextBuilder(uri, platform, configuration.compilerConfiguration).build()) .build() diff --git a/amf-aml/shared/src/test/scala/amf/testing/common/utils/DialectInstanceTester.scala b/amf-aml/shared/src/test/scala/amf/testing/common/utils/DialectInstanceTester.scala index 37aa50af..c951ede1 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/common/utils/DialectInstanceTester.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/common/utils/DialectInstanceTester.scala @@ -2,7 +2,6 @@ package amf.testing.common.utils import amf.core.client.scala.config.RenderOptions import amf.core.internal.remote.Syntax.Syntax -import amf.core.internal.remote.{Hint, Spec} import amf.testing.common.cycling.FunSuiteCycleTests import org.scalatest.Assertion @@ -10,17 +9,19 @@ import scala.concurrent.Future trait DialectInstanceTester extends DialectRegistrationHelper { this: FunSuiteCycleTests => - protected def cycleWithDialect(dialect: String, - source: String, - golden: String, - syntax: Option[Syntax], - directory: String = basePath, - renderOptions: Option[RenderOptions] = None): Future[Assertion] = { + protected def cycleWithDialect( + dialect: String, + source: String, + golden: String, + syntax: Option[Syntax], + directory: String = basePath, + renderOptions: Option[RenderOptions] = None + ): Future[Assertion] = { withDialect(s"file://$directory/$dialect") { (_, config) => val configuration = renderOptions.fold( - config.withRenderOptions(RenderOptions().withSourceMaps.withPrettyPrint.withoutFlattenedJsonLd))(r => - config.withRenderOptions(r)) + config.withRenderOptions(RenderOptions().withSourceMaps.withPrettyPrint.withoutFlattenedJsonLd) + )(r => config.withRenderOptions(r)) cycle(source, golden, syntax, directory, configuration) } } diff --git a/amf-aml/shared/src/test/scala/amf/testing/common/utils/DialectInstanceValidation.scala b/amf-aml/shared/src/test/scala/amf/testing/common/utils/DialectInstanceValidation.scala index e3b1085c..b6238494 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/common/utils/DialectInstanceValidation.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/common/utils/DialectInstanceValidation.scala @@ -2,29 +2,29 @@ package amf.testing.common.utils import amf.aml.client.scala.AMLConfiguration import amf.core.client.scala.validation.AMFValidationReport -import amf.core.internal.unsafe.PlatformSecrets -import org.scalatest.AsyncFunSuite +import amf.core.common.AsyncFunSuiteWithPlatformGlobalExecutionContext import scala.concurrent.Future trait DialectInstanceValidation - extends AsyncFunSuite - with PlatformSecrets + extends AsyncFunSuiteWithPlatformGlobalExecutionContext with DialectRegistrationHelper with AMLParsingHelper { def basePath: String - protected def validation(dialect: String, - instance: String, - path: String = basePath, - config: AMLConfiguration = AMLConfiguration.predefined()): Future[AMFValidationReport] = { + protected def validation( + dialect: String, + instance: String, + path: String = basePath, + config: AMLConfiguration = AMLConfiguration.predefined() + ): Future[AMFValidationReport] = { val dialectPath = s"$path/$dialect" val instancePath = s"$path/$instance" val client = config.baseUnitClient() for { - dialectResult <- client.parseDialect(s"$path/$dialect") - nextConfig <- Future.successful(config.withDialect(dialectResult.dialect)) + dialectResult <- client.parseDialect(dialectPath) + nextConfig = config.withDialect(dialectResult.dialect) instanceResult <- nextConfig.baseUnitClient().parseDialectInstance(instancePath) report <- { if (!instanceResult.conforms) Future.successful(AMFValidationReport.unknownProfile(instanceResult)) diff --git a/amf-aml/shared/src/test/scala/amf/testing/common/utils/DialectRegistrationHelper.scala b/amf-aml/shared/src/test/scala/amf/testing/common/utils/DialectRegistrationHelper.scala index 85cc5952..4defe376 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/common/utils/DialectRegistrationHelper.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/common/utils/DialectRegistrationHelper.scala @@ -6,25 +6,24 @@ import amf.aml.internal.transform.pipelines.DialectTransformationPipeline import amf.core.client.scala.errorhandling.DefaultErrorHandler import amf.core.client.scala.transform.TransformationPipelineRunner import amf.core.internal.parser.{AMFCompiler, CompilerContextBuilder} -import amf.core.internal.remote.Aml import amf.core.internal.unsafe.PlatformBuilder.platform import scala.concurrent.{ExecutionContext, Future} trait DialectRegistrationHelper { - protected def withDialect[T](uri: String)(fn: (Dialect, AMLConfiguration) => Future[T])( - implicit ec: ExecutionContext): Future[T] = { + protected def withDialect[T]( + uri: String + )(fn: (Dialect, AMLConfiguration) => Future[T])(implicit ec: ExecutionContext): Future[T] = { val configuration = AMLConfiguration.predefined() val context = new CompilerContextBuilder(uri, platform, configuration.compilerConfiguration).build() for { baseUnit <- new AMFCompiler(context).build() - dialect <- Future.successful { baseUnit.asInstanceOf[Dialect] } - resolved <- Future.successful( - TransformationPipelineRunner(DefaultErrorHandler(), configuration) - .run(dialect, DialectTransformationPipeline()) - .asInstanceOf[Dialect]) - dialectConfig <- Future.successful(configuration.withDialect(resolved)) - result <- fn(resolved, dialectConfig) + dialect = baseUnit.asInstanceOf[Dialect] + resolved = TransformationPipelineRunner(DefaultErrorHandler(), configuration) + .run(dialect, DialectTransformationPipeline()) + .asInstanceOf[Dialect] + dialectConfig = configuration.withDialect(resolved) + result <- fn(resolved, dialectConfig) } yield { result } diff --git a/amf-aml/shared/src/test/scala/amf/testing/common/utils/DialectTests.scala b/amf-aml/shared/src/test/scala/amf/testing/common/utils/DialectTests.scala index 067c0207..e16bbaf7 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/common/utils/DialectTests.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/common/utils/DialectTests.scala @@ -20,13 +20,15 @@ trait DialectTests with DialectRegistrationHelper { val basePath: String - protected def cycleWithDialect(dialect: String, - source: String, - golden: String, - mediaType: Option[String], - directory: String = basePath, - renderOptions: Option[RenderOptions] = None, - baseConfig: AMLConfiguration = AMLConfiguration.predefined()): Future[Assertion] = { + protected def cycleWithDialect( + dialect: String, + source: String, + golden: String, + mediaType: Option[String], + directory: String = basePath, + renderOptions: Option[RenderOptions] = None, + baseConfig: AMLConfiguration = AMLConfiguration.predefined() + ): Future[Assertion] = { withDialect(s"file://$directory/$dialect") { (_, configuration) => val config = renderOptions.fold(configuration)(r => configuration.withRenderOptions(r)) val nextConfig = baseConfig.configurationState().getDialects().foldLeft(config) { (config, dialect) => @@ -52,18 +54,20 @@ trait DialectTests case Amf => `application/ld+json` case Payload => `application/yaml` case Raml10 | Raml08 | Aml => `application/yaml` - case Oas20 | Oas30 => `application/json` + case Oas20 | Oas30 | Oas31 => `application/json` case _ => `text/plain` } } override def defaultRenderOptions: RenderOptions = RenderOptions().withPrettyPrint.withSourceMaps - final def cycle(source: String, - golden: String, - mediaType: Option[String], - amlConfig: AMLConfiguration = AMLConfiguration.predefined(), - directory: String = basePath): Future[Assertion] = { + final def cycle( + source: String, + golden: String, + mediaType: Option[String], + amlConfig: AMLConfiguration = AMLConfiguration.predefined(), + directory: String = basePath + ): Future[Assertion] = { for { b <- parse(s"file://$directory/$source", platform, amlConfig) diff --git a/amf-aml/shared/src/test/scala/amf/testing/common/utils/DialectValidation.scala b/amf-aml/shared/src/test/scala/amf/testing/common/utils/DialectValidation.scala index df0561fd..990db247 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/common/utils/DialectValidation.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/common/utils/DialectValidation.scala @@ -1,30 +1,29 @@ package amf.testing.common.utils import amf.aml.client.scala.AMLConfiguration -import amf.core.client.scala.errorhandling.DefaultErrorHandler -import amf.core.internal.validation.ValidationConfiguration -import amf.core.internal.unsafe.PlatformSecrets import amf.core.client.scala.validation.AMFValidationReport -import amf.core.internal.parser.{AMFCompiler, CompilerContextBuilder} -import amf.aml.client.scala.model.document.Dialect -import org.scalatest.{Assertion, AsyncFunSuite} +import amf.core.common.AsyncFunSuiteWithPlatformGlobalExecutionContext +import org.scalatest.Assertion import scala.concurrent.Future -trait DialectValidation extends AsyncFunSuite with PlatformSecrets { +trait DialectValidation extends AsyncFunSuiteWithPlatformGlobalExecutionContext { protected val path: String protected val reportComparator: ReportComparator = UniquePlatformReportComparator - protected def validate(dialectPath: String, - goldenReport: Option[String], - jsonldReport: Boolean = true, - multiPlatform: Boolean = true): Future[Assertion] = { + protected def validate( + dialectPath: String, + goldenReport: Option[String], + jsonldReport: Boolean = true, + multiPlatform: Boolean = true + ): Future[Assertion] = { val configuration = AMLConfiguration.predefined() val client = configuration.baseUnitClient() for { - report <- client.parseDialect("file://" + path + dialectPath).map(AMFValidationReport.unknownProfile(_)) + parsed <- client.parseDialect("file://" + path + dialectPath) + report <- client.validate(parsed.dialect).map(report => report.merge(AMFValidationReport.unknownProfile(parsed))) assertion <- reportComparator.assertReport(report, goldenReport.map(g => s"$path/$g"), jsonldReport) } yield { assertion diff --git a/amf-aml/shared/src/test/scala/amf/testing/common/utils/DomainElementCycleTests.scala b/amf-aml/shared/src/test/scala/amf/testing/common/utils/DomainElementCycleTests.scala index f7b34264..54969060 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/common/utils/DomainElementCycleTests.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/common/utils/DomainElementCycleTests.scala @@ -1,8 +1,6 @@ package amf.testing.common.utils import amf.aml.client.scala.AMLConfiguration -import amf.aml.client.scala.model.document.DialectInstanceUnit -import amf.aml.internal.render.plugin.AMLDialectInstanceRenderingPlugin import amf.core.client.scala.model.document.BaseUnit import amf.core.client.scala.model.domain.DomainElement import amf.core.client.scala.parse.document.SyamlParsedDocument @@ -10,28 +8,26 @@ import amf.core.internal.plugins.syntax.SyamlSyntaxRenderPlugin import amf.core.internal.remote.Hint import amf.core.internal.remote.Mimes._ import amf.core.io.FileAssertionTest -import org.scalatest.{Assertion, AsyncFunSuite} +import org.scalatest.Assertion import org.yaml.model.{YDocument, YNode} import java.io.StringWriter import scala.concurrent.Future -trait DomainElementCycleTests - extends AsyncFunSuite - with FileAssertionTest - with AMLParsingHelper - with DialectRegistrationHelper { +trait DomainElementCycleTests extends FileAssertionTest with AMLParsingHelper with DialectRegistrationHelper { val basePath: String val baseHint: Hint - protected def renderElement(dialect: String, - source: String, - extractor: BaseUnit => Option[DomainElement], - golden: String, - hint: Hint = baseHint, - directory: String = basePath, - baseConfig: AMLConfiguration = AMLConfiguration.predefined()): Future[Assertion] = { + protected def renderElement( + dialect: String, + source: String, + extractor: BaseUnit => Option[DomainElement], + golden: String, + hint: Hint = baseHint, + directory: String = basePath, + baseConfig: AMLConfiguration = AMLConfiguration.predefined() + ): Future[Assertion] = { withDialect(s"file://$directory/$dialect") { (d, amlConfig) => val nextConfig = baseConfig.configurationState().getDialects().foldLeft(amlConfig) { (config, dialect) => @@ -41,11 +37,13 @@ trait DomainElementCycleTests } } - final def cycleElement(source: String, - extractor: BaseUnit => Option[DomainElement], - golden: String, - amlConfig: AMLConfiguration, - directory: String = basePath): Future[Assertion] = { + final def cycleElement( + source: String, + extractor: BaseUnit => Option[DomainElement], + golden: String, + amlConfig: AMLConfiguration, + directory: String = basePath + ): Future[Assertion] = { for { b <- parse(s"file://$directory/$source", platform, amlConfig) t <- Future.successful { transform(b) } diff --git a/amf-aml/shared/src/test/scala/amf/testing/common/utils/ReportComparator.scala b/amf-aml/shared/src/test/scala/amf/testing/common/utils/ReportComparator.scala index 5549d184..5b2efc0d 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/common/utils/ReportComparator.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/common/utils/ReportComparator.scala @@ -1,20 +1,21 @@ package amf.testing.common.utils -import amf.core.io.FileAssertionTest -import amf.core.internal.unsafe.PlatformSecrets import amf.core.client.scala.validation.AMFValidationReport +import amf.core.internal.unsafe.PlatformSecrets +import amf.core.io.FileAssertionTest import amf.validation.internal.emitters.ValidationReportJSONLDEmitter -import org.scalatest.{Assertion, Matchers} +import org.scalatest.Assertion +import org.scalatest.matchers.should.Matchers -import scala.concurrent.{ExecutionContext, Future} +import scala.concurrent.Future trait ReportComparator extends FileAssertionTest with Matchers { - implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global - - def assertReport(report: AMFValidationReport, - goldenOption: Option[String] = None, - jsonldReport: Boolean = true): Future[Assertion] = { + def assertReport( + report: AMFValidationReport, + goldenOption: Option[String] = None, + jsonldReport: Boolean = true + ): Future[Assertion] = { goldenOption .map(processGoldenPath) .map { golden => @@ -25,7 +26,12 @@ trait ReportComparator extends FileAssertionTest with Matchers { assertion } } - .getOrElse { Future.successful { report.conforms shouldBe true } } + .getOrElse { + Future.successful { + if (!report.conforms) Console.err.println(report.toString()) + report.conforms shouldBe true + } + } } protected def processGoldenPath(path: String): String diff --git a/amf-aml/shared/src/test/scala/amf/testing/config/AMLConfigurationPluginTest.scala b/amf-aml/shared/src/test/scala/amf/testing/config/AMLConfigurationPluginTest.scala index de29144d..e5b132b3 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/config/AMLConfigurationPluginTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/config/AMLConfigurationPluginTest.scala @@ -4,18 +4,19 @@ import amf.aml.client.scala.AMLConfiguration import amf.aml.client.scala.model.domain.NodeMapping import amf.aml.internal.parse.plugin.AMLDialectInstanceParsingPlugin import amf.aml.internal.render.plugin.AMLDialectInstanceRenderingPlugin +import amf.core.common.AsyncFunSuiteWithPlatformGlobalExecutionContext import amf.core.internal.resource.AMFResolvers.platform.fs -import org.scalatest.{Assertion, AsyncFunSuite, Matchers} +import org.scalatest.Assertion +import org.scalatest.matchers.should.Matchers -import scala.concurrent.{ExecutionContext, Future} +import scala.concurrent.Future -class AMLConfigurationPluginTest extends AsyncFunSuite with Matchers { +class AMLConfigurationPluginTest extends AsyncFunSuiteWithPlatformGlobalExecutionContext with Matchers { - override implicit def executionContext: ExecutionContext = ExecutionContext.Implicits.global - val basePath = "amf-aml/shared/src/test/resources/vocabularies2/config/" - val movieDialect0 = s"$basePath/movie_dialect_0.yaml" - val movieDialect1 = s"$basePath/movie_dialect_1.yaml" - val personDialect0 = s"$basePath/person_dialect_0.yaml" + val basePath = "amf-aml/shared/src/test/resources/vocabularies2/config/" + val movieDialect0 = s"$basePath/movie_dialect_0.yaml" + val movieDialect1 = s"$basePath/movie_dialect_1.yaml" + val personDialect0 = s"$basePath/person_dialect_0.yaml" test("Loading dialects with same name and version should update plugins") { withLoadedConfig(path = s"file://$movieDialect0") { config => @@ -56,14 +57,15 @@ class AMLConfigurationPluginTest extends AsyncFunSuite with Matchers { private def assertDialectAndPluginAmount(expectedAmount: Int, config: AMLConfiguration) = { val dialects = config.configurationState().getDialects() dialects.size shouldBe 1 - config.registry.getPluginsRegistry.parsePlugins + config.registry.getPluginsRegistry.rootParsePlugins .filter(_.isInstanceOf[AMLDialectInstanceParsingPlugin]) should have length 1 config.registry.getPluginsRegistry.renderPlugins .filter(_.isInstanceOf[AMLDialectInstanceRenderingPlugin]) should have length 1 } private def withLoadedConfig(config: AMLConfiguration = AMLConfiguration.predefined(), path: String)( - block: AMLConfiguration => Future[Assertion]) = { + block: AMLConfiguration => Future[Assertion] + ) = { val futureResult = config.baseUnitClient().parseDialect(path) futureResult.flatMap { result => result.conforms shouldBe true diff --git a/amf-aml/shared/src/test/scala/amf/testing/jsonldcycle/ToAndFromJsonLDInstanceTest.scala b/amf-aml/shared/src/test/scala/amf/testing/jsonldcycle/ToAndFromJsonLDInstanceTest.scala new file mode 100644 index 00000000..361860b1 --- /dev/null +++ b/amf-aml/shared/src/test/scala/amf/testing/jsonldcycle/ToAndFromJsonLDInstanceTest.scala @@ -0,0 +1,34 @@ +package amf.testing.jsonldcycle + +import amf.aml.client.scala.AMLConfiguration +import amf.aml.client.scala.model.document.DialectInstance +import amf.core.internal.remote.Mimes +import amf.core.io.FileAssertionTest +import org.scalatest.matchers.should.Matchers + +import scala.concurrent.Future + +class ToAndFromJsonLDInstanceTest extends FileAssertionTest with Matchers { + + private val basePath = "amf-aml/shared/src/test/resources/vocabularies2/jsonldcycle/" + + test("Test cycle for any-seq(ValidationProfile)") { + val current = basePath + "any-seq/" + for { + c <- AMLConfiguration.predefined().withDialect("file://" + current + "dialect.yaml") + instanceResult <- c.baseUnitClient().parse("file://" + current + "instance.yaml").map(_.baseUnit) + jsonLD = c.baseUnitClient().render(instanceResult, Mimes.`application/ld+json`) + actual <- writeTemporaryFile(current + "instance.yaml.jsonld")(jsonLD) + assertion <- assertDifferences(actual, current + "instance.yaml.jsonld") + jsonLDParsed <- c.baseUnitClient().parse("file://" + current + "instance.yaml.jsonld") + } yield { + assert(assertion == succeed) + jsonLDParsed.baseUnit + .asInstanceOf[DialectInstance] + .encodes + .graph + .scalarByProperty("https://schema.org/in") + .size shouldBe 2 + } + } +} diff --git a/amf-aml/shared/src/test/scala/amf/testing/parsing/AmlSyamlConversionExceptionTest.scala b/amf-aml/shared/src/test/scala/amf/testing/parsing/AmlSyamlConversionExceptionTest.scala index aaecd0f7..34ae7d60 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/parsing/AmlSyamlConversionExceptionTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/parsing/AmlSyamlConversionExceptionTest.scala @@ -2,19 +2,25 @@ package amf.testing.parsing import amf.testing.common.utils.{DialectValidation, MultiPlatformReportComparator, ReportComparator} -import scala.concurrent.ExecutionContext - class AmlSyamlConversionExceptionTest extends DialectValidation { - override implicit def executionContext: ExecutionContext = ExecutionContext.Implicits.global - override protected val path: String = "amf-aml/shared/src/test/resources/vocabularies2/validations/conversion-exceptions/" + override protected val path: String = + "amf-aml/shared/src/test/resources/vocabularies2/validations/conversion-exceptions/" override protected val reportComparator: ReportComparator = MultiPlatformReportComparator test("Invalid uses entry key is not string") { - validate("invalid-uses-entry-key-is-not-string.yaml", Some("reports/invalid-uses-entry-key-is-not-string.report"), false) + validate( + "invalid-uses-entry-key-is-not-string.yaml", + Some("reports/invalid-uses-entry-key-is-not-string.report"), + false + ) } test("Invalid uses entry value is not string") { - validate("invalid-uses-entry-value-is-not-string.yaml", Some("reports/invalid-uses-entry-value-is-not-string.report"), false) + validate( + "invalid-uses-entry-value-is-not-string.yaml", + Some("reports/invalid-uses-entry-value-is-not-string.report"), + false + ) } } diff --git a/amf-aml/shared/src/test/scala/amf/testing/parsing/DialectInstanceAssertionTest.scala b/amf-aml/shared/src/test/scala/amf/testing/parsing/DialectInstanceAssertionTest.scala new file mode 100644 index 00000000..736462e8 --- /dev/null +++ b/amf-aml/shared/src/test/scala/amf/testing/parsing/DialectInstanceAssertionTest.scala @@ -0,0 +1,52 @@ +package amf.testing.parsing + +import amf.aml.client.scala.model.document.DialectInstance +import amf.aml.client.scala.{AMLConfiguration, AMLDialectInstanceResult} +import amf.core.client.scala.model.domain.AmfArray +import amf.core.common.AsyncFunSuiteWithPlatformGlobalExecutionContext +import org.mulesoft.common.client.lexical.PositionRange +import org.scalatest.matchers.should.Matchers + +import scala.concurrent.Future + +class DialectInstanceAssertionTest extends AsyncFunSuiteWithPlatformGlobalExecutionContext with Matchers { + + val basePath = "file://amf-aml/shared/src/test/resources/vocabularies2/instances/" + + def parseDialectInstance(dialectPath: String, instancePath: String): Future[AMLDialectInstanceResult] = { + AMLConfiguration.predefined().withDialect(dialectPath) flatMap { config => + config.baseUnitClient().parseDialectInstance(instancePath) + } + } + + def getDialectInstanceFirstValue(di: DialectInstance) = + di.encodes.fields + .fields() + .head + .value + .value + .asInstanceOf[AmfArray] + .values + .head + + // APIMF-3604 - W-10547579 + test("MapTermKey should be included in a Dialect Instance lexical info") { + val dialect = s"$basePath/rest-connector/dialect.yaml" + val instance = s"$basePath/rest-connector/instance.yaml" + parseDialectInstance(dialect, instance) flatMap { result => + val lexical = getDialectInstanceFirstValue(result.dialectInstance).annotations.lexical() + lexical shouldEqual PositionRange((3, 2), (6, 0)) + } + } + + // APIMF-3604 - W-10547579 + test("MapTermKey should be included in a Dialect Instance lexical info with a dialect with a union") { + val dialectUnion = s"$basePath/rest-connector/dialect-union.yaml" + val instance = s"$basePath/rest-connector/instance.yaml" + parseDialectInstance(dialectUnion, instance) flatMap { result => + val lexical = getDialectInstanceFirstValue(result.dialectInstance).annotations.lexical() + lexical shouldEqual PositionRange((3, 2), (6, 0)) + } + } + +} diff --git a/amf-aml/shared/src/test/scala/amf/testing/parsing/DialectInstancesParsingTest.scala b/amf-aml/shared/src/test/scala/amf/testing/parsing/DialectInstancesParsingTest.scala index 0cc007cc..8d6b009e 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/parsing/DialectInstancesParsingTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/parsing/DialectInstancesParsingTest.scala @@ -1,247 +1,298 @@ package amf.testing.parsing import amf.aml.client.scala.AMLConfiguration +import amf.aml.internal.annotations.FromUnionRangeMapping import amf.core.client.scala.config.RenderOptions -import amf.core.internal.remote._ import amf.core.internal.plugins.document.graph.{EmbeddedForm, FlattenedForm} -import amf.core.internal.remote.Syntax.Yaml +import amf.core.internal.remote._ import amf.testing.common.utils.DialectTests import org.scalatest.Assertion -import scala.concurrent.{ExecutionContext, Future} +import scala.concurrent.Future trait DialectInstancesParsingTest extends DialectTests { - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global - val basePath = "amf-aml/shared/src/test/resources/vocabularies2/instances/" if (platform.name == "jvm") { ignore("parse 1b test") { - cycleWithDialect("dialect1.yaml", - "example1b.yaml", - "example1b.json", - Some(Mimes.`application/ld+json`), - renderOptions = Some(RenderOptions().withoutAmfJsonLdSerialization)) + cycleWithDialect( + "dialect1.yaml", + "example1b.yaml", + "example1b.json", + Some(Mimes.`application/ld+json`), + renderOptions = Some(RenderOptions().withoutAmfJsonLdSerialization) + ) } } multiGoldenTest("parse 1 (AMF) test", "example1.amf.%s") { config => - cycleWithDialect("dialect1.yaml", - "example1.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect1.yaml", + "example1.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 1b (AMF) test", "example1b.amf.%s") { config => - cycleWithDialect("dialect1.yaml", - "example1b.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect1.yaml", + "example1b.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 1 with annotations test", "example1_annotations.%s") { config => - cycleWithDialect("dialect1.yaml", - "example1_annotations.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect1.yaml", + "example1_annotations.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 2 test", "example2.%s") { config => - cycleWithDialect("dialect2.yaml", - "example2.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect2.yaml", + "example2.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 3 test", "example3.%s") { config => - cycleWithDialect("dialect3.yaml", - "example3.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect3.yaml", + "example3.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 4 test", "example4.%s") { config => - cycleWithDialect("dialect4.yaml", - "example4.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect4.yaml", + "example4.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 5 test", "example5.%s") { config => - cycleWithDialect("dialect5.yaml", - "example5.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect5.yaml", + "example5.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 6 test", "example6.%s") { config => - cycleWithDialect("dialect6.yaml", - "example6.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect6.yaml", + "example6.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 6b $ref test", "example6b.%s") { config => - cycleWithDialect("dialect6.yaml", - "example6b.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect6.yaml", + "example6b.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 7 test", "example7.%s") { config => - cycleWithDialect("dialect7.yaml", - "example7.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect7.yaml", + "example7.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 8 test", "example8.%s") { config => - cycleWithDialect("dialect8.yaml", - "example8.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect8.yaml", + "example8.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 8b $include test", "example8b.%s") { config => - cycleWithDialect("dialect8.yaml", - "example8b.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect8.yaml", + "example8b.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 8c $ref test", "example8c.%s") { config => - cycleWithDialect("dialect8.yaml", - "example8c.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect8.yaml", + "example8c.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 8 (fragment) test", "fragment8.%s") { config => - cycleWithDialect("dialect8.yaml", - "fragment8.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect8.yaml", + "fragment8.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 9 test", "example9.%s") { config => - cycleWithDialect("dialect9.yaml", - "example9.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect9.yaml", + "example9.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 9b $ref test", "example9b.%s") { config => - cycleWithDialect("dialect9.yaml", - "example9b.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect9.yaml", + "example9b.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 10a test", "example10a.%s") { config => - cycleWithDialect("dialect10.yaml", - "example10a.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect10.yaml", + "example10a.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 10b test", "example10b.%s") { config => - cycleWithDialect("dialect10.yaml", - "example10b.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect10.yaml", + "example10b.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 10c test", "example10c.%s") { config => - cycleWithDialect("dialect10.yaml", - "example10c.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect10.yaml", + "example10c.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 11 test", "example11.%s") { config => - cycleWithDialect("dialect11.yaml", - "example11.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect11.yaml", + "example11.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 12 test", "example12.%s") { config => for { amlConfig <- AMLConfiguration.predefined().withDialect(s"file://$basePath/dialect12.yaml") - assertion <- withInlineDialect("example12.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - amlConfig.withRenderOptions(config.renderOptions)) + assertion <- withInlineDialect( + "example12.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + amlConfig.withRenderOptions(config.renderOptions) + ) } yield { assertion } } multiGoldenTest("parse 13a (test union inline)", "example13a.%s") { config => - cycleWithDialect("dialect13a.yaml", - "example13a.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect13a.yaml", + "example13a.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 13b (test union)", "example13b.%s") { config => - cycleWithDialect("dialect13b.yaml", - "example13b.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect13b.yaml", + "example13b.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 13c (test union with extends)", "example13c.%s") { config => - cycleWithDialect("dialect13c.yaml", - "example13c.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect13c.yaml", + "example13c.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 14 test", "example14.%s") { config => - cycleWithDialect("dialect14.yaml", - "example14.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect14.yaml", + "example14.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 15 test", "example15.%s") { config => val amlConfig = AMLConfiguration.predefined() for { nextAmlConfig <- amlConfig.withDialect( - "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect15b.yaml") + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect15b.yaml" + ) assertion <- cycleWithDialect( - "dialect15a.yaml", - "example15.yaml", - config.golden, - renderOptions = Some(config.renderOptions), - mediaType = Some(Mimes.`application/ld+json`), - baseConfig = nextAmlConfig + "dialect15a.yaml", + "example15.yaml", + config.golden, + renderOptions = Some(config.renderOptions), + mediaType = Some(Mimes.`application/ld+json`), + baseConfig = nextAmlConfig ) } yield { assertion @@ -252,14 +303,15 @@ trait DialectInstancesParsingTest extends DialectTests { val amlConfig = AMLConfiguration.predefined() for { nextAmlConfig <- amlConfig.withDialect( - "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect16b.yaml") + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect16b.yaml" + ) assertion <- cycleWithDialect( - "dialect16a.yaml", - "example16a.yaml", - config.golden, - renderOptions = Some(config.renderOptions), - mediaType = Some(Mimes.`application/ld+json`), - baseConfig = nextAmlConfig + "dialect16a.yaml", + "example16a.yaml", + config.golden, + renderOptions = Some(config.renderOptions), + mediaType = Some(Mimes.`application/ld+json`), + baseConfig = nextAmlConfig ) } yield { assertion @@ -270,14 +322,15 @@ trait DialectInstancesParsingTest extends DialectTests { val amlConfig = AMLConfiguration.predefined() for { nextAmlConfig <- amlConfig.withDialect( - "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect16b.yaml") + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/dialect16b.yaml" + ) assertion <- cycleWithDialect( - "dialect16a.yaml", - "example16c.yaml", - config.golden, - renderOptions = Some(config.renderOptions), - mediaType = Some(Mimes.`application/ld+json`), - baseConfig = nextAmlConfig + "dialect16a.yaml", + "example16c.yaml", + config.golden, + renderOptions = Some(config.renderOptions), + mediaType = Some(Mimes.`application/ld+json`), + baseConfig = nextAmlConfig ) } yield { assertion @@ -285,179 +338,219 @@ trait DialectInstancesParsingTest extends DialectTests { } multiGoldenTest("parse 17 test", "example17.output.%s") { config => - cycleWithDialect("dialect17.input.json", - "example17.input.json", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect17.input.json", + "example17.input.json", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 18 test", "example18.%s") { config => - cycleWithDialect("dialect18.yaml", - "example18.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect18.yaml", + "example18.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 18 b test", "example18b.%s") { config => - cycleWithDialect("dialect18.yaml", - "example18b.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect18.yaml", + "example18b.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 19 test", "example19.%s") { config => - cycleWithDialect("dialect19.yaml", - "example19.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect19.yaml", + "example19.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 20 test", "example20.%s") { config => - cycleWithDialect("dialect20.yaml", - "example20.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect20.yaml", + "example20.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 21a test", "patch21.%s") { config => - cycleWithDialect("dialect21.yaml", - "patch21.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect21.yaml", + "patch21.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 21b test", "patch21b.%s") { config => - cycleWithDialect("dialect21.yaml", - "patch21b.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect21.yaml", + "patch21b.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 23 test", "example23.%s") { config => - cycleWithDialect("dialect23.yaml", - "example23.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect23.yaml", + "example23.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } if (platform.name == "jvm") { ignore("parse 23 (non-amf) test") { cycleWithDialect( - "dialect23.yaml", - "example23.yaml", - "example23.rdf.json", - Some(Mimes.`application/ld+json`), - renderOptions = Some(RenderOptions().withoutAmfJsonLdSerialization) + "dialect23.yaml", + "example23.yaml", + "example23.rdf.json", + Some(Mimes.`application/ld+json`), + renderOptions = Some(RenderOptions().withoutAmfJsonLdSerialization) ) } } multiGoldenTest("parse 24 test", "example24.%s") { config => - cycleWithDialect("dialect24.yaml", - "example24.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect24.yaml", + "example24.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 24b test", "example24b.%s") { config => - cycleWithDialect("dialect24.yaml", - "example24b.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect24.yaml", + "example24b.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 24c test", "example24c.%s") { config => - cycleWithDialect("dialect24.yaml", - "example24c.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect24.yaml", + "example24c.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 27a test", "example27a.%s") { config => - cycleWithDialect("dialect27.yaml", - "example27a.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect27.yaml", + "example27a.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 28 test", "example28.%s") { config => - cycleWithDialect("dialect28.yaml", - "example28.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect28.yaml", + "example28.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 30 test", "example30.%s") { config => - cycleWithDialect("dialect30.yaml", - "example30.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect30.yaml", + "example30.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 31 test", "example31.%s") { config => - cycleWithDialect("dialect31.yaml", - "example31.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect31.yaml", + "example31.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 32 test", "example32.%s") { config => - cycleWithDialect("dialect32.yaml", - "example32.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect32.yaml", + "example32.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiGoldenTest("parse 33 test (Union with no type discriminator)", "example33.%s") { config => - cycleWithDialect("dialect33.yaml", - "example33.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect33.yaml", + "example33.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } if (platform.name == "jvm") { ignore("generate 1 test") { - cycleWithDialect("dialect1.yaml", - "example1.json", - "example1.yaml", - None, - renderOptions = Some(RenderOptions().withoutAmfJsonLdSerialization)) + cycleWithDialect( + "dialect1.yaml", + "example1.json", + "example1.yaml", + None, + renderOptions = Some(RenderOptions().withoutAmfJsonLdSerialization) + ) } } if (platform.name == "jvm") { ignore("generate 23 (non-amf) test") { - cycleWithDialect("dialect23.yaml", - "example23.rdf.json", - "example23.yaml", - None, - renderOptions = Some(RenderOptions().withoutAmfJsonLdSerialization)) + cycleWithDialect( + "dialect23.yaml", + "example23.rdf.json", + "example23.yaml", + None, + renderOptions = Some(RenderOptions().withoutAmfJsonLdSerialization) + ) } } ignore("generate 1b test") { - cycleWithDialect("dialect1.yaml", - "example1b.json", - "example1b.yaml", - None, - renderOptions = Some(RenderOptions().withoutAmfJsonLdSerialization)) + cycleWithDialect( + "dialect1.yaml", + "example1b.json", + "example1b.yaml", + None, + renderOptions = Some(RenderOptions().withoutAmfJsonLdSerialization) + ) } multiSourceTest("generate 1 (AMF) test", "example1.amf.%s") { config => @@ -552,7 +645,7 @@ trait DialectInstancesParsingTest extends DialectTests { cycleWithDialect("dialect14.yaml", config.source, "example14.yaml", Some(Mimes.`application/yaml`)) } - //TODO ARM for instance needed + // TODO ARM for instance needed // multiSourceTest("generate 15 test", "example15.%s") { config => // for { // _ <- AMLPlugin.registry.registerDialect(s"file://$basePath/dialect15b.yaml") @@ -618,11 +711,13 @@ trait DialectInstancesParsingTest extends DialectTests { } multiGoldenTest("parse 29 test - keyproperty", "example29.%s") { config => - cycleWithDialect("dialect29.yaml", - "example29.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect29.yaml", + "example29.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiSourceTest("generate 29 test - keyproperty", "example29.%s") { config => @@ -630,11 +725,13 @@ trait DialectInstancesParsingTest extends DialectTests { } multiGoldenTest("parse 29 invalid test - keyproperty", "example29.%s") { config => - cycleWithDialect("dialect29.yaml", - "example29.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions)) + cycleWithDialect( + "dialect29.yaml", + "example29.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) + ) } multiSourceTest("generate 30 test", "example30.%s") { config => @@ -647,66 +744,66 @@ trait DialectInstancesParsingTest extends DialectTests { multiGoldenTest("Generate instance with invalid property terms", "/invalids/schema-uri/instance.%s") { config => cycleWithDialect( - "/invalids/schema-uri/dialect.yaml", - "/invalids/schema-uri/instance.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions) + "/invalids/schema-uri/dialect.yaml", + "/invalids/schema-uri/instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions) ) } multiGoldenTest("Instance with similar fragment names minor", "minor.%s") { config => cycleWithDialect( - "dialect.yaml", - "minor.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions), - directory = "amf-aml/shared/src/test/resources/vocabularies2/instances/colliding-fragments" + "dialect.yaml", + "minor.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = "amf-aml/shared/src/test/resources/vocabularies2/instances/colliding-fragments" ) } multiGoldenTest("Instance with similar fragment names publicMinor", "publicMinor.%s") { config => cycleWithDialect( - "dialect.yaml", - "publicMinor.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions), - directory = "amf-aml/shared/src/test/resources/vocabularies2/instances/colliding-fragments" + "dialect.yaml", + "publicMinor.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = "amf-aml/shared/src/test/resources/vocabularies2/instances/colliding-fragments" ) } multiGoldenTest("Parse mapKey and mapValue", "instance.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions), - directory = "amf-aml/shared/src/test/resources/vocabularies2/instances/map-key-value" + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = "amf-aml/shared/src/test/resources/vocabularies2/instances/map-key-value" ) } multiGoldenTest("Parse YAML instance with empty node", "instance.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions), - directory = "amf-aml/shared/src/test/resources/vocabularies2/instances/empty-node-yaml" + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = "amf-aml/shared/src/test/resources/vocabularies2/instances/empty-node-yaml" ) } multiGoldenTest("Parse JSON instance with empty node", "instance.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.json", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions), - directory = "amf-aml/shared/src/test/resources/vocabularies2/instances/empty-node-json" + "dialect.yaml", + "instance.json", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = "amf-aml/shared/src/test/resources/vocabularies2/instances/empty-node-json" ) } @@ -730,12 +827,12 @@ trait DialectInstancesParsingTest extends DialectTests { multiGoldenTest("Parse instance with includes", "instance.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions), - directory = "amf-aml/shared/src/test/resources/vocabularies2/instances/includes" + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = "amf-aml/shared/src/test/resources/vocabularies2/instances/includes" ) } @@ -744,15 +841,16 @@ trait DialectInstancesParsingTest extends DialectTests { amlConfig <- AMLConfiguration .predefined() .withDialect( - "file://amf-aml/shared/src/test/resources/vocabularies2/instances/$dialect-with-includes/dialectB.yaml") + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/$dialect-with-includes/dialectB.yaml" + ) assertion <- cycleWithDialect( - "dialect.yaml", - "instance.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions), - directory = "amf-aml/shared/src/test/resources/vocabularies2/instances/$dialect-with-includes", - baseConfig = amlConfig + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = "amf-aml/shared/src/test/resources/vocabularies2/instances/$dialect-with-includes", + baseConfig = amlConfig ) } yield { assertion @@ -761,68 +859,68 @@ trait DialectInstancesParsingTest extends DialectTests { multiGoldenTest("Parse instance with $id", "instance.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions), - directory = "amf-aml/shared/src/test/resources/vocabularies2/instances/$id" + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = "amf-aml/shared/src/test/resources/vocabularies2/instances/$id" ) } multiGoldenTest("Parse instance with id template", "instance.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions), - directory = "amf-aml/shared/src/test/resources/vocabularies2/instances/id-template" + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = "amf-aml/shared/src/test/resources/vocabularies2/instances/id-template" ) } multiGoldenTest("Parse instance with primary key", "instance.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions), - directory = "amf-aml/shared/src/test/resources/vocabularies2/instances/node-with-primary-key" + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = "amf-aml/shared/src/test/resources/vocabularies2/instances/node-with-primary-key" ) } multiGoldenTest("Parse from instance from JSON-LD with extended term definitions in @context", "instance.golden.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.source.flattened.jsonld", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - directory = basePath + "jsonld-extended-term-definitions/", - renderOptions = Some(config.renderOptions) + "dialect.yaml", + "instance.source.flattened.jsonld", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + directory = basePath + "jsonld-extended-term-definitions/", + renderOptions = Some(config.renderOptions) ) } multiGoldenTest("Parse instance with $base facet", "instance.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - directory = basePath + "$base/", - renderOptions = Some(config.renderOptions) + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + directory = basePath + "$base/", + renderOptions = Some(config.renderOptions) ) } multiGoldenTest("Parse instance with $base facet and id template", "instance.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - directory = basePath + "$base-with-id-template/", - renderOptions = Some(config.renderOptions) + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + directory = basePath + "$base-with-id-template/", + renderOptions = Some(config.renderOptions) ) } @@ -841,62 +939,66 @@ trait DialectInstancesParsingTest extends DialectTests { multiGoldenTest("Parse instance with simple native link", "instance.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions), - directory = s"$basePath/simple-native-links/" + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = s"$basePath/simple-native-links/" ) } multiGoldenTest("Parse instance with native links and template ids", "instance.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions), - directory = s"$basePath/native-links-with-template-ids/" + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = s"$basePath/native-links-with-template-ids/" ) } multiGoldenTest("Parse instance with native links and extra properties", "instance.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions), - directory = s"$basePath/native-link-with-extra-properties/" + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = s"$basePath/native-link-with-extra-properties/" ) } multiGoldenTest("Parse instance with native links and native targets", "instance.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions), - directory = s"$basePath/native-links-with-native-target/" + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = s"$basePath/native-links-with-native-target/" ) } multiSourceTest("Generate instance with simple native link", "instance.%s") { config => - cycleWithDialect("dialect.yaml", - config.source, - "instance.yaml", - Some(Mimes.`application/yaml`), - directory = s"$basePath/simple-native-links/") + cycleWithDialect( + "dialect.yaml", + config.source, + "instance.yaml", + Some(Mimes.`application/yaml`), + directory = s"$basePath/simple-native-links/" + ) } multiSourceTest("Generate instance with native links and template ids", "instance.%s") { config => - cycleWithDialect("dialect.yaml", - config.source, - "instance.yaml", - Some(Mimes.`application/yaml`), - directory = s"$basePath/native-links-with-template-ids/") + cycleWithDialect( + "dialect.yaml", + config.source, + "instance.yaml", + Some(Mimes.`application/yaml`), + directory = s"$basePath/native-links-with-template-ids/" + ) } multiSourceTest("Generate instance with native links and native targets", "instance.%s") { config => @@ -906,140 +1008,401 @@ trait DialectInstancesParsingTest extends DialectTests { case _ => "instance.flattened.yaml" } cycleWithDialect( - "dialect.yaml", - config.source, - golden, - Some(Mimes.`application/yaml`), - directory = s"$basePath/native-links-with-native-target/" + "dialect.yaml", + config.source, + golden, + Some(Mimes.`application/yaml`), + directory = s"$basePath/native-links-with-native-target/" ) } multiGoldenTest("Parse instance with compact URIs", "instance.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions.withCompactUris), - directory = s"$basePath/compact-uris/" + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions.withCompactUris), + directory = s"$basePath/compact-uris/" ) } multiGoldenTest("Id produced from idTemplate is encoded", "instance.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions), - directory = s"$basePath/encoded-id-template/" + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = s"$basePath/encoded-id-template/" ) } multiGoldenTest("Simple node mapping extension", "instance.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions), - directory = s"$basePath/simple-node-mapping-extension/" + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = s"$basePath/simple-node-mapping-extension/" ) } multiGoldenTest("Node mapping extension with overriden properties", "instance.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions), - directory = s"$basePath/node-mapping-extension-with-overriden-properties/" + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = s"$basePath/node-mapping-extension-with-overriden-properties/" ) } multiGoldenTest("Node mapping extension with id templates", "instance.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions), - directory = s"$basePath/node-mapping-extension-with-id-templates/" + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = s"$basePath/node-mapping-extension-with-id-templates/" ) } multiGoldenTest("Array property mapping with single string element", "instance.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.jsonld", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions), - directory = s"$basePath/array-property-mappings-with-single-string-element/" + "dialect.yaml", + "instance.jsonld", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = s"$basePath/array-property-mappings-with-single-string-element/" ) } multiGoldenTest("Array property mapping with single object element", "instance.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.jsonld", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions), - directory = s"$basePath/array-property-mappings-with-single-object-element/" + "dialect.yaml", + "instance.jsonld", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = s"$basePath/array-property-mappings-with-single-object-element/" ) } multiGoldenTest("mapKey and mapValue without classterm", "instance.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.yaml", - config.golden, - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(config.renderOptions), - directory = s"$basePath/map-key-value-without-classterm/" + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = s"$basePath/map-key-value-without-classterm/" + ) + } + + // TODO W-10795527 + ignore("Cyclic references") { + cycleWithDialect( + "dialect.yaml", + "instance.flattened.jsonld", + "instance.golden.flattened.jsonld", + Some(Mimes.`application/yaml`), + renderOptions = Some(RenderOptions().withFlattenedJsonLd.withPrettyPrint), + directory = s"$basePath/cyclic-references/" + ) + } + + multiGoldenTest("mapValue with multiple values", "instance.%s") { config => + cycleWithDialect( + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = s"$basePath/mapValue-with-multiple/" + ) + } + + test("different encodes should be named") { + cycleWithDialect( + "dialect.yaml", + "instance.yaml", + "instance.golden.flattened.jsonld", + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(RenderOptions().withFlattenedJsonLd.withPrettyPrint), + directory = s"$basePath/encoded-named/" + ) + } + + test("Undefined mapping from UnionRange will contain FromUnionRangeMapping annotation") { + val amlConfig = AMLConfiguration.predefined() + val dialectUri = "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/range-mapping.yaml" + + def declaration(s: String): String = s"$dialectUri#/declarations/$s" + + for { + nextAmlConfig <- amlConfig.withDialect(dialectUri) + instance <- nextAmlConfig + .baseUnitClient() + .parseDialectInstance( + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/undefined-union-range-mapping.yaml" + ) + assertion <- { + val encoded = instance.dialectInstance.encodes + val unionPropertyFieldEntry = + encoded.fields.fields().find(_.field.value.iri() == "http://test.com/v2#unionRangeProp") + val annotation = unionPropertyFieldEntry.get.value.value.annotations.find(classOf[FromUnionRangeMapping]) + assert(annotation.isDefined) + val possibleRanges = annotation.get.possibleRanges + assert(possibleRanges.contains(declaration("A"))) + assert(possibleRanges.contains(declaration("B"))) + assert(possibleRanges.contains(declaration("C"))) + } + } yield { + assertion + } + } + + test("Defined mapping from UnionRange should not contain FromUnionRangeMapping annotation") { + val amlConfig = AMLConfiguration.predefined() + val dialectUri = "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/range-mapping.yaml" + + def declaration(s: String): String = s"$dialectUri#/declarations/$s" + + for { + nextAmlConfig <- amlConfig.withDialect(dialectUri) + instance <- nextAmlConfig + .baseUnitClient() + .parseDialectInstance( + "file://amf-aml/shared/src/test/resources/vocabularies2/instances/defined-union-range-mapping.yaml" + ) + assertion <- { + val encoded = instance.dialectInstance.encodes + val unionPropertyFieldEntry = + encoded.fields.fields().find(_.field.value.iri() == "http://test.com/v2#unionRangeProp") + val annotation = unionPropertyFieldEntry.get.value.value.annotations.find(classOf[FromUnionRangeMapping]) + assert(annotation.isEmpty) + } + } yield { + assertion + } + } + + test("JSON Instance with Union at root level should omit the $dialect entry") { + cycleWithDialect( + "dialect.yaml", + "instance.json", + "instance.golden.jsonld", + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(RenderOptions().withPrettyPrint.withCompactUris), + directory = s"$basePath/json-root-union/" + ) + } + + test("Instance cycle with mapping ref without term obj") { + cycleWithDialect( + "dialect.yaml", + "instance.json", + "instance.golden.json", + mediaType = Some(Mimes.`application/json`), + renderOptions = Some(RenderOptions().withPrettyPrint.withCompactUris), + directory = s"$basePath/without-term-obj/" + ) + } + + test("Instance cycle with mapping ref without term seq") { + cycleWithDialect( + "dialect.yaml", + "instance.json", + "instance.golden.json", + mediaType = Some(Mimes.`application/json`), + renderOptions = Some(RenderOptions().withPrettyPrint.withCompactUris), + directory = s"$basePath/without-term-seq/" + ) + } + + multiGoldenTest("if/then/else parsing error should go with else branch", "instance.%s") { config => + cycleWithDialect( + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = s"$basePath/if-then-else-parsing-error/" ) } - test("Cyclic references") { + multiGoldenTest("if/then/else valid if should go with then branch", "instance.%s") { config => cycleWithDialect( + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = s"$basePath/if-then-else-valid-if/" + ) + } + + multiGoldenTest("if/then/else invalid if should go with else branch", "instance.%s") { config => + cycleWithDialect( + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = s"$basePath/if-then-else-invalid-if/" + ) + } + + multiSourceTest("if/then/else parsing error should go with else branch from JSON-LD to YAML", "instance.%s") { + config => + cycleWithDialect( "dialect.yaml", - "instance.flattened.jsonld", - "instance.golden.flattened.jsonld", + config.source, + "instance.multi-source.yaml", Some(Mimes.`application/yaml`), - renderOptions = Some(RenderOptions().withFlattenedJsonLd.withPrettyPrint), - directory = s"$basePath/cyclic-references/" + directory = s"$basePath/if-then-else-parsing-error/" + ) + } + + multiSourceTest("if/then/else valid if should go with then branch from JSON-LD to YAML", "instance.%s") { config => + cycleWithDialect( + "dialect.yaml", + config.source, + "instance.multi-source.yaml", + Some(Mimes.`application/yaml`), + directory = s"$basePath/if-then-else-valid-if/" ) } - multiGoldenTest("mapValue with multiple values", "instance.%s") { config => + multiSourceTest("if/then/else invalid if should go with else branch from JSON-LD to YAML", "instance.%s") { config => cycleWithDialect( + "dialect.yaml", + config.source, + "instance.multi-source.yaml", + Some(Mimes.`application/yaml`), + directory = s"$basePath/if-then-else-invalid-if/" + ) + } + + multiGoldenTest("combination: allOf with nested oneOf from YAML to JSON-LD", "instance.%s") { config => + cycleWithDialect( + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = s"$basePath/allOf-with-nested-oneOf/" + ) + } + + multiSourceTest("combination: allOf with nested oneOf from JSON-LD to YAML", "instance.%s") { config => + cycleWithDialect( + "dialect.yaml", + config.source, + "instance.cycled.yaml", + Some(Mimes.`application/yaml`), + directory = s"$basePath/allOf-with-nested-oneOf/" + ) + } + + multiGoldenTest("combination: allOf with simple mappings from YAML to JSON-LD", "instance.%s") { config => + cycleWithDialect( + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = s"$basePath/allOf-simple/" + ) + } + + multiSourceTest("combination: allOf with simple mappings from JSON-LD to YAML", "instance.%s") { config => + cycleWithDialect( + "dialect.yaml", + config.source, + "instance.cycled.yaml", + Some(Mimes.`application/yaml`), + directory = s"$basePath/allOf-simple/" + ) + } + + multiGoldenTest("combination: allOf with simple mappings and properties from YAML to JSON-LD", "instance.%s") { + config => + cycleWithDialect( "dialect.yaml", "instance.yaml", config.golden, mediaType = Some(Mimes.`application/ld+json`), renderOptions = Some(config.renderOptions), - directory = s"$basePath/mapValue-with-multiple/" + directory = s"$basePath/allOf-properties/" + ) + } + + multiSourceTest("combination: allOf with simple mappings and properties from JSON-LD to YAML", "instance.%s") { + config => + cycleWithDialect( + "dialect.yaml", + config.source, + "instance.cycled.yaml", + Some(Mimes.`application/yaml`), + directory = s"$basePath/allOf-properties/" + ) + } + + multiGoldenTest("combination: allOf with oneOf and if-then-else from YAML to JSON-LD", "instance.%s") { config => + cycleWithDialect( + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = s"$basePath/allOf-oneOf-if-then-else/" ) } - test("different encodes should be named") { + multiSourceTest("combination: allOf with oneOf and if-then-else JSON-LD to YAML", "instance.%s") { config => cycleWithDialect( - "dialect.yaml", - "instance.yaml", - "instance.golden.flattened.jsonld", - mediaType = Some(Mimes.`application/ld+json`), - renderOptions = Some(RenderOptions().withFlattenedJsonLd.withPrettyPrint), - directory = s"$basePath/encoded-named/" + "dialect.yaml", + config.source, + "instance.cycled.yaml", + Some(Mimes.`application/yaml`), + directory = s"$basePath/allOf-oneOf-if-then-else/" + ) + } + + multiGoldenTest("Long datatype YAML to JSON-LD", "instance.%s") { config => + cycleWithDialect( + "dialect.yaml", + "instance.yaml", + config.golden, + mediaType = Some(Mimes.`application/ld+json`), + renderOptions = Some(config.renderOptions), + directory = s"$basePath/long-datatype/" + ) + } + + multiSourceTest("Long datatype JSON-LD to YAML", "instance.%s") { config => + cycleWithDialect( + "dialect.yaml", + config.source, + "instance.cycled.yaml", + Some(Mimes.`application/yaml`), + directory = s"$basePath/long-datatype/" ) } - //noinspection SameParameterValue - protected def withInlineDialect(source: String, - golden: String, - mediaType: Option[String], - amlConfig: AMLConfiguration, - renderOptions: Option[RenderOptions] = None): Future[Assertion] = + // noinspection SameParameterValue + protected def withInlineDialect( + source: String, + golden: String, + mediaType: Option[String], + amlConfig: AMLConfiguration, + renderOptions: Option[RenderOptions] = None + ): Future[Assertion] = cycle(source, golden, mediaType, amlConfig = amlConfig) } diff --git a/amf-aml/shared/src/test/scala/amf/testing/parsing/DialectsParsingTest.scala b/amf-aml/shared/src/test/scala/amf/testing/parsing/DialectsParsingTest.scala index 421eff00..58310e73 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/parsing/DialectsParsingTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/parsing/DialectsParsingTest.scala @@ -1,17 +1,41 @@ package amf.testing.parsing import amf.aml.client.scala.AMLConfiguration -import amf.core.internal.remote.{Amf, AmfJsonHint, Aml, Mimes, VocabularyYamlHint} +import amf.core.client.scala.config.RenderOptions +import amf.core.internal.remote.Mimes import amf.testing.common.utils.DialectTests -import scala.concurrent.ExecutionContext - trait DialectsParsingTest extends DialectTests { - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global - val basePath = "amf-aml/shared/src/test/resources/vocabularies2/dialects/" + private def multiCycleTest(label: String, directory: String): Unit = { + + multiGoldenTest(s"$label parsing from YAML to JSON-LD", "dialect.%s") { config => + cycle( + "dialect.yaml", + config.golden, + Some(Mimes.`application/ld+json`), + AMLConfiguration.predefined().withRenderOptions(config.renderOptions.withCompactUris), + directory = directory + ) + } + + multiSourceTest(s"$label parsing from JSON-LD to YAML", "dialect.%s") { config => + cycle( + config.source, + "dialect.cycled.jsonld.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = directory + ) + } + + test(s"$label parsing from YAML to YAML") { + cycle("dialect.yaml", "dialect.cycled.yaml", Some(Mimes.`application/yaml`), directory = directory) + } + + } + multiGoldenTest("parse 1 test", "example1.%s") { config => cycle("example1.yaml", config.golden, Some(Mimes.`application/ld+json`), amlConfig = config.config) } @@ -112,6 +136,10 @@ trait DialectsParsingTest extends DialectTests { cycle("example23b.yaml", config.golden, Some(Mimes.`application/ld+json`), amlConfig = config.config) } + multiGoldenTest("parse 24 test", "example24.%s") { config => + cycle("example24.yaml", config.golden, Some(Mimes.`application/ld+json`), amlConfig = config.config) + } + multiGoldenTest("parse mappings_lib test", "mappings_lib.%s") { config => cycle("mappings_lib.yaml", config.golden, Some(Mimes.`application/ld+json`), amlConfig = config.config) } @@ -212,6 +240,10 @@ trait DialectsParsingTest extends DialectTests { cycle(config.source, "example23b.yaml", mediaType = Some(Mimes.`application/yaml`)) } + multiSourceTest("generate 24 test", "example24.%s") { config => + cycle(config.source, "example24.yaml", Some(Mimes.`application/yaml`)) + } + multiGoldenTest("no documents on dialect (raml -> json)", "no-documents.%s") { config => cycle("no-documents.yaml", config.golden, Some(Mimes.`application/ld+json`), amlConfig = config.config) } @@ -226,10 +258,12 @@ trait DialectsParsingTest extends DialectTests { // Key Property tests multiGoldenTest("parse 19 test - with key property", "keyproperty/example19-keyproperty.%s") { config => - cycle("keyproperty/example19-keyproperty.yaml", - config.golden, - Some(Mimes.`application/ld+json`), - amlConfig = config.config) + cycle( + "keyproperty/example19-keyproperty.yaml", + config.golden, + Some(Mimes.`application/ld+json`), + amlConfig = config.config + ) } multiSourceTest("generate 19 test - with key property", "keyproperty/example19-keyproperty.%s") { config => @@ -238,10 +272,12 @@ trait DialectsParsingTest extends DialectTests { // Reference Style tests multiGoldenTest("parse 19 test - with reference style", "referencestyle/example19-referencestyle.%s") { config => - cycle("referencestyle/example19-referencestyle.yaml", - config.golden, - Some(Mimes.`application/ld+json`), - amlConfig = config.config) + cycle( + "referencestyle/example19-referencestyle.yaml", + config.golden, + Some(Mimes.`application/ld+json`), + amlConfig = config.config + ) } multiSourceTest("generate 19 test - with reference style", "referencestyle/example19-referencestyle.%s") { config => @@ -249,60 +285,227 @@ trait DialectsParsingTest extends DialectTests { } multiGoldenTest("Parse dialect with fragment", "dialect.%s") { config => - cycle("dialect.yaml", - config.golden, - Some(Mimes.`application/ld+json`), - directory = s"$basePath/dialect-fragment", - amlConfig = config.config) + cycle( + "dialect.yaml", + config.golden, + Some(Mimes.`application/ld+json`), + directory = s"$basePath/dialect-fragment", + amlConfig = config.config + ) } multiGoldenTest("Parse dialect with library", "dialect.%s") { config => - cycle("dialect.yaml", - config.golden, - Some(Mimes.`application/ld+json`), - directory = s"$basePath/dialect-library", - amlConfig = config.config) + cycle( + "dialect.yaml", + config.golden, + Some(Mimes.`application/ld+json`), + directory = s"$basePath/dialect-library", + amlConfig = config.config + ) } multiGoldenTest("Parse empty but present type discriminator field", "empty-type-discriminator-field.%s") { config => - cycle("empty-type-discriminator-field.yaml", - config.golden, - Some(Mimes.`application/ld+json`), - amlConfig = config.config) + cycle( + "empty-type-discriminator-field.yaml", + config.golden, + Some(Mimes.`application/ld+json`), + amlConfig = config.config + ) } multiGoldenTest("Parse empty value in type discriminator", "empty-type-discriminator-value.%s") { config => - cycle("empty-type-discriminator-value.yaml", - config.golden, - Some(Mimes.`application/ld+json`), - amlConfig = config.config) + cycle( + "empty-type-discriminator-value.yaml", + config.golden, + Some(Mimes.`application/ld+json`), + amlConfig = config.config + ) } multiGoldenTest("Parse annotation mappings & semantic extensions", "dialect.%s") { config => - cycle("dialect.yaml", - config.golden, - Some(Mimes.`application/ld+json`), - directory = s"$basePath/annotation-mappings", - amlConfig = config.config) + cycle( + "dialect.yaml", + config.golden, + Some(Mimes.`application/ld+json`), + directory = s"$basePath/annotation-mappings", + amlConfig = config.config + ) } multiGoldenTest("Parse inexistent annotation mapping reference from semantic extensions", "dialect.%s") { config => cycle( - "dialect.yaml", - config.golden, - Some(Mimes.`application/ld+json`), - directory = s"$basePath/annotation-mappings-inexistent-ref", - amlConfig = config.config + "dialect.yaml", + config.golden, + Some(Mimes.`application/ld+json`), + directory = s"$basePath/annotation-mappings-inexistent-ref", + amlConfig = config.config ) } multiGoldenTest("Parse annotation mappings with extra facets", "dialect.%s") { config => cycle( - "dialect.yaml", - config.golden, - Some(Mimes.`application/ld+json`), - AMLConfiguration.predefined().withRenderOptions(config.renderOptions.withCompactUris), - directory = s"$basePath/annotation-mappings-with-extra-facets" + "dialect.yaml", + config.golden, + Some(Mimes.`application/ld+json`), + AMLConfiguration.predefined().withRenderOptions(config.renderOptions.withCompactUris), + directory = s"$basePath/annotation-mappings-with-extra-facets" + ) + } + + // JSON + + test("Parse simple JSON dialect") { + cycle( + "dialect.json", + "dialect.jsonld", + Some(Mimes.`application/ld+json`), + AMLConfiguration.predefined().withRenderOptions(RenderOptions().withCompactUris.withPrettyPrint), + directory = s"$basePath/json/simple" + ) + } + + test("Parse JSON dialect with library") { + cycle( + "dialect.json", + "dialect.jsonld", + Some(Mimes.`application/ld+json`), + AMLConfiguration.predefined().withRenderOptions(RenderOptions().withCompactUris.withPrettyPrint), + directory = s"$basePath/json/with-library" + ) + } + + test("Parse JSON dialect with vocabulary") { + cycle( + "dialect.json", + "dialect.jsonld", + Some(Mimes.`application/ld+json`), + AMLConfiguration.predefined().withRenderOptions(RenderOptions().withCompactUris.withPrettyPrint), + directory = s"$basePath/json/with-vocabulary" + ) + } + + test("Parse dialect with $id directive") { + cycle( + "dialect.yaml", + "dialect.jsonld", + Some(Mimes.`application/ld+json`), + AMLConfiguration.predefined().withRenderOptions(RenderOptions().withPrettyPrint.withCompactUris), + directory = s"$basePath/id-directive" + ) + } + + test("Parse dialect library with $id directive") { + cycle( + "dialect.yaml", + "dialect.jsonld", + Some(Mimes.`application/ld+json`), + AMLConfiguration.predefined().withRenderOptions(RenderOptions().withPrettyPrint.withCompactUris), + directory = s"$basePath/id-directive-library" + ) + } + + test("Parse dialect fragment with $id directive") { + cycle( + "dialect.yaml", + "dialect.jsonld", + Some(Mimes.`application/ld+json`), + AMLConfiguration.predefined().withRenderOptions(RenderOptions().withPrettyPrint.withCompactUris), + directory = s"$basePath/id-directive-fragment" + ) + } + + multiGoldenTest("Empty annotation mapping with name has lexical", "dialect.%s") { config => + cycle( + "dialect.yaml", + config.golden, + Some(Mimes.`application/ld+json`), + AMLConfiguration.predefined().withRenderOptions(config.renderOptions.withCompactUris), + directory = s"$basePath/empty-annotation-mapping" + ) + } + + multiGoldenTest("Empty semantic extension with name has lexical and SemEx array is Virtual", "dialect.%s") { config => + cycle( + "dialect.yaml", + config.golden, + Some(Mimes.`application/ld+json`), + AMLConfiguration.predefined().withRenderOptions(config.renderOptions.withCompactUris), + directory = s"$basePath/empty-semantic-extensions" + ) + } + + multiGoldenTest("Annotation mapping with multiple domains", "dialect.%s") { config => + cycle( + "dialect.yaml", + config.golden, + Some(Mimes.`application/ld+json`), + AMLConfiguration.predefined().withRenderOptions(config.renderOptions.withCompactUris), + directory = s"$basePath/annotation-mapping-with-multiple-domains" + ) + } + + multiGoldenTest("Default facet for property mappings", "dialect.%s") { config => + cycle( + "dialect.yaml", + config.golden, + Some(Mimes.`application/ld+json`), + AMLConfiguration.predefined().withRenderOptions(config.renderOptions.withCompactUris), + directory = s"$basePath/default-facet" ) } + + multiSourceTest("Generate default facet for property mappings", "dialect.%s") { config => + cycle( + config.source, + "dialect.cycled.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = s"$basePath/default-facet" + ) + } + + multiCycleTest("Conditional facet", s"$basePath/conditional") + + multiCycleTest("Additional properties facet", s"$basePath/additional-properties") + + multiGoldenTest("Parse enum values with different types of values", "dialect.%s") { config => + cycle( + "dialect.yaml", + config.golden, + Some(Mimes.`application/ld+json`), + AMLConfiguration.predefined().withRenderOptions(config.renderOptions.withCompactUris), + directory = s"$basePath/enum-scalars" + ) + } + + multiSourceTest("Parse enum values with different types of values from JSON-LD to YAML", "dialect.%s") { config => + cycle( + config.source, + "dialect.cycled.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = s"$basePath/enum-scalars" + ) + } + + multiCycleTest("AllOf facet", s"$basePath/allOf") + + multiCycleTest("OneOf facet", s"$basePath/oneOf") + + multiCycleTest("Components facet", s"$basePath/components") + + multiCycleTest("AllOf complex", s"$basePath/allOf-complex") + + multiCycleTest("AllOf nested", s"$basePath/allOf-nested") + + multiCycleTest("AllOf nested with allOf", s"$basePath/allOf-nested-allOf") + + multiCycleTest("Extended mapping 1", s"$basePath/extended-mapping-1") + + multiCycleTest("Extended mapping 2", s"$basePath/extended-mapping-2") + + multiCycleTest("Extended mapping 3", s"$basePath/extended-mapping-3") + + multiCycleTest("MinItems facet", s"$basePath/min-items") + + multiCycleTest("Long datatype", s"$basePath/long-datatype") + } diff --git a/amf-aml/shared/src/test/scala/amf/testing/parsing/JapaneseVocabularyParsingTest.scala b/amf-aml/shared/src/test/scala/amf/testing/parsing/JapaneseVocabularyParsingTest.scala index 3d7d7dfe..cdcfca8a 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/parsing/JapaneseVocabularyParsingTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/parsing/JapaneseVocabularyParsingTest.scala @@ -2,13 +2,10 @@ package amf.testing.parsing import amf.aml.client.scala.AMLConfiguration import amf.core.client.scala.config.RenderOptions -import amf.core.internal.remote.{Amf, AmfJsonHint, Aml, Mimes, VocabularyYamlHint} +import amf.core.internal.remote.Mimes import amf.testing.common.utils.DialectTests -import scala.concurrent.ExecutionContext - class JapaneseVocabularyParsingTest extends DialectTests { - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global val basePath = "amf-aml/shared/src/test/resources/vocabularies2/japanese/dialects/" diff --git a/amf-aml/shared/src/test/scala/amf/testing/parsing/JsonDialectCycleTest.scala b/amf-aml/shared/src/test/scala/amf/testing/parsing/JsonDialectCycleTest.scala new file mode 100644 index 00000000..ee9b22df --- /dev/null +++ b/amf-aml/shared/src/test/scala/amf/testing/parsing/JsonDialectCycleTest.scala @@ -0,0 +1,22 @@ +package amf.testing.parsing + +import amf.core.internal.remote.Syntax.Json +import amf.testing.common.cycling.FunSuiteCycleTests + +class JsonDialectCycleTest extends FunSuiteCycleTests { + override def basePath: String = "amf-aml/shared/src/test/resources/vocabularies2/dialects/json/" + + test("JSON Dialect without references") { + cycle("simple/dialect.json", syntax = Some(Json)) + } + + // TODO: Fix lexical information in "uses" + test("JSON Dialect with library reference") { + cycle("with-library/dialect.json", golden = "with-library/dialect.cycled.json", syntax = Some(Json)) + } + + // TODO: Fix lexical information in "uses" + test("JSON Dialect with vocabulary reference") { + cycle("with-vocabulary/dialect.json", golden = "with-vocabulary/dialect.cycled.json", syntax = Some(Json)) + } +} diff --git a/amf-aml/shared/src/test/scala/amf/testing/parsing/JsonVocabularyCycleTest.scala b/amf-aml/shared/src/test/scala/amf/testing/parsing/JsonVocabularyCycleTest.scala new file mode 100644 index 00000000..72aaad11 --- /dev/null +++ b/amf-aml/shared/src/test/scala/amf/testing/parsing/JsonVocabularyCycleTest.scala @@ -0,0 +1,12 @@ +package amf.testing.parsing + +import amf.core.internal.remote.Syntax.Json +import amf.testing.common.cycling.FunSuiteCycleTests + +class JsonVocabularyCycleTest extends FunSuiteCycleTests { + override def basePath: String = "amf-aml/shared/src/test/resources/vocabularies2/vocabularies/json/" + + test("JSON Vocabulary without references") { + cycle("vocabulary.json", syntax = Some(Json)) + } +} diff --git a/amf-aml/shared/src/test/scala/amf/testing/parsing/VocabularyParsingTest.scala b/amf-aml/shared/src/test/scala/amf/testing/parsing/VocabularyParsingTest.scala index 9c35bc2b..582493c9 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/parsing/VocabularyParsingTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/parsing/VocabularyParsingTest.scala @@ -1,15 +1,12 @@ package amf.testing.parsing import amf.aml.client.scala.AMLConfiguration -import amf.core.internal.remote.{Amf, AmfJsonHint, Aml, Mimes, VocabularyYamlHint} +import amf.core.client.scala.config.RenderOptions +import amf.core.internal.remote.Mimes import amf.testing.common.utils.DialectTests -import scala.concurrent.ExecutionContext - class VocabularyParsingTest extends DialectTests { - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global - val basePath = "amf-aml/shared/src/test/resources/vocabularies2/vocabularies/" multiGoldenTest("parse 1 test", "example1.%s") { config => @@ -77,10 +74,22 @@ class VocabularyParsingTest extends DialectTests { } multiGoldenTest("Multiple extends test", "vocabulary.%s") { config => - cycle("vocabulary.yaml", - config.golden, - Some(Mimes.`application/ld+json`), - config.config, - directory = s"${basePath}multiple-extends/") + cycle( + "vocabulary.yaml", + config.golden, + Some(Mimes.`application/ld+json`), + config.config, + directory = s"${basePath}multiple-extends/" + ) + } + + test("Parse vocabulary in JSON") { + cycle( + "vocabulary.json", + "vocabulary.jsonld", + Some(Mimes.`application/ld+json`), + AMLConfiguration.predefined().withRenderOptions(RenderOptions().withCompactUris.withPrettyPrint), + directory = s"${basePath}../dialects/json/with-vocabulary/" + ) } } diff --git a/amf-aml/shared/src/test/scala/amf/testing/rdf/DialectInstancesRDFTest.scala b/amf-aml/shared/src/test/scala/amf/testing/rdf/DialectInstancesRDFTest.scala index 8f006b17..fa001ea1 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/rdf/DialectInstancesRDFTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/rdf/DialectInstancesRDFTest.scala @@ -1,15 +1,23 @@ package amf.testing.rdf +import amf.aml.client.scala.AMLConfiguration +import amf.core.client.scala.config.RenderOptions +import amf.rdf.client.scala.{RdfFramework, RdfUnitConverter} +import amf.rdf.internal.RdfFrameworkBuilder import amf.core.internal.remote.Syntax.Syntax import amf.core.internal.remote._ import amf.core.internal.unsafe.PlatformSecrets +import amf.core.io.FileAssertionTest import amf.testing.common.cycling.FunSuiteRdfCycleTests import amf.testing.common.utils.DialectRegistrationHelper -class DialectInstancesRDFTest extends FunSuiteRdfCycleTests with PlatformSecrets with DialectRegistrationHelper { +import scala.concurrent.Future - val basePath = "amf-aml/shared/src/test/resources/vocabularies2/instances/" - val productionPath = "amf-aml/shared/src/test/resources/vocabularies2/production/" +class DialectInstancesRDFTest extends FunSuiteRdfCycleTests with FileAssertionTest with DialectRegistrationHelper { + + val basePath = "amf-aml/shared/src/test/resources/vocabularies2/instances/" + val productionPath = "amf-aml/shared/src/test/resources/vocabularies2/production/" + protected val framework: RdfFramework = RdfFrameworkBuilder.build() test("RDF 1 test") { cycleRdfWithDialect("dialect1.yaml", "example1.yaml", "example1.ttl", None) @@ -40,58 +48,100 @@ class DialectInstancesRDFTest extends FunSuiteRdfCycleTests with PlatformSecrets } test("RDF 1 Vocabulary full test") { - cycleFullRdf("example1.yaml", - "example1.yaml", - "amf-aml/shared/src/test/resources/vocabularies2/vocabularies/", - syntax = Some(Syntax.Yaml)) + cycleFullRdf( + "example1.yaml", + "example1.yaml", + "amf-aml/shared/src/test/resources/vocabularies2/vocabularies/", + syntax = Some(Syntax.Yaml) + ) } test("RDF 1 Dialect full test") { - cycleFullRdf("example1.yaml", - "example1.yaml", - "amf-aml/shared/src/test/resources/vocabularies2/dialects/", - syntax = Some(Syntax.Yaml)) + cycleFullRdf( + "example1.yaml", + "example1.yaml", + "amf-aml/shared/src/test/resources/vocabularies2/dialects/", + syntax = Some(Syntax.Yaml) + ) } test("EngDemos vocabulary test") { - cycleFullRdf("eng_demos.yaml", - "eng_demos.yaml", - "amf-aml/shared/src/test/resources/vocabularies2/production/", - syntax = Some(Syntax.Yaml)) + cycleFullRdf( + "eng_demos.yaml", + "eng_demos.yaml", + "amf-aml/shared/src/test/resources/vocabularies2/production/", + syntax = Some(Syntax.Yaml) + ) } test("Container Configuration 0.2 ex1 test") { - cycleFullRdfWithDialect("dialect.yaml", - "ex1.yaml", - "ex1.yaml", - syntax = Some(Syntax.Yaml), - "amf-aml/shared/src/test/resources/vocabularies2/production/system2/") + cycleFullRdfWithDialect( + "dialect.yaml", + "ex1.yaml", + "ex1.yaml", + syntax = Some(Syntax.Yaml), + "amf-aml/shared/src/test/resources/vocabularies2/production/system2/" + ) } test("Container Configuration 0.2 ex2 test") { - cycleFullRdfWithDialect("dialect.yaml", - "ex2.yaml", - "ex2.yaml", - syntax = Some(Syntax.Yaml), - "amf-aml/shared/src/test/resources/vocabularies2/production/system2/") + cycleFullRdfWithDialect( + "dialect.yaml", + "ex2.yaml", + "ex2.yaml", + syntax = Some(Syntax.Yaml), + "amf-aml/shared/src/test/resources/vocabularies2/production/system2/" + ) + } + + test("Dialect instance with array of any") { + val basePath = "amf-aml/shared/src/test/resources/vocabularies2/instances/array-of-any" + val dialectPath = s"file://$basePath/dialect.yaml" + val instancePath = s"$basePath/instance.json" + + withDialect(dialectPath) { (_, config) => + for { + instanceText <- fs.asyncFile(instancePath).read() + actualText <- Future.successful { + // Cycle: JSON-LD -> RDF model -> Base Unit -> JSON-LD + val rdfDocument = framework.syntaxToRdfModel(Mimes.`application/ld+json`, instanceText) + val baseUnit = { + val id = s"file://$instancePath" + RdfUnitConverter.fromNativeRdfModel(id, rdfDocument.model, config) + } + config + .withRenderOptions(RenderOptions().withCompactUris.withPrettyPrint) + .baseUnitClient() + .render(baseUnit, Mimes.`application/ld+json`) + } + actualFile <- writeTemporaryFile(instancePath)(actualText) + assertion <- assertDifferences(actualFile, instancePath.replace(".json", ".golden.json")) + } yield { + assertion + } + } } - private def cycleRdfWithDialect(dialect: String, - source: String, - golden: String, - syntax: Option[Syntax], - directory: String = basePath) = { + private def cycleRdfWithDialect( + dialect: String, + source: String, + golden: String, + syntax: Option[Syntax], + directory: String = basePath + ) = { withDialect(s"file://$directory/$dialect") { (_, config) => cycleRdf(source, golden, config, syntax = syntax) } } - private def cycleFullRdfWithDialect(dialect: String, - source: String, - golden: String, - syntax: Option[Syntax], - directory: String = basePath) = { + private def cycleFullRdfWithDialect( + dialect: String, + source: String, + golden: String, + syntax: Option[Syntax], + directory: String = basePath + ) = { withDialect(s"file://$directory/$dialect") { (_, config) => cycleFullRdf(source, golden, directory, config, syntax) } diff --git a/amf-aml/shared/src/test/scala/amf/testing/rdf/DialectRDFTest.scala b/amf-aml/shared/src/test/scala/amf/testing/rdf/DialectRDFTest.scala index 577f550d..42bb10f5 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/rdf/DialectRDFTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/rdf/DialectRDFTest.scala @@ -2,18 +2,14 @@ package amf.testing.rdf import amf.aml.client.scala.AMLConfiguration import amf.core.client.scala.config.RenderOptions -import amf.core.internal.remote.Syntax.Syntax -import amf.core.internal.remote.{Amf, Aml, Syntax, VocabularyYamlHint} +import amf.core.internal.remote.Syntax import amf.core.internal.unsafe.PlatformSecrets import amf.testing.common.cycling.FunSuiteRdfCycleTests import amf.testing.common.utils.AMLParsingHelper -import scala.concurrent.ExecutionContext - class DialectRDFTest extends FunSuiteRdfCycleTests with PlatformSecrets with AMLParsingHelper { - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global - val productionPath = "amf-aml/shared/src/test/resources/vocabularies2/production/" + val productionPath = "amf-aml/shared/src/test/resources/vocabularies2/production/" override def basePath: String = "amf-aml/shared/src/test/resources/vocabularies2/dialects/" @@ -26,38 +22,42 @@ class DialectRDFTest extends FunSuiteRdfCycleTests with PlatformSecrets with AML } multiGoldenTest("RDF 3 test", "example3.rdf-cycled.%s") { config => - cycleFullRdf("example3.yaml", - config.golden, - directory = basePath, - AMLConfiguration.predefined().withRenderOptions(config.renderOptions), - syntax = Some(Syntax.JsonLd)) + cycleFullRdf( + "example3.yaml", + config.golden, + directory = basePath, + AMLConfiguration.predefined().withRenderOptions(config.renderOptions), + syntax = Some(Syntax.JsonLd) + ) } multiGoldenTest("RDF 13 test", "example13.rdf-cycled.%s") { config => - cycleFullRdf("example13.yaml", - config.golden, - directory = basePath, - AMLConfiguration.predefined().withRenderOptions(config.renderOptions), - syntax = Some(Syntax.JsonLd)) + cycleFullRdf( + "example13.yaml", + config.golden, + directory = basePath, + AMLConfiguration.predefined().withRenderOptions(config.renderOptions), + syntax = Some(Syntax.JsonLd) + ) } multiGoldenTest("RDF Production system2 dialect ex1 test", "dialectex1.%s") { config => cycleFullRdf( - "dialectex1.yaml", - config.golden, - directory = s"${productionPath}system2/", - AMLConfiguration.predefined().withRenderOptions(config.renderOptions), - syntax = Some(Syntax.JsonLd) + "dialectex1.yaml", + config.golden, + directory = s"${productionPath}system2/", + AMLConfiguration.predefined().withRenderOptions(config.renderOptions), + syntax = Some(Syntax.JsonLd) ) } multiGoldenTest("RDF Production system2 dialect ex2 test", "dialectex2.%s") { config => cycleFullRdf( - "dialectex2.yaml", - config.golden, - directory = s"${productionPath}system2/", - AMLConfiguration.predefined().withRenderOptions(config.renderOptions), - syntax = Some(Syntax.JsonLd) + "dialectex2.yaml", + config.golden, + directory = s"${productionPath}system2/", + AMLConfiguration.predefined().withRenderOptions(config.renderOptions), + syntax = Some(Syntax.JsonLd) ) } diff --git a/amf-aml/shared/src/test/scala/amf/testing/rdf/DialectShaclRdfTest.scala b/amf-aml/shared/src/test/scala/amf/testing/rdf/DialectShaclRdfTest.scala index e69de29b..8b137891 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/rdf/DialectShaclRdfTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/rdf/DialectShaclRdfTest.scala @@ -0,0 +1 @@ + diff --git a/amf-aml/shared/src/test/scala/amf/testing/render/ClientDialectDomainElementRenderTest.scala b/amf-aml/shared/src/test/scala/amf/testing/render/ClientDialectDomainElementRenderTest.scala index 619e3928..2780cbee 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/render/ClientDialectDomainElementRenderTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/render/ClientDialectDomainElementRenderTest.scala @@ -5,13 +5,11 @@ import amf.core.client.scala.model.domain.DomainElement import amf.core.internal.remote.{Hint, VocabularyYamlHint} import amf.testing.unclassified.ClientDomainElementTests -import scala.concurrent.ExecutionContext - class ClientDialectDomainElementRenderTest extends ClientDomainElementTests { - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global - override val basePath: String = "amf-aml/shared/src/test/resources/vocabularies2/instances/" - override val baseHint: Hint = VocabularyYamlHint - val rendering: String = "amf-aml/shared/src/test/resources/vocabularies2/rendering" + + override val basePath: String = "amf-aml/shared/src/test/resources/vocabularies2/instances/" + override val baseHint: Hint = VocabularyYamlHint + val rendering: String = "amf-aml/shared/src/test/resources/vocabularies2/rendering" val encodes: BaseUnit => Option[DomainElement] = { case e: EncodesModel => @@ -20,11 +18,13 @@ class ClientDialectDomainElementRenderTest extends ClientDomainElementTests { } test("Simple node union rendering") { - renderElement("dialect.yaml", - "instance.yaml", - encodes, - "instance-encodes.yaml", - directory = s"$rendering/simple-node-union") + renderElement( + "dialect.yaml", + "instance.yaml", + encodes, + "instance-encodes.yaml", + directory = s"$rendering/simple-node-union" + ) } test("render 1 (AMF) test") { diff --git a/amf-aml/shared/src/test/scala/amf/testing/render/DialectDomainElementRenderTest.scala b/amf-aml/shared/src/test/scala/amf/testing/render/DialectDomainElementRenderTest.scala index 4b467794..61c05554 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/render/DialectDomainElementRenderTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/render/DialectDomainElementRenderTest.scala @@ -3,17 +3,14 @@ package amf.testing.render import amf.aml.client.scala.AMLConfiguration import amf.core.client.scala.model.document.{BaseUnit, DeclaresModel, EncodesModel} import amf.core.client.scala.model.domain.DomainElement -import amf.core.internal.remote.{Amf, Hint, VocabularyYamlHint} +import amf.core.internal.remote.{Hint, VocabularyYamlHint} import amf.testing.common.utils.DomainElementCycleTests -import scala.concurrent.ExecutionContext - class DialectDomainElementRenderTest extends DomainElementCycleTests { - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global - override val basePath: String = "amf-aml/shared/src/test/resources/vocabularies2/instances/" - override val baseHint: Hint = VocabularyYamlHint - val rendering: String = "amf-aml/shared/src/test/resources/vocabularies2/rendering" + override val basePath: String = "amf-aml/shared/src/test/resources/vocabularies2/instances/" + override val baseHint: Hint = VocabularyYamlHint + val rendering: String = "amf-aml/shared/src/test/resources/vocabularies2/rendering" val encodes: BaseUnit => Option[DomainElement] = { case e: EncodesModel => @@ -28,11 +25,13 @@ class DialectDomainElementRenderTest extends DomainElementCycleTests { } test("Simple node union rendering") { - renderElement("dialect.yaml", - "instance.yaml", - encodes, - "instance-encodes.yaml", - directory = s"$rendering/simple-node-union") + renderElement( + "dialect.yaml", + "instance.yaml", + encodes, + "instance-encodes.yaml", + directory = s"$rendering/simple-node-union" + ) } test("render 1 (AMF) test") { @@ -82,11 +81,13 @@ class DialectDomainElementRenderTest extends DomainElementCycleTests { test("render 16 test") { for { loadedConfig <- AMLConfiguration.predefined().withDialect(s"file://$basePath/dialect16b.yaml") - assertion <- renderElement("dialect16a.yaml", - "example16a.yaml", - encodes, - "example16a-encodes.yaml", - baseConfig = loadedConfig) + assertion <- renderElement( + "dialect16a.yaml", + "example16a.yaml", + encodes, + "example16a-encodes.yaml", + baseConfig = loadedConfig + ) } yield { assertion } @@ -99,11 +100,13 @@ class DialectDomainElementRenderTest extends DomainElementCycleTests { test("render 16 $include test") { for { loadedConfig <- AMLConfiguration.predefined().withDialect(s"file://$basePath/dialect16b.yaml") - assertion <- renderElement("dialect16a.yaml", - "example16c.yaml", - encodes, - "example16c-encodes.yaml", - baseConfig = loadedConfig) + assertion <- renderElement( + "dialect16a.yaml", + "example16c.yaml", + encodes, + "example16c-encodes.yaml", + baseConfig = loadedConfig + ) } yield { assertion } diff --git a/amf-aml/shared/src/test/scala/amf/testing/render/DialectInstanceRenderTest.scala b/amf-aml/shared/src/test/scala/amf/testing/render/DialectInstanceRenderTest.scala index be971ab2..b8d3971e 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/render/DialectInstanceRenderTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/render/DialectInstanceRenderTest.scala @@ -4,16 +4,14 @@ import amf.aml.client.scala.AMLConfiguration import amf.aml.internal.transform.pipelines.DefaultAMLTransformationPipeline import amf.core.client.scala.config.RenderOptions import amf.core.client.scala.model.document.BaseUnit +import amf.core.internal.remote.Mimes import amf.core.internal.remote.Mimes.`application/ld+json` -import amf.core.internal.remote.{Aml, Mimes, Spec, VocabularyYamlHint} import amf.testing.common.utils.DialectTests -import scala.concurrent.ExecutionContext - class DialectInstanceRenderTest extends DialectTests { - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global - override val basePath: String = "amf-aml/shared/src/test/resources/vocabularies2/rendering" - val instances = "amf-aml/shared/src/test/resources/vocabularies2/instances/" + + override val basePath: String = "amf-aml/shared/src/test/resources/vocabularies2/rendering" + val instances = "amf-aml/shared/src/test/resources/vocabularies2/instances/" test("Simple instance rendering") { cycleWithDialect( @@ -27,222 +25,276 @@ class DialectInstanceRenderTest extends DialectTests { } test("Simple nested instance rendering") { - cycleWithDialect("dialect.yaml", - "instance.yaml", - "instance-golden.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = s"$basePath/simple-nesting") + cycleWithDialect( + "dialect.yaml", + "instance.yaml", + "instance-golden.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = s"$basePath/simple-nesting" + ) } test("Simple node union rendering") { - cycleWithDialect("dialect.yaml", - "instance.yaml", - "instance-golden.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = s"$basePath/simple-node-union") + cycleWithDialect( + "dialect.yaml", + "instance.yaml", + "instance-golden.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = s"$basePath/simple-node-union" + ) } test("render 1 (AMF) test") { - cycleWithDialect("dialect1.yaml", - "example1.yaml", - "example1.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect1.yaml", + "example1.yaml", + "example1.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 1b (AMF) test") { - cycleWithDialect("dialect1.yaml", - "example1b.yaml", - "example1b.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect1.yaml", + "example1b.yaml", + "example1b.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 1 with annotations test") { - cycleWithDialect("dialect1.yaml", - "example1_annotations.yaml", - "example1_annotations.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect1.yaml", + "example1_annotations.yaml", + "example1_annotations.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 2 test") { - cycleWithDialect("dialect2.yaml", - "example2.yaml", - "example2.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect2.yaml", + "example2.yaml", + "example2.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 3 test") { - cycleWithDialect("dialect3.yaml", - "example3.yaml", - "example3.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect3.yaml", + "example3.yaml", + "example3.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 4 test") { - cycleWithDialect("dialect4.yaml", - "example4.yaml", - "example4.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect4.yaml", + "example4.yaml", + "example4.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 5 test") { - cycleWithDialect("dialect5.yaml", - "example5.yaml", - "example5.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect5.yaml", + "example5.yaml", + "example5.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 6 test") { - cycleWithDialect("dialect6.yaml", - "example6.yaml", - "example6.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect6.yaml", + "example6.yaml", + "example6.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 6b $ref test") { - cycleWithDialect("dialect6.yaml", - "example6b.yaml", - "example6b.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect6.yaml", + "example6b.yaml", + "example6b.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 7 test") { - cycleWithDialect("dialect7.yaml", - "example7.yaml", - "example7.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect7.yaml", + "example7.yaml", + "example7.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 8 test") { - cycleWithDialect("dialect8.yaml", - "example8.yaml", - "example8.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect8.yaml", + "example8.yaml", + "example8.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 8b $include test") { - cycleWithDialect("dialect8.yaml", - "example8b.yaml", - "example8b.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect8.yaml", + "example8b.yaml", + "example8b.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 8c $ref test") { - cycleWithDialect("dialect8.yaml", - "example8c.yaml", - "example8c.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect8.yaml", + "example8c.yaml", + "example8c.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 8 (fragment) test") { - cycleWithDialect("dialect8.yaml", - "fragment8.yaml", - "fragment8.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect8.yaml", + "fragment8.yaml", + "fragment8.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 9 test") { - cycleWithDialect("dialect9.yaml", - "example9.yaml", - "example9.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect9.yaml", + "example9.yaml", + "example9.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 9b $ref test") { - cycleWithDialect("dialect9.yaml", - "example9b.yaml", - "example9b-golden.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect9.yaml", + "example9b.yaml", + "example9b-golden.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 10a test") { - cycleWithDialect("dialect10.yaml", - "example10a.yaml", - "example10a.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect10.yaml", + "example10a.yaml", + "example10a.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 10b test") { - cycleWithDialect("dialect10.yaml", - "example10b.yaml", - "example10b.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect10.yaml", + "example10b.yaml", + "example10b.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 10c test") { - cycleWithDialect("dialect10.yaml", - "example10c.yaml", - "example10c.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect10.yaml", + "example10c.yaml", + "example10c.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 11 test") { - cycleWithDialect("dialect11.yaml", - "example11.yaml", - "example11.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect11.yaml", + "example11.yaml", + "example11.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 13a (test union inline)") { - cycleWithDialect("dialect13a.yaml", - "example13a.yaml", - "example13a.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect13a.yaml", + "example13a.yaml", + "example13a.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 13b (test union)") { - cycleWithDialect("dialect13b.yaml", - "example13b.yaml", - "example13b.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect13b.yaml", + "example13b.yaml", + "example13b.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 13c (test union with extends)") { - cycleWithDialect("dialect13c.yaml", - "example13c.yaml", - "example13c.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect13c.yaml", + "example13c.yaml", + "example13c.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 14 test") { - cycleWithDialect("dialect14.yaml", - "example14.yaml", - "example14.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect14.yaml", + "example14.yaml", + "example14.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 15 test") { for { config <- AMLConfiguration.predefined().withDialect(s"file://$instances/dialect15b.yaml") - assertion <- cycleWithDialect("dialect15a.yaml", - "example15.yaml", - "example15.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances, - baseConfig = config) + assertion <- cycleWithDialect( + "dialect15a.yaml", + "example15.yaml", + "example15.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances, + baseConfig = config + ) } yield { assertion } @@ -252,12 +304,14 @@ class DialectInstanceRenderTest extends DialectTests { test("render 16 test") { for { config <- AMLConfiguration.predefined().withDialect(s"file://$instances/dialect16b.yaml") - assertion <- cycleWithDialect("dialect16a.yaml", - "example16a.yaml", - "example16a.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances, - baseConfig = config) + assertion <- cycleWithDialect( + "dialect16a.yaml", + "example16a.yaml", + "example16a.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances, + baseConfig = config + ) } yield { assertion } @@ -266,151 +320,195 @@ class DialectInstanceRenderTest extends DialectTests { test("render 16 $include test") { for { config <- AMLConfiguration.predefined().withDialect(s"file://$instances/dialect16b.yaml") - assertion <- cycleWithDialect("dialect16a.yaml", - "example16c.yaml", - "example16c.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances, - baseConfig = config) + assertion <- cycleWithDialect( + "dialect16a.yaml", + "example16c.yaml", + "example16c.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances, + baseConfig = config + ) } yield { assertion } } test("render 18 test") { - cycleWithDialect("dialect18.yaml", - "example18.yaml", - "example18.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect18.yaml", + "example18.yaml", + "example18.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 18 b test") { - cycleWithDialect("dialect18.yaml", - "example18b.yaml", - "example18b.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect18.yaml", + "example18b.yaml", + "example18b.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 19 test") { - cycleWithDialect("dialect19.yaml", - "example19.yaml", - "example19.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect19.yaml", + "example19.yaml", + "example19.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 20 test") { - cycleWithDialect("dialect20.yaml", - "example20.yaml", - "example20.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect20.yaml", + "example20.yaml", + "example20.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 23 test") { - cycleWithDialect("dialect23.yaml", - "example23.yaml", - "example23.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect23.yaml", + "example23.yaml", + "example23.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 24 test") { - cycleWithDialect("dialect24.yaml", - "example24.yaml", - "example24.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect24.yaml", + "example24.yaml", + "example24.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 24b test") { - cycleWithDialect("dialect24.yaml", - "example24b.yaml", - "example24b.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect24.yaml", + "example24b.yaml", + "example24b.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 24c test") { - cycleWithDialect("dialect24.yaml", - "example24c.yaml", - "example24c.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect24.yaml", + "example24c.yaml", + "example24c.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 27a test") { - cycleWithDialect("dialect27.yaml", - "example27a.yaml", - "example27a.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect27.yaml", + "example27a.yaml", + "example27a.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 28 test") { - cycleWithDialect("dialect28.yaml", - "example28.yaml", - "example28.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect28.yaml", + "example28.yaml", + "example28.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 30 test") { - cycleWithDialect("dialect30.yaml", - "example30.yaml", - "example30.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect30.yaml", + "example30.yaml", + "example30.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 31 test") { - cycleWithDialect("dialect31.yaml", - "example31.yaml", - "example31.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect31.yaml", + "example31.yaml", + "example31.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 29 test - keyproperty") { - cycleWithDialect("dialect29.yaml", - "example29.yaml", - "example29.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect29.yaml", + "example29.yaml", + "example29.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } test("render 29 invalid test - keyproperty") { - cycleWithDialect("dialect29.yaml", - "example29.yaml", - "example29.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect29.yaml", + "example29.yaml", + "example29.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) } // Known difference JVM - JS (JVM emits 4.0, JS emits 4) ignore("parse 32 test") { - cycleWithDialect("dialect32.yaml", - "example32.yaml", - "example32.yaml", - mediaType = Some(Mimes.`application/yaml`), - directory = instances) + cycleWithDialect( + "dialect32.yaml", + "example32.yaml", + "example32.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = instances + ) + } + + test("Big double without scientific notation") { + cycleWithDialect( + "dialect.yaml", + "instance.yaml", + "instance-golden.yaml", + mediaType = Some(Mimes.`application/yaml`), + directory = s"$basePath/double-scientific-notation" + ) } } class ResolvedDialectInstancesRenderTest extends DialectTests { - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global - override val basePath: String = "amf-aml/shared/src/test/resources/vocabularies2/rendering" - val instances = "amf-aml/shared/src/test/resources/vocabularies2/instances/" + + override val basePath: String = "amf-aml/shared/src/test/resources/vocabularies2/rendering" + val instances = "amf-aml/shared/src/test/resources/vocabularies2/instances/" test("Flatten multiple documents YAML") { - cycleWithDialect("dialect.yaml", - "dog.yaml", - "dog.flattened.yaml", - mediaType = None, - directory = s"$instances/many-documents/") + cycleWithDialect( + "dialect.yaml", + "dog.yaml", + "dog.flattened.yaml", + mediaType = None, + directory = s"$instances/many-documents/" + ) } test("Flatten multiple documents JSON-LD") { diff --git a/amf-aml/shared/src/test/scala/amf/testing/render/ParsedDialectRenderTest.scala b/amf-aml/shared/src/test/scala/amf/testing/render/ParsedDialectRenderTest.scala index 67df7a52..8ad6eea3 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/render/ParsedDialectRenderTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/render/ParsedDialectRenderTest.scala @@ -1,8 +1,6 @@ package amf.testing.render -import amf.core.client.scala.errorhandling.DefaultErrorHandler -import amf.core.client.scala.errorhandling.UnhandledErrorHandler -import amf.core.internal.remote.VocabularyYamlHint +import amf.core.client.scala.errorhandling.{DefaultErrorHandler, UnhandledErrorHandler} import amf.core.internal.unsafe.PlatformSecrets import amf.testing.common.cycling.FunSuiteCycleTests @@ -14,13 +12,24 @@ class ParsedDialectRenderTest extends FunSuiteCycleTests with PlatformSecrets { cycle("dialect.yaml", "dialect.cycled.yaml", s"${basePath}annotation-mappings/", UnhandledErrorHandler) } + test("Cycle dialect with annotation mappings with multiple domains") { + cycle( + "dialect.yaml", + "dialect.cycled.yaml", + s"${basePath}annotation-mapping-with-multiple-domains/", + UnhandledErrorHandler + ) + } + if (platform.name == "jvm") { // Due to issues with how numbers are emitted. test("Cycle dialect with annotation mappings with type discriminators") { - cycle("dialect.yaml", - "dialect.cycled.yaml", - s"${basePath}annotation-mappings-with-extra-facets/", - DefaultErrorHandler()) + cycle( + "dialect.yaml", + "dialect.cycled.yaml", + s"${basePath}annotation-mappings-with-extra-facets/", + DefaultErrorHandler() + ) } } } diff --git a/amf-aml/shared/src/test/scala/amf/testing/resolution/DialectInstanceResolutionTest.scala b/amf-aml/shared/src/test/scala/amf/testing/resolution/DialectInstanceResolutionTest.scala index 0d4a3431..a04992a2 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/resolution/DialectInstanceResolutionTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/resolution/DialectInstanceResolutionTest.scala @@ -1,15 +1,9 @@ package amf.testing.resolution +import amf.core.internal.remote.Mimes import amf.core.internal.remote.Mimes.`application/yaml` -import amf.core.internal.remote.Syntax.Yaml -import amf.core.internal.remote.{Amf, Aml, Mimes, VocabularyYamlHint} -import amf.core.internal.unsafe.PlatformSecrets -import scala.concurrent.ExecutionContext - -class DialectInstanceResolutionTest extends DialectInstanceResolutionCycleTests with PlatformSecrets { - - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global +class DialectInstanceResolutionTest extends DialectInstanceResolutionCycleTests { val basePath = "amf-aml/shared/src/test/resources/vocabularies2/instances/" @@ -38,11 +32,13 @@ class DialectInstanceResolutionTest extends DialectInstanceResolutionCycleTests } test("Resolve patch properties to AML") { - cycleWithDialect("dialect.yaml", - "patch.yaml", - "patch.resolved.yaml", - Some(`application/yaml`), - directory = s"$basePath/patch-properties/") + cycleWithDialect( + "dialect.yaml", + "patch.yaml", + "patch.resolved.yaml", + Some(`application/yaml`), + directory = s"$basePath/patch-properties/" + ) } multiGoldenTest("Resolve declares on self-encoded dialect instance", "instance.%s") { config => diff --git a/amf-aml/shared/src/test/scala/amf/testing/resolution/DialectProductionResolutionTest.scala b/amf-aml/shared/src/test/scala/amf/testing/resolution/DialectProductionResolutionTest.scala index 53b6a267..7b0dbceb 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/resolution/DialectProductionResolutionTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/resolution/DialectProductionResolutionTest.scala @@ -1,18 +1,14 @@ package amf.testing.resolution import amf.aml.client.scala.AMLConfiguration -import amf.core.client.scala.model.document.BaseUnit -import amf.core.internal.remote.{Aml, Syntax, VocabularyYamlHint} import amf.aml.internal.transform.pipelines.DefaultAMLTransformationPipeline +import amf.core.client.scala.model.document.BaseUnit +import amf.core.internal.remote.Syntax import amf.testing.common.cycling.FunSuiteCycleTests import amf.testing.common.utils.DialectInstanceTester -import scala.concurrent.ExecutionContext - class DialectProductionResolutionTest extends FunSuiteCycleTests with DialectInstanceTester { - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global - override def transform(unit: BaseUnit, config: CycleConfig, amlConfig: AMLConfiguration): BaseUnit = amlConfig.baseUnitClient().transform(unit, DefaultAMLTransformationPipeline.name).baseUnit @@ -20,11 +16,13 @@ class DialectProductionResolutionTest extends FunSuiteCycleTests with DialectIns // Order is not predictable ignore("Can parse asyncapi overlay instances") { - cycleWithDialect("dialect6.yaml", - "patch6.yaml", - "patch6.resolved.yaml", - syntax = Some(Syntax.Yaml), - basePath + "asyncapi/") + cycleWithDialect( + "dialect6.yaml", + "patch6.yaml", + "patch6.resolved.yaml", + syntax = Some(Syntax.Yaml), + basePath + "asyncapi/" + ) } } diff --git a/amf-aml/shared/src/test/scala/amf/testing/resolution/DialectsResolutionTest.scala b/amf-aml/shared/src/test/scala/amf/testing/resolution/DialectsResolutionTest.scala index 5eba40c0..2c09a6f8 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/resolution/DialectsResolutionTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/resolution/DialectsResolutionTest.scala @@ -4,13 +4,28 @@ import amf.aml.client.scala.AMLConfiguration import amf.core.client.scala.errorhandling.UnhandledErrorHandler import amf.core.internal.remote.Syntax -import scala.concurrent.ExecutionContext - class DialectsResolutionTest extends DialectResolutionCycleTests { - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global val basePath = "amf-aml/shared/src/test/resources/vocabularies2/dialects/" + private def multiCycleTest(label: String, directory: String): Unit = { + + multiGoldenTest(s"$label resolution to JSON-LD", "dialect.resolved.%s") { config => + cycle( + "dialect.yaml", + config.golden, + syntax = Some(Syntax.JsonLd), + directory = directory, + AMLConfiguration.predefined().withRenderOptions(config.renderOptions) + ) + } + + test(s"$label resolution to YAML") { + cycle("dialect.yaml", "dialect.resolved.yaml", directory, UnhandledErrorHandler) + } + + } + test("resolve include test") { cycle("example9.yaml", "example9.resolved.yaml", basePath, UnhandledErrorHandler) } @@ -38,4 +53,16 @@ class DialectsResolutionTest extends DialectResolutionCycleTests { AMLConfiguration.predefined().withRenderOptions(config.renderOptions) ) } + + multiCycleTest("AllOf (test combining resolution)", s"$basePath/allOf-complex/") + + multiCycleTest("AllOf nested (test combining resolution)", s"$basePath/allOf-nested/") + + multiCycleTest("AllOf nested with allOf (test combining resolution)", s"$basePath/allOf-nested-allOf/") + + multiCycleTest("Extended mapping 1", s"$basePath/extended-mapping-1/") + + multiCycleTest("Extended mapping 2", s"$basePath/extended-mapping-2/") + + multiCycleTest("Extended mapping 3", s"$basePath/extended-mapping-3/") } diff --git a/amf-aml/shared/src/test/scala/amf/testing/semantic/AppliedExtensionTest.scala b/amf-aml/shared/src/test/scala/amf/testing/semantic/AppliedExtensionTest.scala index 5304278b..36330da5 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/semantic/AppliedExtensionTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/semantic/AppliedExtensionTest.scala @@ -1,19 +1,20 @@ package amf.testing.semantic -import amf.aml.client.scala.model.domain.DialectDomainElement -import amf.aml.client.scala.model.document.DialectInstance import amf.aml.client.scala.AMLConfiguration +import amf.aml.client.scala.model.document.DialectInstance +import amf.aml.client.scala.model.domain.DialectDomainElement import amf.core.client.scala.errorhandling.UnhandledErrorHandler +import amf.core.common.AsyncFunSuiteWithPlatformGlobalExecutionContext import amf.core.internal.annotations.LexicalInformation import amf.core.internal.parser.domain.Value -import org.scalatest.{Assertion, AsyncFunSuite, Matchers} +import org.scalatest.Assertion +import org.scalatest.matchers.should.Matchers -import scala.concurrent.{ExecutionContext, Future} +import scala.concurrent.Future -class AppliedExtensionTest extends AsyncFunSuite with Matchers { +class AppliedExtensionTest extends AsyncFunSuiteWithPlatformGlobalExecutionContext with Matchers { - val basePath = "file://amf-aml/shared/src/test/resources/vocabularies2/semantic/" - override implicit val executionContext = ExecutionContext.Implicits.global + val basePath = "file://amf-aml/shared/src/test/resources/vocabularies2/semantic/" test("Applied extensions") { assertModel("dialect-extensions.yaml", "instance.yaml") { instance => @@ -57,6 +58,17 @@ class AppliedExtensionTest extends AsyncFunSuite with Matchers { } } + test("Nested semex 1") { + assertModel("dialect-scalar-extensions.yaml", "instance-scalar.yaml") { instance => + val extension = instance.encodes.customDomainProperties.head + extension.name.value() shouldBe "maintainer" + assertAnnotations(extension.fields.getValueAsOption("http://a.ml/vocab#maintainer").get) + + val maintainerInstance = extension.graph.scalarByProperty("http://a.ml/vocab#maintainer").head + maintainerInstance shouldEqual "Some value" + } + } + private def assertAnnotations(value: Value): Unit = { value.annotations.nonEmpty shouldBe true value.annotations.find(classOf[LexicalInformation]) shouldNot be(empty) diff --git a/amf-aml/shared/src/test/scala/amf/testing/semantic/CycledSemanticRenderTest.scala b/amf-aml/shared/src/test/scala/amf/testing/semantic/CycledSemanticRenderTest.scala new file mode 100644 index 00000000..f889dae9 --- /dev/null +++ b/amf-aml/shared/src/test/scala/amf/testing/semantic/CycledSemanticRenderTest.scala @@ -0,0 +1,33 @@ +package amf.testing.semantic + +import amf.aml.client.scala.AMLConfiguration +import amf.core.client.scala.config.RenderOptions +import amf.core.client.scala.errorhandling.UnhandledErrorHandler +import amf.core.internal.remote.Syntax.Yaml +import amf.testing.common.cycling.FunSuiteCycleTests + +import scala.concurrent.Future + +class CycledSemanticRenderTest extends FunSuiteCycleTests { + override def basePath: String = "amf-aml/shared/src/test/resources/vocabularies2/semantic/" + + test("Render object extension") { + getConfig("dialect-extensions.yaml").flatMap { config => + cycle("instance.yaml", "instance.cycled.yaml", Some(Yaml), amlConfig = config) + } + } + + test("Render scalar extension") { + getConfig("dialect-scalar-extensions.yaml").flatMap { config => + cycle("instance-scalar.yaml", "instance-scalar.yaml", Some(Yaml), amlConfig = config) + } + } + + private def getConfig(dialect: String): Future[AMLConfiguration] = { + AMLConfiguration + .predefined() + .withRenderOptions(RenderOptions().withPrettyPrint.withCompactUris) + .withErrorHandlerProvider(() => UnhandledErrorHandler) + .withDialect(s"file://$basePath" + dialect) + } +} diff --git a/amf-aml/shared/src/test/scala/amf/testing/semantic/JsonLdParsedExtensionRenderTest.scala b/amf-aml/shared/src/test/scala/amf/testing/semantic/JsonLdParsedExtensionRenderTest.scala index e86653f3..f558c92d 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/semantic/JsonLdParsedExtensionRenderTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/semantic/JsonLdParsedExtensionRenderTest.scala @@ -21,10 +21,7 @@ class JsonLdParsedExtensionRenderTest extends FunSuiteCycleTests with AsyncBefor test("Non-flattened semantic extensions with scalar range should not be rendered to JSON-LD") { getConfig("dialect-scalar-extensions.yaml").flatMap { config => - cycle("instance-scalar.yaml", - golden = "instance-scalar.parsed.jsonld", - syntax = Some(JsonLd), - amlConfig = config) + cycle("instance-scalar.yaml", golden = "instance-scalar.parsed.jsonld", syntax = Some(JsonLd), amlConfig = config) } } diff --git a/amf-aml/shared/src/test/scala/amf/testing/semantic/JsonLdSemanticExtensionsParserTest.scala b/amf-aml/shared/src/test/scala/amf/testing/semantic/JsonLdSemanticExtensionsParserTest.scala index 38258145..44b91d38 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/semantic/JsonLdSemanticExtensionsParserTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/semantic/JsonLdSemanticExtensionsParserTest.scala @@ -4,13 +4,12 @@ import amf.aml.client.scala.AMLConfiguration import amf.aml.client.scala.model.document.DialectInstance import amf.core.client.scala.config.RenderOptions import amf.core.client.scala.errorhandling.UnhandledErrorHandler -import org.scalatest.{AsyncFunSuite, Matchers} +import amf.core.common.AsyncFunSuiteWithPlatformGlobalExecutionContext +import org.scalatest.matchers.should.Matchers -import scala.concurrent.{ExecutionContext, Future} +import scala.concurrent.Future -class JsonLdSemanticExtensionsParserTest extends AsyncFunSuite with Matchers { - - override implicit def executionContext: ExecutionContext = ExecutionContext.Implicits.global +class JsonLdSemanticExtensionsParserTest extends AsyncFunSuiteWithPlatformGlobalExecutionContext with Matchers { def basePath: String = "file://amf-aml/shared/src/test/resources/vocabularies2/semantic/" diff --git a/amf-aml/shared/src/test/scala/amf/testing/semantic/JsonLdSemanticExtensionsRenderTest.scala b/amf-aml/shared/src/test/scala/amf/testing/semantic/JsonLdSemanticExtensionsRenderTest.scala index 9039b979..198e5af5 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/semantic/JsonLdSemanticExtensionsRenderTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/semantic/JsonLdSemanticExtensionsRenderTest.scala @@ -7,7 +7,6 @@ import amf.core.client.scala.model.document.BaseUnit import amf.core.internal.remote.Syntax.JsonLd import amf.testing.common.cycling.FunSuiteCycleTests import org.mulesoft.common.test.AsyncBeforeAndAfterEach -import org.scalatest.{AsyncFunSuite, BeforeAndAfterEachTestData, Matchers} import scala.concurrent.Future diff --git a/amf-aml/shared/src/test/scala/amf/testing/semantic/SemanticExtensionValidationTest.scala b/amf-aml/shared/src/test/scala/amf/testing/semantic/SemanticExtensionValidationTest.scala index d8100fec..b8d90c99 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/semantic/SemanticExtensionValidationTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/semantic/SemanticExtensionValidationTest.scala @@ -3,49 +3,46 @@ package amf.testing.semantic import amf.aml.client.scala.AMLConfiguration import amf.core.client.scala.config.RenderOptions import amf.core.client.scala.errorhandling.{DefaultErrorHandlerProvider, UnhandledErrorHandler} -import amf.testing.common.utils.{ - DialectInstanceValidation, - MultiPlatformReportComparator, - ReportComparator, - UniquePlatformReportComparator -} +import amf.testing.common.utils.{DialectInstanceValidation, MultiPlatformReportComparator, ReportComparator, UniquePlatformReportComparator} import org.scalatest.Assertion -import scala.concurrent.{ExecutionContext, Future} +import scala.concurrent.Future class SemanticExtensionValidationTest extends DialectInstanceValidation { - override implicit def executionContext: ExecutionContext = ExecutionContext.Implicits.global - override def basePath: String = "file://amf-aml/shared/src/test/resources/vocabularies2/semantic/validation/" test("Semantic extensions without mandatory properties should fail") { getConfig(Seq("object-extensions.yaml", "scalar-extensions.yaml")).flatMap { config => - validate("dialect.yaml", - "instances/invalid-obj-instance.yaml", - Some("reports/invalid-obj-report.report"), - config = config) + validate( + "dialect.yaml", + "instances/invalid-obj-instance.yaml", + Some("reports/invalid-obj-report.report"), + config = config + ) } } test("Semantic extensions without valid minimum or maximum should fail") { getConfig(Seq("object-extensions.yaml", "scalar-extensions.yaml")).flatMap { config => validate( - "dialect.yaml", - "instances/invalid-ranking-instance.yaml", - Some("reports/invalid-ranking-report.report"), - config = config, - comparator = MultiPlatformReportComparator + "dialect.yaml", + "instances/invalid-ranking-instance.yaml", + Some("reports/invalid-ranking-report.report"), + config = config, + comparator = MultiPlatformReportComparator ) } } test("Semantic extensions with boolean ranking should fail") { getConfig(Seq("object-extensions.yaml", "scalar-extensions.yaml")).flatMap { config => - validate("dialect.yaml", - "instances/invalid-ranking-type-instance.yaml", - Some("reports/invalid-ranking-type-report.report"), - config = config) + validate( + "dialect.yaml", + "instances/invalid-ranking-type-instance.yaml", + Some("reports/invalid-ranking-type-report.report"), + config = config + ) } } @@ -55,23 +52,36 @@ class SemanticExtensionValidationTest extends DialectInstanceValidation { } } + test("Unresolved links should be validated") { + getConfig(Seq("object-extensions.yaml")).flatMap { config => + validate( + "dialect.yaml", + "instances/invalid-obj-link.yaml", + Some("reports/invalid-obj-link.report"), + config = config + ) + } + } + private def getConfig(dialects: Seq[String]): Future[AMLConfiguration] = { val config = AMLConfiguration .predefined() .withRenderOptions(RenderOptions().withPrettyPrint.withCompactUris) .withErrorHandlerProvider(() => UnhandledErrorHandler) - val loadedConfig = dialects.foldLeft(Future { config }) { (acc, curr) => + val loadedConfig = dialects.foldLeft(Future.successful(config)) { (acc, curr) => acc.flatMap(config => config.withDialect(basePath + curr)) } loadedConfig.map(_.withErrorHandlerProvider(DefaultErrorHandlerProvider)) } - private def validate(dialect: String, - instance: String, - golden: Option[String] = None, - path: String = basePath, - config: AMLConfiguration, - comparator: ReportComparator = UniquePlatformReportComparator): Future[Assertion] = { + private def validate( + dialect: String, + instance: String, + golden: Option[String] = None, + path: String = basePath, + config: AMLConfiguration, + comparator: ReportComparator = UniquePlatformReportComparator + ): Future[Assertion] = { validation(dialect, instance, path, config) flatMap { comparator.assertReport(_, golden.map(g => s"$path/$g"), jsonldReport = false) } diff --git a/amf-aml/shared/src/test/scala/amf/testing/semantic/SemanticTransformationStageTest.scala b/amf-aml/shared/src/test/scala/amf/testing/semantic/SemanticTransformationStageTest.scala index 74e56b82..4282d509 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/semantic/SemanticTransformationStageTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/semantic/SemanticTransformationStageTest.scala @@ -4,14 +4,15 @@ import amf.aml.client.scala.AMLConfiguration import amf.aml.client.scala.model.document.DialectInstance import amf.aml.client.scala.model.domain.DialectDomainElement import amf.core.client.scala.errorhandling.UnhandledErrorHandler -import org.scalatest.{Assertion, AsyncFunSuite, Matchers} +import amf.core.common.AsyncFunSuiteWithPlatformGlobalExecutionContext +import org.scalatest.Assertion +import org.scalatest.matchers.should.Matchers -import scala.concurrent.{ExecutionContext, Future} +import scala.concurrent.Future -class SemanticTransformationStageTest extends AsyncFunSuite with Matchers { +class SemanticTransformationStageTest extends AsyncFunSuiteWithPlatformGlobalExecutionContext with Matchers { val basePath = "file://amf-aml/shared/src/test/resources/vocabularies2/semantic/" - override implicit val executionContext = ExecutionContext.Implicits.global test("Applied extensions") { assertModel("dialect-extensions.yaml", "instance.yaml") { instance => diff --git a/amf-aml/shared/src/test/scala/amf/testing/unclassified/DialectForInstanceTest.scala b/amf-aml/shared/src/test/scala/amf/testing/unclassified/DialectForInstanceTest.scala index e10529a8..743a7bfb 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/unclassified/DialectForInstanceTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/unclassified/DialectForInstanceTest.scala @@ -1,13 +1,13 @@ package amf.testing.unclassified import amf.aml.client.scala.AMLConfiguration -import org.scalatest.{Assertion, AsyncFunSuite, Matchers} +import amf.core.common.AsyncFunSuiteWithPlatformGlobalExecutionContext +import org.scalatest.Assertion +import org.scalatest.matchers.should.Matchers -import scala.concurrent.{ExecutionContext, Future} +import scala.concurrent.Future -class DialectForInstanceTest extends AsyncFunSuite with Matchers { - - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global +class DialectForInstanceTest extends AsyncFunSuiteWithPlatformGlobalExecutionContext with Matchers { private def basePath: String = "amf-aml/shared/src/test/resources/vocabularies2/instances/nested-dialects/" private val baseDialect: String = buildPath("base-dialect.yaml") @@ -33,11 +33,13 @@ class DialectForInstanceTest extends AsyncFunSuite with Matchers { run(instancePath, 0, 1, Seq("Test 1.0"), None) } - private def run(instancePath: String, - baseCount: Int, - expectedCount: Int, - expectedNames: Seq[String], - initialDialect: Option[String] = Some(baseDialect)): Future[Assertion] = { + private def run( + instancePath: String, + baseCount: Int, + expectedCount: Int, + expectedNames: Seq[String], + initialDialect: Option[String] = Some(baseDialect) + ): Future[Assertion] = { val initialConfig = initialDialect match { case Some(url) => AMLConfiguration.predefined().withDialect(url) case None => Future(AMLConfiguration.predefined()) diff --git a/amf-aml/shared/src/test/scala/amf/testing/unclassified/DialectProductionTest.scala b/amf-aml/shared/src/test/scala/amf/testing/unclassified/DialectProductionTest.scala index ad40259e..3e1d1fa2 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/unclassified/DialectProductionTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/unclassified/DialectProductionTest.scala @@ -8,12 +8,8 @@ import amf.core.internal.remote._ import amf.testing.common.cycling.FunSuiteCycleTests import amf.testing.common.utils.DialectInstanceTester -import scala.concurrent.ExecutionContext - class DialectProductionTest extends FunSuiteCycleTests with DialectInstanceTester { - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global - override def defaultRenderOptions: RenderOptions = RenderOptions().withSourceMaps.withPrettyPrint val basePath = "amf-aml/shared/src/test/resources/vocabularies2/production/" @@ -28,92 +24,94 @@ class DialectProductionTest extends FunSuiteCycleTests with DialectInstanceTeste multiGoldenTest("Can parse ABOUT dialect", "ABOUT-dialect.%s") { config => cycle( - "ABOUT-dialect.yaml", - config.golden, - syntax = Some(Syntax.JsonLd), - directory = basePath + "ABOUT/", - AMLConfiguration.predefined().withRenderOptions(config.renderOptions) + "ABOUT-dialect.yaml", + config.golden, + syntax = Some(Syntax.JsonLd), + directory = basePath + "ABOUT/", + AMLConfiguration.predefined().withRenderOptions(config.renderOptions) ) } // TODO migrate to multiGoldenTest test("Can parse validation dialect") { cycle( - "validation_dialect.yaml", - "validation_dialect.json", - amlConfig = AMLConfiguration - .predefined() - .withErrorHandlerProvider(() => UnhandledErrorHandler) - .withRenderOptions(RenderOptions().withPrettyPrint.withSourceMaps.withoutFlattenedJsonLd), - syntax = Some(Syntax.JsonLd) + "validation_dialect.yaml", + "validation_dialect.json", + amlConfig = AMLConfiguration + .predefined() + .withErrorHandlerProvider(() => UnhandledErrorHandler) + .withRenderOptions(RenderOptions().withPrettyPrint.withSourceMaps.withoutFlattenedJsonLd), + syntax = Some(Syntax.JsonLd) ) } // TODO migrate to multiGoldenTest test("Can parse and generate the Instagram dialect") { cycle( - "dialect.yaml", - "dialect.json", - syntax = Some(Syntax.JsonLd), - basePath + "Instagram/", - amlConfig = AMLConfiguration - .predefined() - .withErrorHandlerProvider(() => UnhandledErrorHandler) - .withRenderOptions(RenderOptions().withPrettyPrint.withSourceMaps.withoutFlattenedJsonLd) + "dialect.yaml", + "dialect.json", + syntax = Some(Syntax.JsonLd), + basePath + "Instagram/", + amlConfig = AMLConfiguration + .predefined() + .withErrorHandlerProvider(() => UnhandledErrorHandler) + .withRenderOptions(RenderOptions().withPrettyPrint.withSourceMaps.withoutFlattenedJsonLd) ) } // TODO migrate to multiGoldenTest test("Can parse and generate the activity dialect") { cycle( - "activity.yaml", - "activity.json", - syntax = Some(Syntax.JsonLd), - basePath + "streams/", - amlConfig = AMLConfiguration - .predefined() - .withErrorHandlerProvider(() => UnhandledErrorHandler) - .withRenderOptions(RenderOptions().withPrettyPrint.withSourceMaps.withoutFlattenedJsonLd) + "activity.yaml", + "activity.json", + syntax = Some(Syntax.JsonLd), + basePath + "streams/", + amlConfig = AMLConfiguration + .predefined() + .withErrorHandlerProvider(() => UnhandledErrorHandler) + .withRenderOptions(RenderOptions().withPrettyPrint.withSourceMaps.withoutFlattenedJsonLd) ) } test("Can parse validation dialect instance") { - cycleWithDialect("validation_dialect.yaml", - "validation_instance1.yaml", - "validation_instance1.yaml.yaml", - Some(Yaml)) + cycleWithDialect( + "validation_dialect.yaml", + "validation_instance1.yaml", + "validation_instance1.yaml.yaml", + Some(Yaml) + ) } multiGoldenTest("Can parse validation dialect cfg1 instance", "example1_instance.%s") { config => cycleWithDialect( - "example1.yaml", - "example1_instance.yaml", - config.golden, - directory = s"${basePath}cfg/", - renderOptions = Some(config.renderOptions), - syntax = Some(Syntax.JsonLd) + "example1.yaml", + "example1_instance.yaml", + config.golden, + directory = s"${basePath}cfg/", + renderOptions = Some(config.renderOptions), + syntax = Some(Syntax.JsonLd) ) } multiGoldenTest("Can parse validation dialect cfg2 instance", "example2_instance.%s") { config => cycleWithDialect( - "example2.yaml", - "example2_instance.yaml", - config.golden, - directory = basePath + "cfg/", - renderOptions = Some(config.renderOptions), - syntax = Some(Syntax.JsonLd) + "example2.yaml", + "example2_instance.yaml", + config.golden, + directory = basePath + "cfg/", + renderOptions = Some(config.renderOptions), + syntax = Some(Syntax.JsonLd) ) } multiGoldenTest("Can parse validation dialect cfg3 instance", "example3_instance.%s") { config => cycleWithDialect( - "example3.yaml", - "example3_instance.yaml", - config.golden, - directory = basePath + "cfg/", - renderOptions = Some(config.renderOptions), - syntax = Some(Syntax.JsonLd) + "example3.yaml", + "example3_instance.yaml", + config.golden, + directory = basePath + "cfg/", + renderOptions = Some(config.renderOptions), + syntax = Some(Syntax.JsonLd) ) } @@ -122,54 +120,64 @@ class DialectProductionTest extends FunSuiteCycleTests with DialectInstanceTeste } test("Can parse and generate ABOUT-github dialect instance") { - cycleWithDialect("ABOUT-GitHub-dialect.yaml", - "example.yaml", - "example.yaml.yaml", - Some(Yaml), - basePath + "ABOUT/github/") + cycleWithDialect( + "ABOUT-GitHub-dialect.yaml", + "example.yaml", + "example.yaml.yaml", + Some(Yaml), + basePath + "ABOUT/github/" + ) } multiGoldenTest("Can parse ABOUT-hosted dialectinstance", "ABOUT_hosted.%s") { config => cycleWithDialect( - "ABOUT-hosted-vcs-dialect.yaml", - "ABOUT_hosted.yaml", - config.golden, - directory = s"${basePath}ABOUT/", - renderOptions = Some(config.renderOptions), - syntax = Some(Syntax.JsonLd) + "ABOUT-hosted-vcs-dialect.yaml", + "ABOUT_hosted.yaml", + config.golden, + directory = s"${basePath}ABOUT/", + renderOptions = Some(config.renderOptions), + syntax = Some(Syntax.JsonLd) ) } // TODO migrate to multiGoldenTest test("Can parse and generate Instance dialect instance 1") { - cycleWithDialect("dialect.yaml", - "instance1.yaml", - "instance1.json", - syntax = Some(Syntax.JsonLd), - basePath + "Instagram/") + cycleWithDialect( + "dialect.yaml", + "instance1.yaml", + "instance1.json", + syntax = Some(Syntax.JsonLd), + basePath + "Instagram/" + ) } test("Can parse and generate Instance dialect instance 2") { - cycleWithDialect("dialect.yaml", - "instance2.yaml", - "instance2.json", - syntax = Some(Syntax.JsonLd), - basePath + "Instagram/") + cycleWithDialect( + "dialect.yaml", + "instance2.yaml", + "instance2.json", + syntax = Some(Syntax.JsonLd), + basePath + "Instagram/" + ) } test("Can parse activity instances") { - cycleWithDialect("activity.yaml", - "stream1.yaml", - "stream1.json", - syntax = Some(Syntax.JsonLd), - basePath + "streams/") + cycleWithDialect( + "activity.yaml", + "stream1.yaml", + "stream1.json", + syntax = Some(Syntax.JsonLd), + basePath + "streams/" + ) } test("Can parse activity deployments demo") { - cycleWithDialect("dialect.yaml", - "deployment.yaml", - "deployment.json", - syntax = Some(Syntax.JsonLd), - basePath + "deployments_demo/") + cycleWithDialect( + "dialect.yaml", + "deployment.yaml", + "deployment.json", + syntax = Some(Syntax.JsonLd), + basePath + "deployments_demo/" + ) } } diff --git a/amf-aml/shared/src/test/scala/amf/testing/unclassified/IteratorTest.scala b/amf-aml/shared/src/test/scala/amf/testing/unclassified/IteratorTest.scala index 325e586d..1b2e9660 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/unclassified/IteratorTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/unclassified/IteratorTest.scala @@ -1,16 +1,12 @@ package amf.testing.unclassified import amf.core.client.scala.model.domain.DomainElement -import amf.core.internal.remote.VocabularyYamlHint import amf.testing.common.utils.DialectTests -import org.scalatest.Matchers - -import scala.concurrent.ExecutionContext +import org.scalatest.matchers.should.Matchers trait IteratorTest extends DialectTests with Matchers { - val basePath = "amf-aml/shared/src/test/resources/vocabularies2/instances/" - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global + val basePath = "amf-aml/shared/src/test/resources/vocabularies2/instances/" test("Domain element iterator in self encoded dialect instance") { parseInstance("dialect23.yaml", "example23.yaml").map(baseUnit => { @@ -27,7 +23,8 @@ trait IteratorTest extends DialectTests with Matchers { assert( baseUnit .findById("file://amf-aml/shared/src/test/resources/vocabularies2/instances/example23.yaml#/lets") - .isDefined) + .isDefined + ) }) } diff --git a/amf-aml/shared/src/test/scala/amf/testing/unclassified/OOInterfaceTest.scala b/amf-aml/shared/src/test/scala/amf/testing/unclassified/OOInterfaceTest.scala index 92c8922c..3e0d3460 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/unclassified/OOInterfaceTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/unclassified/OOInterfaceTest.scala @@ -2,12 +2,10 @@ package amf.testing.unclassified import amf.aml.client.scala.AMLConfiguration import amf.aml.client.scala.model.domain.DialectDomainElement -import org.scalatest.{AsyncFunSuite, Matchers} +import amf.core.common.AsyncFunSuiteWithPlatformGlobalExecutionContext +import org.scalatest.matchers.should.Matchers -import scala.concurrent.ExecutionContext - -class OOInterfaceTest extends AsyncFunSuite with Matchers { - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global +class OOInterfaceTest extends AsyncFunSuiteWithPlatformGlobalExecutionContext with Matchers { test("Test setLiteralProperty with List") { val dialect = "file://amf-aml/shared/src/test/resources/vocabularies2/dialects/set-literal-property/dialect.yaml" diff --git a/amf-aml/shared/src/test/scala/amf/testing/unclassified/SemanticExtensionParserTest.scala b/amf-aml/shared/src/test/scala/amf/testing/unclassified/SemanticExtensionParserTest.scala index d363978e..e777f5b1 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/unclassified/SemanticExtensionParserTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/unclassified/SemanticExtensionParserTest.scala @@ -1,13 +1,13 @@ package amf.testing.unclassified import amf.aml.client.scala.AMLConfiguration -import org.scalatest.{Assertion, AsyncFunSuite, Matchers} +import amf.core.common.AsyncFunSuiteWithPlatformGlobalExecutionContext +import org.scalatest.Assertion +import org.scalatest.matchers.should.Matchers -import scala.concurrent.{ExecutionContext, Future} +import scala.concurrent.Future -class SemanticExtensionParserTest extends AsyncFunSuite with Matchers { - - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global +class SemanticExtensionParserTest extends AsyncFunSuiteWithPlatformGlobalExecutionContext with Matchers { private def basePath: String = "file://amf-aml/shared/src/test/resources/vocabularies2/dialects" diff --git a/amf-aml/shared/src/test/scala/amf/testing/validation/DialectDefinitionValidationTest.scala b/amf-aml/shared/src/test/scala/amf/testing/validation/DialectDefinitionValidationTest.scala index 2b091108..9a31caed 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/validation/DialectDefinitionValidationTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/validation/DialectDefinitionValidationTest.scala @@ -1,16 +1,12 @@ package amf.testing.validation import amf.testing.common.utils.DialectValidation -import org.scalatest.{AsyncFunSuite, Matchers} +import org.scalatest.matchers.should.Matchers -import scala.concurrent.ExecutionContext - -class DialectDefinitionValidationTest extends AsyncFunSuite with Matchers with DialectValidation { +class DialectDefinitionValidationTest extends DialectValidation with Matchers { protected val path: String = "amf-aml/shared/src/test/resources/vocabularies2/instances/invalids" - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global - test("Test missing version") { validate("/missing-version/dialect.yaml", Some("/missing-version/report.json")) } @@ -28,13 +24,17 @@ class DialectDefinitionValidationTest extends AsyncFunSuite with Matchers with D } test("Test idTemplate variables overridable by $base directive") { - validate("/base-overridable-idTemplate-variable/dialect.yaml", - Some("/base-overridable-idTemplate-variable/report.json")) + validate( + "/base-overridable-idTemplate-variable/dialect.yaml", + Some("/base-overridable-idTemplate-variable/report.json") + ) } test("Test mandatory property mapping without value") { - validate("/mandatory-property-mapping-without-value/dialect.yaml", - Some("mandatory-property-mapping-without-value/report.json")) + validate( + "/mandatory-property-mapping-without-value/dialect.yaml", + Some("mandatory-property-mapping-without-value/report.json") + ) } test("Test un-avoidable ambiguity in node") { @@ -58,8 +58,10 @@ class DialectDefinitionValidationTest extends AsyncFunSuite with Matchers with D } test("Test nested un-avoidable ambiguity in property") { - validate("/nested-unavoidable-ambiguity-property/dialect.yaml", - Some("nested-unavoidable-ambiguity-property/report.json")) + validate( + "/nested-unavoidable-ambiguity-property/dialect.yaml", + Some("nested-unavoidable-ambiguity-property/report.json") + ) } test("Test nested eventual ambiguity in node") { @@ -67,8 +69,7 @@ class DialectDefinitionValidationTest extends AsyncFunSuite with Matchers with D } test("Test nested eventual ambiguity in property") { - validate("/nested-eventual-ambiguity-property/dialect.yaml", - Some("nested-eventual-ambiguity-property/report.json")) + validate("/nested-eventual-ambiguity-property/dialect.yaml", Some("nested-eventual-ambiguity-property/report.json")) } test("Test node mapping with reserved names") { @@ -84,37 +85,117 @@ class DialectDefinitionValidationTest extends AsyncFunSuite with Matchers with D } test("Lexical range in unknown object range terms") { - validate("/invalid-union-objectRange/dialect.yaml", - Some("/invalid-union-objectRange/dialect.report"), - jsonldReport = false) + validate( + "/invalid-union-objectRange/dialect.yaml", + Some("/invalid-union-objectRange/dialect.report"), + jsonldReport = false + ) } test("Lexical range of unknown property used as map key") { - validate("/unknown-map-key-property/dialect.yaml", - Some("/unknown-map-key-property/dialect.report"), - jsonldReport = false) + validate( + "/unknown-map-key-property/dialect.yaml", + Some("/unknown-map-key-property/dialect.report"), + jsonldReport = false + ) } test("Empty type discriminator value") { validate( - "/empty-discriminator-value/dialect-with-empty-type-discriminator-value.yaml", - Some("/empty-discriminator-value/dialect-with-empty-type-discriminator-value.report"), - jsonldReport = false + "/empty-discriminator-value/dialect-with-empty-type-discriminator-value.yaml", + Some("/empty-discriminator-value/dialect-with-empty-type-discriminator-value.report"), + jsonldReport = false ) } test("Validate annotation mappings & semantic extensions") { validate( - "/annotation-mappings-invalid/dialect.yaml", - Some("/annotation-mappings-invalid/report.report"), - jsonldReport = false + "/annotation-mappings-invalid/dialect.yaml", + Some("/annotation-mappings-invalid/report.report"), + jsonldReport = false ) } test("Property mapping with null range") { validate( - "/null-range/dialect.yaml", - Some("/null-range/report.json") + "/null-range/dialect.yaml", + Some("/null-range/report.json") + ) + } + + test("JSON simple should be valid") { + validate("../../../dialects/json/simple/dialect.json", None) + } + + test("JSON with-library should be valid") { + validate("../../../dialects/json/with-library/dialect.json", None) + } + + test("JSON with-vocabulary should be valid") { + validate("../../../dialects/json/with-vocabulary/dialect.json", None) + } + + test("Empty extends property on node mapping reports error") { + validate( + "../../../dialects/empty-extends-on-node-mapping.yaml", + Some("../../dialects/empty-extends-on-node-mapping.validation.jsonld") + ) + } + + test("Valid ID directive on dialect") { + validate("/id-directive-valid/dialect.yaml", Some("/id-directive-valid/report.txt"), jsonldReport = false) + } + + test("Invalid ID directive on dialect") { + validate("/id-directive-invalid/dialect.yaml", Some("/id-directive-invalid/report.txt"), jsonldReport = false) + } + + test("Dialect with property mapping with default key") { + validate("../../../dialects/default-facet/dialect.yaml", None) + } + + test("Dialect with if/then/else facets") { + validate("../../../dialects/conditional/dialect.yaml", None) + } + + test("Dialect with if/then/else facet that point to nowhere") { + validate( + "../../../dialects/conditional/dialect-with-invalid-references.yaml", + Some("../../dialects/conditional/dialect-with-invalid-references.report.json") + ) + } + + test("Dialect with NodeMapping with additional properties") { + validate("../../../dialects/additional-properties/dialect.yaml", None) + } + + test("Numeric enums in dialect get validated against their property mapping") { + validate( + "../../../dialects/enum-dialect-validation/dialect.yaml", + Some("../../dialects/enum-dialect-validation/report.json") ) } + + test("String enum in dialect get validated against their numeric property mapping") { + validate( + "../../../dialects/enum-dialect-validation-incorrect-type/dialect.yaml", + Some("../../dialects/enum-dialect-validation-incorrect-type/report.json") + ) + } + + test("Node mapping with multiple properties with enums - Valid") { + validate("/dialect-enum-multiple-validations/valid.json", None) + } + + test("Node mapping with multiple properties with enums - Invalid") { + validate("/dialect-enum-multiple-validations/invalid.json", Some("/dialect-enum-multiple-validations/report.json")) + } + + test("Node mapping with single properties with enums - Valid") { + validate("/dialect-enum-single-validations/valid.json", None) + } + + test("Node mapping with single properties with enums - Invalid") { + validate("/dialect-enum-single-validations/invalid.json", Some("/dialect-enum-single-validations/report.json")) + } } diff --git a/amf-aml/shared/src/test/scala/amf/testing/validation/DialectInstancesValidationTest.scala b/amf-aml/shared/src/test/scala/amf/testing/validation/DialectInstancesValidationTest.scala index c8278767..7578fc5b 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/validation/DialectInstancesValidationTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/validation/DialectInstancesValidationTest.scala @@ -4,22 +4,22 @@ import amf.aml.client.scala.AMLConfiguration import amf.testing.common.utils.{DialectInstanceValidation, ReportComparator, UniquePlatformReportComparator} import org.scalatest.Assertion -import scala.concurrent.{ExecutionContext, Future} +import scala.concurrent.Future trait DialectInstancesValidationTest extends DialectInstanceValidation { - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global - val basePath = "file://amf-aml/shared/src/test/resources/vocabularies2/validation" val productionPath = "file://amf-aml/shared/src/test/resources/vocabularies2/production" val instancesPath = "file://amf-aml/shared/src/test/resources/vocabularies2/instances" private val reportComparator: ReportComparator = UniquePlatformReportComparator - def validate(dialect: String, - instance: String, - golden: Option[String] = None, - path: String = basePath, - config: AMLConfiguration = AMLConfiguration.predefined()): Future[Assertion] = { + def validate( + dialect: String, + instance: String, + golden: Option[String] = None, + path: String = basePath, + config: AMLConfiguration = AMLConfiguration.predefined() + ): Future[Assertion] = { validation(dialect, instance, path, config) flatMap { reportComparator.assertReport(_, golden.map(g => s"$path/$g")) } @@ -102,10 +102,12 @@ trait DialectInstancesValidationTest extends DialectInstanceValidation { test("validation dialect 8 example 1 incorrect") { for { nextConfig <- AMLConfiguration.predefined().withDialect(s"$basePath/dialect8b.yaml") - assertion <- validate("dialect8a.yaml", - "instance8_incorrect1.yaml", - Some("instance8_incorrect1.report.json"), - config = nextConfig) + assertion <- validate( + "dialect8a.yaml", + "instance8_incorrect1.yaml", + Some("instance8_incorrect1.report.json"), + config = nextConfig + ) } yield { assertion } @@ -133,7 +135,8 @@ trait DialectInstancesValidationTest extends DialectInstanceValidation { // TODO: un-ignore when AML re-implements the validation ignore("validation dialect 10 example 2 incorrect - Dialect ID in both key and comment") { validate("dialect9.yaml", "instance9_correct1.yaml").flatMap(_ => - validate("dialect10.yaml", "instance10_incorrect2.yaml")) + validate("dialect10.yaml", "instance10_incorrect2.yaml") + ) // 1st error -> Dialect 9 defined in Header and Dialect 10 as key (validation and parse Dialect 9 as fallback) // 2nd error -> Dialect 9 does not accepts Dialect 10 key as a Root declaration } @@ -143,9 +146,11 @@ trait DialectInstancesValidationTest extends DialectInstanceValidation { } test("validation mule_config example 2 incorrect") { - validate("mule_config_dialect1.yaml", - "mule_config_instance_incorrect2.yaml", - Some("mule_config_instance_incorrect2.report.json")) + validate( + "mule_config_dialect1.yaml", + "mule_config_instance_incorrect2.yaml", + Some("mule_config_instance_incorrect2.report.json") + ) } test("validation eng_demos example 1 correct") { @@ -153,10 +158,12 @@ trait DialectInstancesValidationTest extends DialectInstanceValidation { } test("Can validate asyncapi 0.1 error") { - validate("dialect1.yaml", - "example1.yaml", - path = s"$productionPath/asyncapi", - golden = Some("example1.report.json")) + validate( + "dialect1.yaml", + "example1.yaml", + path = s"$productionPath/asyncapi", + golden = Some("example1.report.json") + ) } test("Can validate asyncapi 0.2 correct") { @@ -188,26 +195,32 @@ trait DialectInstancesValidationTest extends DialectInstanceValidation { } test("Validate native link with colliding properties") { - validate("dialect.yaml", - "instance.yaml", - Some("report.json"), - path = s"$basePath/native-link-with-colliding-properties") + validate( + "dialect.yaml", + "instance.yaml", + Some("report.json"), + path = s"$basePath/native-link-with-colliding-properties" + ) } // This should be invalid! test("Validate native link with extra properties") { - validate("dialect.yaml", - "instance.yaml", - Some("report.json"), - path = s"$basePath/native-link-with-extra-properties") + validate( + "dialect.yaml", + "instance.yaml", + Some("report.json"), + path = s"$basePath/native-link-with-extra-properties" + ) } // This should be invalid! test("Validate native link with $base without $id") { - validate("dialect.yaml", - "instance.yaml", - Some("report.json"), - path = s"$basePath/native-link-with-$$base-without-$$id") + validate( + "dialect.yaml", + "instance.yaml", + Some("report.json"), + path = s"$basePath/native-link-with-$$base-without-$$id" + ) } test("Validate additional nodes in union node") { @@ -219,9 +232,11 @@ trait DialectInstancesValidationTest extends DialectInstanceValidation { } test("Invalid self encoded dialect") { - validate("self-encoded-dialect.yaml", - "self-encoded-dialect-instance.yaml", - Some("self-encoded-dialect-instance.report.json")) + validate( + "self-encoded-dialect.yaml", + "self-encoded-dialect-instance.yaml", + Some("self-encoded-dialect-instance.report.json") + ) } test("JSON $dialect ref to registered dialect") { @@ -231,4 +246,81 @@ trait DialectInstancesValidationTest extends DialectInstanceValidation { test("jsonld instance with link range parsed with dialect that defines any range") { validate("dialect.yaml", "instance.golden.flattened.jsonld", path = s"$instancesPath/link-range") } + + test("JSON Instance with Union at root level should omit the $dialect entry") { + validate( + "dialect.yaml", + "instance.json", + path = s"$instancesPath/json-root-union/" + ) + } + + test("One node should validate check for additional props and another shouldn't") { + validate("dialect.yaml", "instance.yaml", Some("report.json"), path = s"$instancesPath/additional-properties/") + } + + test("Enum with integer values") { + validate("dialect.yaml", "instance.yaml", Some("report.json"), path = s"$basePath/enum-integer") + } + + test("Enum with double values") { + validate("dialect.yaml", "instance.yaml", Some("report.json"), path = s"$basePath/enum-double") + } + + test("Enum with boolean values") { + validate("dialect.yaml", "instance.yaml", Some("report.json"), path = s"$basePath/enum-boolean") + } + + test("MinItems 0 with mandatory true valid") { + validate("dialect.yaml", "instance-valid.yaml", None, path = s"$basePath/minItems-0-mandatory-true") + } + + test("MinItems 0 with mandatory true invalid") { + validate( + "dialect.yaml", + "instance-invalid.yaml", + Some("report.json"), + path = s"$basePath/minItems-0-mandatory-true" + ) + } + + test("MinItems n with mandatory false valid 1") { + validate("dialect.yaml", "instance-valid-1.yaml", None, path = s"$basePath/minItems-n-mandatory-false") + } + + test("MinItems n with mandatory false valid 2") { + validate("dialect.yaml", "instance-valid-2.yaml", None, path = s"$basePath/minItems-n-mandatory-false") + } + + test("MinItems n with mandatory false invalid") { + validate( + "dialect.yaml", + "instance-invalid.yaml", + Some("report.json"), + path = s"$basePath/minItems-n-mandatory-false" + ) + } + + test("MinItems n with mandatory true valid") { + validate("dialect.yaml", "instance-valid.yaml", None, path = s"$basePath/minItems-n-mandatory-true") + } + + test("MinItems n with mandatory true invalid") { + validate( + "dialect.yaml", + "instance-invalid.yaml", + Some("report.json"), + path = s"$basePath/minItems-n-mandatory-true" + ) + } + + test("Long datatype test") { + validate( + "dialect.yaml", + "instance.yaml", + None, + path = s"$instancesPath/long-datatype" + ) + } + } diff --git a/amf-aml/shared/src/test/scala/amf/testing/validation/JapaneseDialectInstancesValidationTest.scala b/amf-aml/shared/src/test/scala/amf/testing/validation/JapaneseDialectInstancesValidationTest.scala index a07e4c2f..411557f9 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/validation/JapaneseDialectInstancesValidationTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/validation/JapaneseDialectInstancesValidationTest.scala @@ -8,19 +8,20 @@ import amf.testing.common.utils.{ } import org.scalatest.Assertion -import scala.concurrent.{ExecutionContext, Future} +import scala.concurrent.Future class JapaneseDialectInstancesValidationTest extends DialectInstanceValidation with AMLParsingHelper { - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global - private val reportComparator: ReportComparator = UniquePlatformReportComparator + private val reportComparator: ReportComparator = UniquePlatformReportComparator val basePath = "file://amf-aml/shared/src/test/resources/vocabularies2/japanese/instances/" - def validate(dialect: String, - instance: String, - golden: Option[String] = None, - path: String = basePath): Future[Assertion] = { + def validate( + dialect: String, + instance: String, + golden: Option[String] = None, + path: String = basePath + ): Future[Assertion] = { validation(dialect, instance, path) flatMap { reportComparator.assertReport(_, golden.map(g => s"$path/$g")) } diff --git a/amf-aml/shared/src/test/scala/amf/testing/validation/VocabularyDefinitionValidationTest.scala b/amf-aml/shared/src/test/scala/amf/testing/validation/VocabularyDefinitionValidationTest.scala index b007befe..9bafae9f 100644 --- a/amf-aml/shared/src/test/scala/amf/testing/validation/VocabularyDefinitionValidationTest.scala +++ b/amf-aml/shared/src/test/scala/amf/testing/validation/VocabularyDefinitionValidationTest.scala @@ -1,25 +1,15 @@ package amf.testing.validation import amf.aml.client.scala.AMLConfiguration -import amf.core.client.scala.errorhandling.DefaultErrorHandler -import amf.core.internal.validation.ValidationConfiguration -import amf.core.io.FileAssertionTest -import amf.core.internal.unsafe.PlatformSecrets import amf.core.client.scala.validation.AMFValidationReport -import amf.core.internal.parser.{AMFCompiler, CompilerContextBuilder} +import amf.core.io.FileAssertionTest import amf.validation.internal.emitters.ValidationReportJSONLDEmitter import org.scalatest -import org.scalatest.{AsyncFunSuite, Matchers} - -import scala.concurrent.{ExecutionContext, Future} +import org.scalatest.matchers.should.Matchers -class VocabularyDefinitionValidationTest - extends AsyncFunSuite - with Matchers - with FileAssertionTest - with PlatformSecrets { +import scala.concurrent.Future - override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global +class VocabularyDefinitionValidationTest extends FileAssertionTest with Matchers { val basePath = "amf-aml/shared/src/test/resources/vocabularies2/validations/vocabularies" @@ -43,9 +33,23 @@ class VocabularyDefinitionValidationTest validate("vocabulary.yaml", Some("validation.jsonld"), "missing-property-term") } - protected def validate(vocabulary: String, - goldenReport: Option[String] = None, - path: String): Future[scalatest.Assertion] = { + test("Validate vocabulary in JSON") { + validate("vocabulary.json", None, "../../dialects/json/with-vocabulary") + } + + test("Property term parsing with null entries uses errorHandler") { + validate("property-term-with-null-entries.yaml", Some("property-term-with-null-entries.jsonld"), "parser-errors") + } + + test("Class term parsing with null entries uses errorHandler") { + validate("class-term-with-null-entries.yaml", Some("class-term-with-null-entries.jsonld"), "parser-errors") + } + + protected def validate( + vocabulary: String, + goldenReport: Option[String] = None, + path: String + ): Future[scalatest.Assertion] = { val configuration = AMLConfiguration.predefined() val report = for { report <- configuration diff --git a/amf-rdf/js/src/main/resources/shacl.js b/amf-rdf/js/src/main/resources/shacl.js index f98a8e37..a3df4168 100644 --- a/amf-rdf/js/src/main/resources/shacl.js +++ b/amf-rdf/js/src/main/resources/shacl.js @@ -17461,11 +17461,11 @@ class DynamicNestedLoopJoin extends MultiTransformIterator constructor (left, funRight, funJoin) { super(left); - + this.funRight = funRight; this.funJoin = funJoin; } - + _createTransformer (leftItem) { return new SimpleTransformIterator(this.funRight(leftItem), { transform: (rightItem, done) => @@ -17489,24 +17489,24 @@ class HashJoin extends AsyncIterator constructor (left, right, funHash, funJoin) { super(right); - + this.left = left; this.right = right; this.funHash = funHash; this.funJoin = funJoin; - + this.leftMap = new Map(); - + this.match = null; this.matches = []; this.matchIdx = 0; - - + + this.readable = false; - + this.left.on('end', allowJoining.bind(this)); this.left.on('data', addItem.bind(this)); - + function addItem (item) { let hash = this.funHash(item); @@ -17524,24 +17524,24 @@ class HashJoin extends AsyncIterator this.right.on('end', () => { if (!this.hasResults()) this._end(); }); } } - + hasResults () { return !this.right.ended || this.matchIdx < this.matches.length; } - + close () { super.close(); this.left.close(); this.right.close(); } - + read () { if (this.ended || !this.readable) return null; - + while (this.matchIdx < this.matches.length) { let item = this.matches[this.matchIdx++]; @@ -17549,22 +17549,22 @@ class HashJoin extends AsyncIterator if (result !== null) return result; } - + if (!this.hasResults()) this._end(); - + this.match = this.right.read(); - + if (this.match === null) { this.readable = false; return null; } - + let hash = this.funHash(this.match); this.matches = this.leftMap.get(hash) || []; this.matchIdx = 0; - + // array is filled again so recursive call can have results return this.read(); } @@ -17583,18 +17583,18 @@ class NestedLoopJoin extends MultiTransformIterator constructor (left, right, funJoin) { super(left); - + this.right = right; this.funJoin = funJoin; // function that joins 2 elements or returns null if join is not possible this.on('end', () => this.right.close()); } - + close () { super.close(); this.right.close(); } - + _createTransformer (leftItem) { return new SimpleTransformIterator(this.right.clone(), { transform: (rightItem, done) => @@ -17618,36 +17618,36 @@ class SymmetricHashJoin extends AsyncIterator constructor (left, right, funHash, funJoin) { super(); - + this.left = left; this.right = right; - + this.funHash = funHash; this.funJoin = funJoin; - + this.usedLeft = false; this.leftMap = new Map(); this.rightMap = new Map(); - + this.on('end', () => this._cleanup() ); - + this.match = null; this.matches = []; this.matchIdx = 0; - + this.left.on ('readable', () => this.readable = true); this.right.on('readable', () => this.readable = true); - + // this needs to be here since it's possible the left/right streams only get ended after there are no more results left this.left.on ('end', () => { if (!this.hasResults()) this._end(); }); this.right.on('end', () => { if (!this.hasResults()) this._end(); }); } - + hasResults() { return !this.left.ended || !this.right.ended || this.matchIdx < this.matches.length; } - + _cleanup () { // motivate garbage collector to remove these @@ -17655,19 +17655,19 @@ class SymmetricHashJoin extends AsyncIterator this.rightMap = null; this.matches = null; } - + close () { super.close(); this.left.close(); this.right.close(); } - + read () { if (this.ended) return null; - + while (this.matchIdx < this.matches.length) { let item = this.matches[this.matchIdx++]; @@ -17675,39 +17675,39 @@ class SymmetricHashJoin extends AsyncIterator if (result !== null) return result; } - + if (!this.hasResults()) this._end(); - + let item = null; // try both streams if the first one has no value for (let i = 0; i < 2; ++i) { item = this.usedLeft ? this.right.read() : this.left.read(); this.usedLeft = !this.usedLeft; // try other stream next time - + // found a result, no need to check the other stream this run if (item !== null) break; } - + if (item === null) { this.readable = false; return null; } - + let hash = this.funHash(item); let map = this.usedLeft ? this.leftMap : this.rightMap; if (!map.has(hash)) map.set(hash, []); let arr = map.get(hash); arr.push(item); - + this.match = item; this.matches = (this.usedLeft ? this.rightMap : this.leftMap).get(hash) || []; this.matchIdx = 0; - + // array is filled again so recursive call can have results return this.read(); } @@ -17724,45 +17724,45 @@ class MergeIterator extends AsyncIterator constructor (streams) { super(); - + if (!Array.isArray(streams)) streams = Array.prototype.slice.call(arguments); - + this.streams = streams; - + for (let stream of streams) { stream.on('readable', () => this.emit('readable')); stream.on('end', () => this._removeStream(stream)); } - + if (this.streams.length === 0) this.close(); - + this.idx = this.streams.length-1; } - + _removeStream (stream) { let idx = this.streams.indexOf(stream); if (idx < 0) return; - + this.streams.splice(idx, 1); if (this.idx >= this.streams.length) --this.idx; - + if (this.streams.length === 0) this._end(); } - + close () { super.close(); for (let stream of this.streams) stream.close(); } - + read () { for (let attempts = 0; attempts < this.streams.length; ++attempts) @@ -17772,7 +17772,7 @@ class MergeIterator extends AsyncIterator if (item !== null) return item; } - + return null; } } @@ -46291,7 +46291,7 @@ var Parser = /** @class */ (function (_super) { this._tagname = name; if (!this._options.xmlMode && Object.prototype.hasOwnProperty.call(openImpliesClose, name)) { - for (var el = void 0; + for (var el = void 0; // @ts-ignore openImpliesClose[name].has((el = this._stack[this._stack.length - 1])); this.onclosetag(el)) ; @@ -48246,7 +48246,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { var array = this._array; var maxIndex = array.length - 1; var ii = 0; - return new Iterator(function() + return new Iterator(function() {return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii, array[reverse ? maxIndex - ii++ : ii++])} @@ -48717,7 +48717,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { Repeat.prototype.__iterator = function(type, reverse) {var this$0 = this; var ii = 0; - return new Iterator(function() + return new Iterator(function() {return ii < this$0.size ? iteratorValue(type, ii++, this$0._value) : iteratorDone()} ); }; @@ -50915,7 +50915,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { return flipSequence; }; } - reversedSequence.get = function(key, notSetValue) + reversedSequence.get = function(key, notSetValue) {return iterable.get(useKeys ? key : -1 - key, notSetValue)}; reversedSequence.has = function(key ) {return iterable.has(useKeys ? key : -1 - key)}; @@ -51114,7 +51114,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { return this.cacheResult().__iterate(fn, reverse); } var iterations = 0; - iterable.__iterate(function(v, k, c) + iterable.__iterate(function(v, k, c) {return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$0)} ); return iterations; @@ -51305,7 +51305,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { interposedSequence.size = iterable.size && iterable.size * 2 -1; interposedSequence.__iterateUncached = function(fn, reverse) {var this$0 = this; var iterations = 0; - iterable.__iterate(function(v, k) + iterable.__iterate(function(v, k) {return (!iterations || fn(separator, iterations++, this$0) !== false) && fn(v, iterations++, this$0) !== false}, reverse @@ -53044,26 +53044,26 @@ var at, // The index of the current character text: text }; }, - + next = function (c) { // If a c parameter is provided, verify that it matches the current character. if (c && c !== ch) { error("Expected '" + c + "' instead of '" + ch + "'"); } - + // Get the next character. When there are no more characters, // return the empty string. - + ch = text.charAt(at); at += 1; return ch; }, - + number = function () { // Parse a number value. var number, string = ''; - + if (ch === '-') { string = '-'; next('-'); @@ -53097,14 +53097,14 @@ var at, // The index of the current character return number; } }, - + string = function () { // Parse a string value. var hex, i, string = '', uffff; - + // When parsing for string values, we must look for " and \ characters. if (ch === '"') { while (next()) { @@ -53261,7 +53261,7 @@ value = function () { module.exports = function (source, reviver) { var result; - + text = source; at = 0; ch = ' '; @@ -53316,7 +53316,7 @@ function quote(string) { // backslash characters, then we can safely slap some quotes around it. // Otherwise we must also replace the offending characters with safe escape // sequences. - + escapable.lastIndex = 0; return escapable.test(string) ? '"' + string.replace(escapable, function (a) { var c = meta[a]; @@ -53334,47 +53334,47 @@ function str(key, holder) { mind = gap, partial, value = holder[key]; - + // If the value has a toJSON method, call it to obtain a replacement value. if (value && typeof value === 'object' && typeof value.toJSON === 'function') { value = value.toJSON(key); } - + // If we were called with a replacer function, then call the replacer to // obtain a replacement value. if (typeof rep === 'function') { value = rep.call(holder, key, value); } - + // What happens next depends on the value's type. switch (typeof value) { case 'string': return quote(value); - + case 'number': // JSON numbers must be finite. Encode non-finite numbers as null. return isFinite(value) ? String(value) : 'null'; - + case 'boolean': case 'null': // If the value is a boolean or null, convert it to a string. Note: // typeof null does not produce 'null'. The case is included here in // the remote chance that this gets fixed someday. return String(value); - + case 'object': if (!value) return 'null'; gap += indent; partial = []; - + // Array.isArray if (Object.prototype.toString.apply(value) === '[object Array]') { length = value.length; for (i = 0; i < length; i += 1) { partial[i] = str(i, value) || 'null'; } - + // Join all of the elements together, separated with commas, and // wrap them in brackets. v = partial.length === 0 ? '[]' : gap ? @@ -53383,7 +53383,7 @@ function str(key, holder) { gap = mind; return v; } - + // If the replacer is an array, use it to select the members to be // stringified. if (rep && typeof rep === 'object') { @@ -53409,7 +53409,7 @@ function str(key, holder) { } } } - + // Join all of the member texts together, separated with commas, // and wrap them in braces. @@ -53425,7 +53425,7 @@ module.exports = function (value, replacer, space) { var i; gap = ''; indent = ''; - + // If the space parameter is a number, make an indent string containing that // many spaces. if (typeof space === 'number') { @@ -53445,7 +53445,7 @@ module.exports = function (value, replacer, space) { && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) { throw new Error('JSON.stringify'); } - + // Make a fake root object containing our value under the key of ''. // Return the result of stringifying the value. return str('', {'': value}); @@ -70438,7 +70438,7 @@ function parseLink(link) { var info = parts .reduce(createObjects, {}); - + info = xtend(qry, info); info.url = linkUrl; return info; @@ -86268,7 +86268,7 @@ case 1: $$[$0-1].prefixes = Parser.prefixes; Parser.prefixes = null; return $$[$0-1]; - + break; case 3: this.$ = extend($$[$0-1], $$[$0], { type: 'query' }); @@ -86277,7 +86277,7 @@ case 4: Parser.base = resolveIRI($$[$0]) base = basePath = baseRoot = ''; - + break; case 5: @@ -86285,7 +86285,7 @@ case 5: $$[$0-1] = $$[$0-1].substr(0, $$[$0-1].length - 1); $$[$0] = resolveIRI($$[$0]); Parser.prefixes[$$[$0-1]] = $$[$0]; - + break; case 6: case 7: this.$ = extend($$[$0-3], groupDatasets($$[$0-2]), $$[$0-1], $$[$0]); @@ -86371,12 +86371,12 @@ break; case 40: this.$ = $$[$0-1].map(function(v) { var o = {}; o[$$[$0-3]] = v; return o; }) - + break; case 41: this.$ = $$[$0-1].map(function() { return {}; }) - + break; case 42: @@ -86390,7 +86390,7 @@ case 42: valuesObject['?' + $$[$0-4][i].value] = values[i]; return valuesObject; }); - + break; case 45: this.$ = undefined; @@ -86441,7 +86441,7 @@ case 63: case 64: this.$ = { type: 'graph', name: $$[$0] }; break; case 65: - this.$ = {}; this.$[lowercase($$[$0])] = true; + this.$ = {}; this.$[lowercase($$[$0])] = true; break; case 66: this.$ = $$[$0-2] ? unionAll($$[$0-1], [$$[$0-2]]) : unionAll($$[$0-1]); @@ -86450,7 +86450,7 @@ case 67: var graph = extend($$[$0-3] || { triples: [] }, { type: 'graph', name: toVar($$[$0-5]) }); this.$ = $$[$0] ? [graph, $$[$0]] : [graph]; - + break; case 68: case 73: this.$ = { type: 'bgp', triples: unionAll($$[$0-2], [$$[$0-1]]) }; @@ -86473,7 +86473,7 @@ case 74: this.$ = { type: 'union', patterns: unionAll($$[$0-1].map(degroupSingle), [degroupSingle($$[$0])]) }; else this.$ = $$[$0]; - + break; case 75: this.$ = extend($$[$0], { type: 'optional' }); @@ -86690,7 +86690,7 @@ case 192: if (!expansion) throw new Error('Unknown prefix: ' + prefix); var uriString = resolveIRI(expansion + $$[$0].substr(namePos + 1)); this.$ = Parser.factory.namedNode(uriString); - + break; case 193: @@ -86698,7 +86698,7 @@ case 193: if (!($$[$0] in Parser.prefixes)) throw new Error('Unknown prefix: ' + $$[$0]); var uriString = resolveIRI(Parser.prefixes[$$[$0]]); this.$ = Parser.factory.namedNode(uriString); - + break; case 201: case 209: case 211: case 213: case 223: case 225: case 231: case 235: case 239: case 253: case 255: case 257: case 259: case 261: case 263: case 265: case 267: case 292: case 298: case 309: case 325: case 357: case 369: case 388: case 390: case 392: case 394: case 404: case 408: case 410: case 412: $$[$0-1].push($$[$0]); @@ -88899,7 +88899,7 @@ var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode, f self.url = response.url self.statusCode = response.status self.statusMessage = response.statusText - + response.headers.forEach(function (header, key){ self.headers[key.toLowerCase()] = header self.rawHeaders.push(key, header) @@ -93839,15 +93839,15 @@ var objectHelper = (function () { function isString (value) { return Object.prototype.toString.apply(value) === '[object String]'; } - + function isNumber (value) { return Object.prototype.toString.apply(value) === '[object Number]'; } - + function isBoolean (value) { return Object.prototype.toString.apply(value) === '[object Boolean]'; } - + function join (arr, separator) { var result = '', @@ -96867,13 +96867,13 @@ Script.prototype.runInContext = function (context) { if (!(context instanceof Context)) { throw new TypeError("needs a 'context' argument."); } - + var iframe = document.createElement('iframe'); if (!iframe.style) iframe.style = {}; iframe.style.display = 'none'; - + document.body.appendChild(iframe); - + var win = iframe.contentWindow; var wEval = win.eval, wExecScript = win.execScript; @@ -96882,7 +96882,7 @@ Script.prototype.runInContext = function (context) { wExecScript.call(win, 'null'); wEval = win.eval; } - + forEach(Object_keys(context), function (key) { win[key] = context[key]; }); @@ -96891,11 +96891,11 @@ Script.prototype.runInContext = function (context) { win[key] = context[key]; } }); - + var winKeys = Object_keys(win); var res = wEval.call(win, this.code); - + forEach(Object_keys(win), function (key) { // Avoid copying circular objects like `top` and `window` by only // updating existing context properties or new properties in the `win` @@ -96910,9 +96910,9 @@ Script.prototype.runInContext = function (context) { defineProp(context, key, win[key]); } }); - + document.body.removeChild(iframe); - + return res; }; @@ -97073,7 +97073,7 @@ class NodeReadable extends Readable { }; doRead(); } - + _destroy(err, callback) { if (this._reading) { const promise = new Promise(resolve => { @@ -97084,7 +97084,7 @@ class NodeReadable extends Readable { this._handleDestroy(err, callback); } } - + _handleDestroy(err, callback) { this._webStream.cancel(); super._destroy(err, callback); diff --git a/amf-rdf/js/src/main/scala/amf/rdf/client/scala/RdflibRdfModel.scala b/amf-rdf/js/src/main/scala/amf/rdf/client/scala/RdflibRdfModel.scala index ecdd212c..4539234b 100644 --- a/amf-rdf/js/src/main/scala/amf/rdf/client/scala/RdflibRdfModel.scala +++ b/amf-rdf/js/src/main/scala/amf/rdf/client/scala/RdflibRdfModel.scala @@ -7,25 +7,19 @@ import org.mulesoft.common.io.Output import scala.scalajs.js object RDF { - lazy val instance: js.Dynamic = if (js.isUndefined(js.Dynamic.global.GlobalSHACLValidator)) { - throw new Exception("Cannot find global SHACLValidator object") + lazy val instance: js.Dynamic = if (js.typeOf(js.Dynamic.global.global.GlobalSHACLValidator) == "undefined") { + val keys = js.Object.keys(js.Dynamic.global.global.asInstanceOf[js.Object]) + throw new Exception(s"Cannot find global SHACLValidator object. Found $keys") } else { - js.Dynamic.global.GlobalSHACLValidator.`$rdf` - } -} - -object JSONLD { - lazy val instance: js.Dynamic = if (js.isUndefined(js.Dynamic.global.SHACLValidator)) { - throw new Exception("Cannot find global SHACLValidator object") - } else { - js.Dynamic.global.SHACLValidator.jsonld + val keys = js.Object.keys(js.Dynamic.global.global.asInstanceOf[js.Object]) + println(s"Found keys ${keys}") + js.Dynamic.global.global.GlobalSHACLValidator.`$rdf` } } class RdflibRdfModel(val model: js.Dynamic = RDF.instance.graph()) extends RdfModel { - lazy val rdf: js.Dynamic = RDF.instance - lazy val jsonld: js.Dynamic = JSONLD.instance + lazy val rdf: js.Dynamic = RDF.instance override def nextAnonId(): String = synchronized { rdf.blankNode().toString @@ -42,10 +36,12 @@ class RdflibRdfModel(val model: js.Dynamic = RDF.instance.graph()) extends RdfMo this } - override def addTriple(subject: String, - predicate: String, - objLiteralValue: String, - objLiteralType: Option[String]): RdfModel = { + override def addTriple( + subject: String, + predicate: String, + objLiteralValue: String, + objLiteralType: Option[String] + ): RdfModel = { nodesCache = nodesCache - subject val s = checkAnon(subject) val p = rdf.namedNode(predicate) @@ -98,7 +94,8 @@ class RdflibRdfModel(val model: js.Dynamic = RDF.instance.graph()) extends RdfMo statements .sortWith((t1, t2) => - (t1.predicate.uri.asInstanceOf[String] compareTo t2.predicate.uri.asInstanceOf[String]) > 0) + (t1.predicate.uri.asInstanceOf[String] compareTo t2.predicate.uri.asInstanceOf[String]) > 0 + ) .foreach { statement => val property = statement.predicate.uri.asInstanceOf[String] @@ -110,27 +107,28 @@ class RdflibRdfModel(val model: js.Dynamic = RDF.instance.graph()) extends RdfMo } else if (obj.termType.asInstanceOf[String] == "Literal") { resourceProperties = resourceProperties.updated( - property, - oldProps ++ Seq( - Literal( - value = s"${obj.value}", - literalType = if (Option(obj.datatype).isDefined) { - Some(obj.datatype.uri.asInstanceOf[String]) - } else { - None - } - ) + property, + oldProps ++ Seq( + Literal( + value = s"${obj.value}", + literalType = if (Option(obj.datatype).isDefined) { + Some(obj.datatype.uri.asInstanceOf[String]) + } else { + None + } ) + ) ) } else { - resourceProperties = - resourceProperties.updated(property, - oldProps ++ Seq( - Uri( - value = s"${Option(obj.uri).getOrElse(obj.toCanonical())}" - ) - )) + resourceProperties = resourceProperties.updated( + property, + oldProps ++ Seq( + Uri( + value = s"${Option(obj.uri).getOrElse(obj.toCanonical())}" + ) + ) + ) } } @@ -146,8 +144,7 @@ class RdflibRdfModel(val model: js.Dynamic = RDF.instance.graph()) extends RdfMo rdf.parse(text, model, "", effectiveMediaType) } - /** - * Write model as a String representation + /** Write model as a String representation * * @param mediaType * @return @@ -156,11 +153,11 @@ class RdflibRdfModel(val model: js.Dynamic = RDF.instance.graph()) extends RdfMo throw new Exception("Sync rdf serialization not supported yet") } - /** - * Write model using a writer + /** Write model using a writer * * @param mediaType - * @param writer writer where to send the representation + * @param writer + * writer where to send the representation * @return */ override def serializeWriter[W: Output](mediaType: String, writer: W): Option[W] = { diff --git a/amf-rdf/jvm/src/main/scala/amf/rdf/client/scala/JenaRdfModel.scala b/amf-rdf/jvm/src/main/scala/amf/rdf/client/scala/JenaRdfModel.scala index fac5283e..2d0919d3 100644 --- a/amf-rdf/jvm/src/main/scala/amf/rdf/client/scala/JenaRdfModel.scala +++ b/amf-rdf/jvm/src/main/scala/amf/rdf/client/scala/JenaRdfModel.scala @@ -21,29 +21,31 @@ class JenaRdfModel(val model: Model = ModelFactory.createDefaultModel()) extends override def addTriple(subject: String, predicate: String, objResource: String): RdfModel = { nodesCache = nodesCache - subject model.add( - model.createStatement( - checkAnon(subject), - model.createProperty(predicate), - checkAnon(objResource) - ) + model.createStatement( + checkAnon(subject), + model.createProperty(predicate), + checkAnon(objResource) + ) ) this } - override def addTriple(subject: String, - predicate: String, - objLiteralValue: String, - objLiteralType: Option[String]): RdfModel = { + override def addTriple( + subject: String, + predicate: String, + objLiteralValue: String, + objLiteralType: Option[String] + ): RdfModel = { nodesCache = nodesCache - subject model.add( - model.createStatement( - checkAnon(subject), - model.createProperty(predicate), - objLiteralType match { - case Some(typeId) => model.createTypedLiteral(objLiteralValue, typeId) - case None => model.createLiteral(objLiteralValue) - } - ) + model.createStatement( + checkAnon(subject), + model.createProperty(predicate), + objLiteralType match { + case Some(typeId) => model.createTypedLiteral(objLiteralValue, typeId) + case None => model.createLiteral(objLiteralValue) + } + ) ) this } @@ -97,21 +99,23 @@ class JenaRdfModel(val model: Model = ModelFactory.createDefaultModel()) extends resourceClasses ++= Seq(statement.getObject.asResource().getURI) } else if (statement.getObject.isLiteral) { val lit = statement.getObject.asLiteral() - resourceProperties = resourceProperties.updated(predicate, - oldProps ++ Seq( - Literal( - value = lit.getLexicalForm, - literalType = Some(lit.getDatatypeURI) - ) - )) + resourceProperties = resourceProperties.updated( + predicate, + oldProps ++ Seq( + Literal( + value = lit.getLexicalForm, + literalType = Some(lit.getDatatypeURI) + ) + ) + ) } else if (statement.getObject.isResource) { resourceProperties = resourceProperties.updated( - predicate, - oldProps ++ Seq( - Uri( - value = statement.getObject.asResource().getURI - ) + predicate, + oldProps ++ Seq( + Uri( + value = statement.getObject.asResource().getURI ) + ) ) } } @@ -141,8 +145,7 @@ class JenaRdfModel(val model: Model = ModelFactory.createDefaultModel()) extends parser.parse(model) } - /** - * Write model as a String representation + /** Write model as a String representation * * @param mediaType * @return diff --git a/amf-rdf/jvm/src/main/scala/amf/rdf/client/scala/RDFPrinter.scala b/amf-rdf/jvm/src/main/scala/amf/rdf/client/scala/RDFPrinter.scala index a5e1769e..c3a48928 100644 --- a/amf-rdf/jvm/src/main/scala/amf/rdf/client/scala/RDFPrinter.scala +++ b/amf-rdf/jvm/src/main/scala/amf/rdf/client/scala/RDFPrinter.scala @@ -7,8 +7,7 @@ import org.apache.jena.util.FileUtils import java.io.StringWriter -/** - * Transforms a RDF Model into a JSON-LD string +/** Transforms a RDF Model into a JSON-LD string */ object RDFPrinter { diff --git a/amf-rdf/jvm/src/main/scala/amf/rdf/client/scala/RdfConfiguration.scala b/amf-rdf/jvm/src/main/scala/amf/rdf/client/scala/RdfConfiguration.scala new file mode 100644 index 00000000..02a6fa38 --- /dev/null +++ b/amf-rdf/jvm/src/main/scala/amf/rdf/client/scala/RdfConfiguration.scala @@ -0,0 +1,13 @@ +package amf.rdf.client.scala + +import amf.core.client.scala.AMFGraphConfiguration +import amf.rdf.internal.plugins.{RdfParsePlugin, RdfRenderPlugin, RdfSyntaxParsePlugin, RdfSyntaxRenderPlugin} + +object RdfConfiguration { + def apply(): AMFGraphConfiguration = { + AMFGraphConfiguration + .predefined() + .emptyPlugins() + .withPlugins(List(RdfParsePlugin, RdfRenderPlugin, RdfSyntaxParsePlugin, RdfSyntaxRenderPlugin)) + } +} diff --git a/amf-rdf/jvm/src/main/scala/amf/rdf/internal/plugins/RdfParsePlugin.scala b/amf-rdf/jvm/src/main/scala/amf/rdf/internal/plugins/RdfParsePlugin.scala new file mode 100644 index 00000000..e077ac8c --- /dev/null +++ b/amf-rdf/jvm/src/main/scala/amf/rdf/internal/plugins/RdfParsePlugin.scala @@ -0,0 +1,40 @@ +package amf.rdf.internal.plugins + +import amf.core.client.common.{LowPriority, PluginPriority} +import amf.core.client.scala.errorhandling.AMFErrorHandler +import amf.core.client.scala.exception.UnsupportedParsedDocumentException +import amf.core.client.scala.model.document.BaseUnit +import amf.core.client.scala.parse.AMFParsePlugin +import amf.core.client.scala.parse.document.{ParserContext, ReferenceHandler, SimpleReferenceHandler} +import amf.core.internal.parser.Root +import amf.core.internal.remote.{Mimes, Spec} +import amf.rdf.client.scala.RdfModelDocument +import amf.rdf.internal.unsafe.RdfPlatformSecrets +import amf.rdf.internal.{EntitiesFacade, RdfModelParser} + +object RdfParsePlugin extends AMFParsePlugin with RdfPlatformSecrets { + + override def spec: Spec = Spec.AMF + + override def applies(element: Root): Boolean = true + + override def priority: PluginPriority = LowPriority + + override def parse(document: Root, ctx: ParserContext): BaseUnit = { + document.parsed match { + case RdfModelDocument(model) => + val rootNodeLocation = document.location + val parser = RdfModelParser(ctx.config, new EntitiesFacade(ctx.config)) + parser.parse(model, rootNodeLocation) + case _ => throw UnsupportedParsedDocumentException + } + } + + /** media types which specifies vendors that are parsed by this plugin. + */ + override def mediaTypes: Seq[String] = Seq(Mimes.`text/n3`) + + override def referenceHandler(eh: AMFErrorHandler): ReferenceHandler = SimpleReferenceHandler + + override def allowRecursiveReferences: Boolean = false +} diff --git a/amf-rdf/jvm/src/main/scala/amf/rdf/internal/plugins/RdfRenderPlugin.scala b/amf-rdf/jvm/src/main/scala/amf/rdf/internal/plugins/RdfRenderPlugin.scala new file mode 100644 index 00000000..0430c14f --- /dev/null +++ b/amf-rdf/jvm/src/main/scala/amf/rdf/internal/plugins/RdfRenderPlugin.scala @@ -0,0 +1,39 @@ +package amf.rdf.internal.plugins + +import amf.core.client.common.{LowPriority, PluginPriority} +import amf.core.client.scala.model.document.BaseUnit +import amf.core.internal.plugins.render.{AMFRenderPlugin, RenderConfiguration, RenderInfo} +import amf.core.internal.plugins.syntax.{ASTBuilder, StringDocBuilder} +import amf.core.internal.remote.Mimes +import amf.rdf.client.scala.{RdfConfiguration, RdfUnitConverter} + +object RdfRenderPlugin extends AMFRenderPlugin { + + override val id: String = "rdf-render-plugin" + + override def defaultSyntax(): String = Mimes.`text/n3` + + override def mediaTypes: Seq[String] = Seq(Mimes.`text/n3`) + + override def applies(element: RenderInfo): Boolean = true + + override def priority: PluginPriority = LowPriority + + override def getDefaultBuilder: ASTBuilder[_] = new StringDocBuilder() + + override def emit[T]( + unit: BaseUnit, + builder: ASTBuilder[T], + renderConfiguration: RenderConfiguration, + mediaType: String + ): Boolean = { + builder match { + case stringDocBuilder: StringDocBuilder => + val rdfModel = + RdfUnitConverter.toNativeRdfModel(unit, RdfConfiguration(), renderConfiguration.renderOptions) + stringDocBuilder += rdfModel.toN3() + true + case _ => false + } + } +} diff --git a/amf-rdf/jvm/src/test/resources/example.nt b/amf-rdf/jvm/src/test/resources/example.nt new file mode 100644 index 00000000..8803e26e --- /dev/null +++ b/amf-rdf/jvm/src/test/resources/example.nt @@ -0,0 +1,18 @@ + "false"^^ . + . + "Modular Recursion API" . + . + . + . + . + "true"^^ . + "2.1.0" . + . + . + . + . + . + . + "false"^^ . + . + \ No newline at end of file diff --git a/amf-rdf/jvm/src/test/scala/amf/rdf/RdfPluginsTests.scala b/amf-rdf/jvm/src/test/scala/amf/rdf/RdfPluginsTests.scala new file mode 100644 index 00000000..4c9d9a90 --- /dev/null +++ b/amf-rdf/jvm/src/test/scala/amf/rdf/RdfPluginsTests.scala @@ -0,0 +1,71 @@ +package amf.rdf + +import amf.core.client.common.remote.Content +import amf.core.client.scala.AMFGraphConfiguration +import amf.core.client.scala.config.ParsingOptions +import amf.core.client.scala.model.document.Document +import amf.core.client.scala.resource.ResourceLoader +import amf.core.internal.unsafe.PlatformSecrets +import amf.rdf.client.scala.RdfConfiguration +import amf.rdf.internal.unsafe.RdfPlatformSecrets +import org.scalatest.funsuite.AsyncFunSuite +import org.scalatest.matchers.must.Matchers + +import scala.concurrent.{ExecutionContext, Future} + +class RdfPluginsTests extends AsyncFunSuite with RdfPlatformSecrets with Matchers { + + override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global + + private val basePath = "file://amf-rdf/jvm/src/test/resources/" + private val myLoader = InMemoryResourceLoader("file://api.raml") + private val client = RdfConfiguration() + .withParsingOptions(ParsingOptions().withoutAmfJsonLdSerialization) + .withResourceLoaders(List(myLoader)) + .baseUnitClient() + + test("Parse plugin") { + val path = basePath + "example.nt" + for { + parsed <- client.parse(path) + } yield { + val unit = parsed.baseUnit + assert(!unit.asInstanceOf[Document].processingData.transformed.value()) + assert(unit.root.value()) + assert(unit.references.size == 1) + } + } + + test("Render plugin") { + val path = basePath + "example.nt" + for { + parsed <- client.parse(path) + rendered <- Future.successful(client.render(parsed.baseUnit)) + } yield { + assert( + rendered.contains( + " \"false\"^^" + ) + ) + assert(rendered.contains(" \"2.1.0\"")) + assert( + rendered.contains( + "file://api.raml> \"true\"^^" + ) + ) + } + } + + case class InMemoryResourceLoader(url: String) extends ResourceLoader with RdfPlatformSecrets with PlatformSecrets { + + override def accepts(resource: String): Boolean = true + + override def fetch(resource: String): Future[Content] = { + for { + content <- platform.fetchContent(resource, AMFGraphConfiguration.predefined()) + } yield { + content.copy(url = url) + } + } + } +} diff --git a/amf-rdf/shared/src/main/scala/amf/rdf/client/platform/Node.scala b/amf-rdf/shared/src/main/scala/amf/rdf/client/platform/Node.scala index 26b226f8..7c5bcf21 100644 --- a/amf-rdf/shared/src/main/scala/amf/rdf/client/platform/Node.scala +++ b/amf-rdf/shared/src/main/scala/amf/rdf/client/platform/Node.scala @@ -16,8 +16,7 @@ class PropertyObject private[amf] (private[amf] val internal: InternalPropertyOb } @JSExportAll -case class Literal private[amf] (private[amf] override val internal: InternalLiteral) - extends PropertyObject(internal) { +case class Literal private[amf] (private[amf] override val internal: InternalLiteral) extends PropertyObject(internal) { def literalType: ClientOption[String] = internal.literalType.asClient } diff --git a/amf-rdf/shared/src/main/scala/amf/rdf/client/platform/RdfModel.scala b/amf-rdf/shared/src/main/scala/amf/rdf/client/platform/RdfModel.scala index 93210586..ddcf867f 100644 --- a/amf-rdf/shared/src/main/scala/amf/rdf/client/platform/RdfModel.scala +++ b/amf-rdf/shared/src/main/scala/amf/rdf/client/platform/RdfModel.scala @@ -25,7 +25,12 @@ class RdfModel(private[amf] var internal: InternalRdfModel) { this } - def addLiteralTriple(subject: String, predicate: String, objLiteralValue: String, objLiteralType: String): RdfModel = { + def addLiteralTriple( + subject: String, + predicate: String, + objLiteralValue: String, + objLiteralType: String + ): RdfModel = { this.internal = internal.addTriple(subject, predicate, objLiteralValue, Some(objLiteralType)) this } @@ -34,15 +39,13 @@ class RdfModel(private[amf] var internal: InternalRdfModel) { def nextAnonId(): String = internal.nextAnonId() - /** - * Load RDF string representation in this model + /** Load RDF string representation in this model * @param text * @param mediaType */ def load(mediaType: String, text: String) = internal.load(mediaType, text) - /** - * Write model as a String representation + /** Write model as a String representation * @param mediaType * @return */ diff --git a/amf-rdf/shared/src/main/scala/amf/rdf/client/platform/RdfUnitConverter.scala b/amf-rdf/shared/src/main/scala/amf/rdf/client/platform/RdfUnitConverter.scala index 9a5d942e..79974717 100644 --- a/amf-rdf/shared/src/main/scala/amf/rdf/client/platform/RdfUnitConverter.scala +++ b/amf-rdf/shared/src/main/scala/amf/rdf/client/platform/RdfUnitConverter.scala @@ -20,6 +20,10 @@ object RdfUnitConverter extends RdfPlatformSecrets { } def toNativeRdfModel(unit: BaseUnit, renderOptions: RenderOptions = new RenderOptions()): RdfModel = { - framework.unitToRdfModel(unit, renderOptions) + toNativeRdfModel(unit, AMFGraphConfiguration.predefined(), renderOptions) + } + + def toNativeRdfModel(unit: BaseUnit, config: AMFGraphConfiguration, renderOptions: RenderOptions): RdfModel = { + framework.unitToRdfModel(unit, config, renderOptions) } } diff --git a/amf-rdf/shared/src/main/scala/amf/rdf/client/scala/RdfFramework.scala b/amf-rdf/shared/src/main/scala/amf/rdf/client/scala/RdfFramework.scala index e57fa974..13ade905 100644 --- a/amf-rdf/shared/src/main/scala/amf/rdf/client/scala/RdfFramework.scala +++ b/amf-rdf/shared/src/main/scala/amf/rdf/client/scala/RdfFramework.scala @@ -1,8 +1,14 @@ package amf.rdf.client.scala +import amf.core.client.scala.AMFGraphConfiguration import amf.core.client.scala.config.RenderOptions import amf.core.client.scala.model.document.BaseUnit import amf.core.client.scala.parse.document.ParsedDocument +import amf.core.internal.metamodel.Type +import amf.core.internal.plugins.document.graph.emitter.{ + SemanticExtensionAwareFieldRenderProvision, + SemanticExtensionAwareMetaFieldRenderProvider +} import amf.rdf.internal.RdfModelEmitter import org.mulesoft.common.io.Output @@ -12,9 +18,10 @@ trait RdfFramework { def emptyRdfModel(): RdfModel - def unitToRdfModel(unit: BaseUnit, options: RenderOptions): RdfModel = { - val model = emptyRdfModel() - new RdfModelEmitter(model).emit(unit, options) + def unitToRdfModel(unit: BaseUnit, config: AMFGraphConfiguration, options: RenderOptions): RdfModel = { + val model = emptyRdfModel() + val extensions = config.registry.getEntitiesRegistry.extensionTypes + new RdfModelEmitter(model, SemanticExtensionAwareMetaFieldRenderProvider(extensions, options)).emit(unit, options) model } diff --git a/amf-rdf/shared/src/main/scala/amf/rdf/client/scala/RdfModel.scala b/amf-rdf/shared/src/main/scala/amf/rdf/client/scala/RdfModel.scala index fe6ced1c..ef6de8ac 100644 --- a/amf-rdf/shared/src/main/scala/amf/rdf/client/scala/RdfModel.scala +++ b/amf-rdf/shared/src/main/scala/amf/rdf/client/scala/RdfModel.scala @@ -16,8 +16,7 @@ case class Node(subject: String, classes: Seq[String], private val properties: M } } -/** - * Base class for all the RDF native models in different platforms +/** Base class for all the RDF native models in different platforms */ abstract class RdfModel { var anonCounter = 0 @@ -31,24 +30,22 @@ abstract class RdfModel { s"http://amf.org/anon/$anonCounter" } - /** - * Load RDF string representation in this model + /** Load RDF string representation in this model * @param text * @param mediaType */ def load(mediaType: String, text: String) - /** - * Write model as a String representation + /** Write model as a String representation * @param mediaType * @return */ def serializeString(mediaType: String): Option[String] - /** - * Write model using a writer + /** Write model using a writer * @param mediaType - * @param writer writer where to send the representation + * @param writer + * writer where to send the representation * @return */ def serializeWriter[W: Output](mediaType: String, writer: W): Option[W] diff --git a/amf-rdf/shared/src/main/scala/amf/rdf/client/scala/RdfUnitConverter.scala b/amf-rdf/shared/src/main/scala/amf/rdf/client/scala/RdfUnitConverter.scala index 1eb51d14..9bd09281 100644 --- a/amf-rdf/shared/src/main/scala/amf/rdf/client/scala/RdfUnitConverter.scala +++ b/amf-rdf/shared/src/main/scala/amf/rdf/client/scala/RdfUnitConverter.scala @@ -3,6 +3,7 @@ package amf.rdf.client.scala import amf.core.client.scala.config.RenderOptions import amf.core.client.scala.model.document.BaseUnit import amf.core.client.scala.{AMFGraphConfiguration, config} +import amf.core.internal.metamodel.Type import amf.core.internal.unsafe.PlatformSecrets import amf.rdf.internal.RdfModelParser import amf.rdf.internal.unsafe.RdfPlatformSecrets @@ -14,6 +15,10 @@ object RdfUnitConverter extends RdfPlatformSecrets { } def toNativeRdfModel(unit: BaseUnit, renderOptions: RenderOptions = config.RenderOptions()): RdfModel = { - framework.unitToRdfModel(unit, renderOptions) + toNativeRdfModel(unit, AMFGraphConfiguration.predefined(), renderOptions) + } + + def toNativeRdfModel(unit: BaseUnit, configuration: AMFGraphConfiguration, renderOptions: RenderOptions): RdfModel = { + framework.unitToRdfModel(unit, configuration, renderOptions) } } diff --git a/amf-rdf/shared/src/main/scala/amf/rdf/internal/DefaultNodeClassSorter.scala b/amf-rdf/shared/src/main/scala/amf/rdf/internal/DefaultNodeClassSorter.scala index 20513c04..d601a29d 100644 --- a/amf-rdf/shared/src/main/scala/amf/rdf/internal/DefaultNodeClassSorter.scala +++ b/amf-rdf/shared/src/main/scala/amf/rdf/internal/DefaultNodeClassSorter.scala @@ -6,13 +6,18 @@ import amf.rdf.client.scala.Node class DefaultNodeClassSorter() { private val deferredTypesSet = Set( - (Namespace.Document + "Document").iri(), - (Namespace.Document + "Fragment").iri(), - (Namespace.Document + "Module").iri(), - (Namespace.Document + "Unit").iri(), - (Namespace.Shacl + "Shape").iri(), - (Namespace.Shapes + "Shape").iri(), - (Namespace.ApiContract + "Message").iri() + (Namespace.Document + "Document").iri(), + (Namespace.Document + "Fragment").iri(), + (Namespace.Document + "Module").iri(), + (Namespace.Document + "Unit").iri(), + (Namespace.Shacl + "Shape").iri(), + (Namespace.Shapes + "Shape").iri(), + (Namespace.ApiContract + "Message").iri(), + (Namespace.Core + "Operation").iri(), + (Namespace.Core + "Parameter").iri(), + (Namespace.Core + "Payload").iri(), + (Namespace.Core + "Request").iri(), + (Namespace.Core + "Response").iri() ) def sortedClassesOf(node: Node): Seq[String] = { diff --git a/amf-rdf/shared/src/main/scala/amf/rdf/internal/EntitiesFacade.scala b/amf-rdf/shared/src/main/scala/amf/rdf/internal/EntitiesFacade.scala index 1541a04b..a7a9694f 100644 --- a/amf-rdf/shared/src/main/scala/amf/rdf/internal/EntitiesFacade.scala +++ b/amf-rdf/shared/src/main/scala/amf/rdf/internal/EntitiesFacade.scala @@ -17,10 +17,12 @@ class EntitiesFacade private[amf] (parserConfig: ParseConfiguration) { typeModel.isInstanceOf[DocumentModel] || typeModel.isInstanceOf[EncodesModel] || typeModel .isInstanceOf[DeclaresModel] || typeModel.isInstanceOf[BaseUnitModel] - def retrieveType(id: String, - node: Node, - findBaseUnit: Boolean = false, - visitedSelfEncoded: Boolean = false): Option[ModelDefaultBuilder] = { + def retrieveType( + id: String, + node: Node, + findBaseUnit: Boolean = false, + visitedSelfEncoded: Boolean = false + ): Option[ModelDefaultBuilder] = { val types = sorter.sortedClassesOf(node) val foundType = types.find { t => diff --git a/amf-rdf/shared/src/main/scala/amf/rdf/internal/RdfModelEmitter.scala b/amf-rdf/shared/src/main/scala/amf/rdf/internal/RdfModelEmitter.scala index 7c8511fb..62513c17 100644 --- a/amf-rdf/shared/src/main/scala/amf/rdf/internal/RdfModelEmitter.scala +++ b/amf-rdf/shared/src/main/scala/amf/rdf/internal/RdfModelEmitter.scala @@ -15,22 +15,24 @@ import amf.core.internal.metamodel.document.SourceMapModel import amf.core.internal.metamodel.domain.extensions.DomainExtensionModel import amf.core.internal.metamodel.domain.{DomainElementModel, LinkableElementModel, ShapeModel} import amf.core.internal.parser.domain.{Annotations, FieldEntry, Value} -import amf.core.internal.plugins.document.graph.emitter.CommonEmitter +import amf.core.internal.plugins.document.graph.emitter.utils.SourceMapEmitter +import amf.core.internal.plugins.document.graph.emitter.{ApplicableMetaFieldRenderProvider, CommonEmitter} import amf.rdf.client.scala.RdfModel import org.mulesoft.common.time.SimpleDateTime import scala.collection.mutable.ListBuffer -/** - * AMF RDF Model emitter +/** AMF RDF Model emitter */ -class RdfModelEmitter(rdfmodel: RdfModel) extends MetaModelTypeMapping with CommonEmitter { +class RdfModelEmitter(rdfModel: RdfModel, fieldProvision: ApplicableMetaFieldRenderProvider) + extends MetaModelTypeMapping + with SourceMapEmitter { def emit(unit: BaseUnit, options: RenderOptions): Unit = Emitter(options).root(unit) case class Emitter(options: RenderOptions) { - private val traversal = ModelTraversalRegistry() + private val traversal = new ModelTraversalRegistry() var rootId: Option[String] = None def root(unit: BaseUnit): Unit = { @@ -53,14 +55,14 @@ class RdfModelEmitter(rdfmodel: RdfModel) extends MetaModelTypeMapping with Comm createTypeNode(id, obj, Some(element)) // workaround for lazy values in shape - val modelFields = obj.fields ++ (obj match { + val modelFields = fieldProvision.fieldsFor(element, options) ++ (obj match { case _: ShapeModel => Seq( - ShapeModel.CustomShapePropertyDefinitions, - ShapeModel.CustomShapeProperties + ShapeModel.CustomShapePropertyDefinitions, + ShapeModel.CustomShapeProperties ) case _ => Nil - }).filter(options.renderField) + }) element match { case e: ObjectNode if options.isValidation => @@ -95,34 +97,31 @@ class RdfModelEmitter(rdfmodel: RdfModel) extends MetaModelTypeMapping with Comm val customProperties: ListBuffer[String] = ListBuffer() // Collect element custom annotations - element.fields.entry(DomainElementModel.CustomDomainProperties) foreach { - case FieldEntry(_, v) => - v.value match { - case AmfArray(values, _) => - values.foreach { - case extension: DomainExtension => - val uri = extension.definedBy.id - customProperties += uri - createCustomExtension(id, uri, extension, None) - } - case _ => // ignore - } + element.fields.entry(DomainElementModel.CustomDomainProperties) foreach { case FieldEntry(_, v) => + v.value match { + case AmfArray(values, _) => + values.foreach { case extension: DomainExtension => + val uri = extension.definedBy.id + customProperties += uri + createCustomExtension(id, uri, extension, None) + } + case _ => // ignore + } } // Collect element scalar fields custom annotations var count = 1 - element.fields.foreach { - case (f, v) => - v.value.annotations - .collect({ case e: DomainExtensionAnnotation => e }) - .foreach(e => { - val extension = e.extension - val uri = s"${element.id}/scalar-valued/$count/${extension.name.value()}" - customProperties += uri - adoptTree(uri, extension.extension) // Fix ids - createCustomExtension(id, uri, extension, Some(f)) - count += 1 - }) + element.fields.foreach { case (f, v) => + v.value.annotations + .collect({ case e: DomainExtensionAnnotation => e }) + .foreach(e => { + val extension = e.extension + val uri = s"${element.id}/scalar-valued/$count/${extension.name.value()}" + customProperties += uri + adoptTree(uri, extension.extension) // Fix ids + createCustomExtension(id, uri, extension, Some(f)) + count += 1 + }) } if (customProperties.nonEmpty) { @@ -132,27 +131,28 @@ class RdfModelEmitter(rdfmodel: RdfModel) extends MetaModelTypeMapping with Comm } } - private def createCustomExtension(subject: String, - uri: String, - extension: DomainExtension, - field: Option[Field] = None): Unit = { - rdfmodel.addTriple(subject, uri, extension.extension.id) - rdfmodel.addTriple(uri, DomainExtensionModel.Name.value.iri(), extension.name.value(), None) + private def createCustomExtension( + subject: String, + uri: String, + extension: DomainExtension, + field: Option[Field] = None + ): Unit = { + rdfModel.addTriple(subject, uri, extension.extension.id) + rdfModel.addTriple(uri, DomainExtensionModel.Name.value.iri(), extension.name.value(), None) field.foreach { f => - rdfmodel.addTriple(uri, DomainExtensionModel.Element.value.iri(), f.value.iri()) + rdfModel.addTriple(uri, DomainExtensionModel.Element.value.iri(), f.value.iri()) } traverse(extension.extension) } def createSortedArray(subject: String, property: String, seq: Seq[AmfElement], element: Type): Unit = { val id = s"$subject/list" - rdfmodel + rdfModel .addTriple(subject, property, id) .addTriple(id, (Namespace.Rdf + "type").iri(), (Namespace.Rdfs + "Seq").iri()) - seq.zipWithIndex.foreach { - case (e, i) => - val memberTriple = (Namespace.Rdfs + s"_${i + 1}").iri() - objectValue(id, memberTriple, element, Value(e, Annotations())) + seq.zipWithIndex.foreach { case (e, i) => + val memberTriple = (Namespace.Rdfs + s"_${i + 1}").iri() + objectValue(id, memberTriple, element, Value(e, Annotations())) } } @@ -165,7 +165,7 @@ class RdfModelEmitter(rdfmodel: RdfModel) extends MetaModelTypeMapping with Comm .isExternalLink .option() .getOrElse(false) => - rdfmodel.addTriple(subject, property, v.value.asInstanceOf[DomainElement].id) + rdfModel.addTriple(subject, property, v.value.asInstanceOf[DomainElement].id) case t: DomainElement with Linkable if t.isLink => link(subject, property, t) case _: Obj => @@ -181,16 +181,16 @@ class RdfModelEmitter(rdfmodel: RdfModel) extends MetaModelTypeMapping with Comm case Some(annotation) => typedScalar(subject, property, v.value.asInstanceOf[AmfScalar].toString, annotation.datatype) case None => - rdfmodel.addTriple(subject, property, v.value.asInstanceOf[AmfScalar].toString, None) + rdfModel.addTriple(subject, property, v.value.asInstanceOf[AmfScalar].toString, None) } case Bool => - rdfmodel.addTriple(subject, property, v.value.asInstanceOf[AmfScalar].toString, Some(DataType.Boolean)) + rdfModel.addTriple(subject, property, v.value.asInstanceOf[AmfScalar].toString, Some(DataType.Boolean)) case Type.Int => emitIntLiteral(subject, property, v.value.asInstanceOf[AmfScalar].toString) case Type.Double => // this will transform the value to double and will not emit @type TODO: ADD YType.Double // @TODO: see also in the Type.Any emitter - rdfmodel.addTriple(subject, property, v.value.asInstanceOf[AmfScalar].toString, Some(DataType.Double)) + rdfModel.addTriple(subject, property, v.value.asInstanceOf[AmfScalar].toString, Some(DataType.Double)) case Type.Float => emitFloatLiteral(subject, property, v.value.asInstanceOf[AmfScalar].toString) case Type.DateTime => @@ -213,19 +213,19 @@ class RdfModelEmitter(rdfmodel: RdfModel) extends MetaModelTypeMapping with Comm case Type.Any => v.value.asInstanceOf[AmfScalar].value match { case bool: Boolean => - rdfmodel.addTriple(subject, property, v.value.asInstanceOf[AmfScalar].toString, Some(DataType.Boolean)) + rdfModel.addTriple(subject, property, v.value.asInstanceOf[AmfScalar].toString, Some(DataType.Boolean)) case i: Int => emitIntLiteral(subject, property, v.value.asInstanceOf[AmfScalar].toString) case f: Float => emitFloatLiteral(subject, property, v.value.asInstanceOf[AmfScalar].toString) case d: Double => - rdfmodel.addTriple(subject, property, v.value.asInstanceOf[AmfScalar].toString, Some(DataType.Double)) + rdfModel.addTriple(subject, property, v.value.asInstanceOf[AmfScalar].toString, Some(DataType.Double)) case _ => v.annotations.find(classOf[ScalarType]) match { case Some(annotation) => typedScalar(subject, property, v.value.asInstanceOf[AmfScalar].toString, annotation.datatype) case None => - rdfmodel.addTriple(subject, property, v.value.asInstanceOf[AmfScalar].toString, None) + rdfModel.addTriple(subject, property, v.value.asInstanceOf[AmfScalar].toString, None) } } } @@ -233,24 +233,24 @@ class RdfModelEmitter(rdfmodel: RdfModel) extends MetaModelTypeMapping with Comm def emitIntLiteral(subject: String, property: String, v: String): Unit = { try { - rdfmodel.addTriple(subject, property, v.toInt.toString, Some(DataType.Long)) + rdfModel.addTriple(subject, property, v.toInt.toString, Some(DataType.Long)) } catch { case _: NumberFormatException => - rdfmodel.addTriple(subject, property, v, None) + rdfModel.addTriple(subject, property, v, None) } } def emitFloatLiteral(subject: String, property: String, v: String): Unit = { try { - rdfmodel.addTriple(subject, property, v.toDouble.toString, Some(DataType.Double)) + rdfModel.addTriple(subject, property, v.toDouble.toString, Some(DataType.Double)) } catch { case _: NumberFormatException => - rdfmodel.addTriple(subject, property, v, None) + rdfModel.addTriple(subject, property, v, None) } } private def obj(subject: String, property: String, element: AmfObject): Unit = { - rdfmodel.addTriple(subject, property, element.id) + rdfModel.addTriple(subject, property, element.id) traverse(element) } @@ -264,7 +264,7 @@ class RdfModelEmitter(rdfmodel: RdfModel) extends MetaModelTypeMapping with Comm } // add the liking triplea - rdfmodel.addTriple(subject, property, elementWithLink.id) + rdfModel.addTriple(subject, property, elementWithLink.id) // recursion on the object traverse(elementWithLink) @@ -277,32 +277,32 @@ class RdfModelEmitter(rdfmodel: RdfModel) extends MetaModelTypeMapping with Comm private def iri(subject: String, property: String, content: String): Unit = { // Last update, we assume that the iris are valid and han been encoded. Other option could be use the previous custom lcoal object URLEncoder but not search for %. // That can be a problem, because some chars could not being encoded - rdfmodel.addTriple(subject, property, content) + rdfModel.addTriple(subject, property, content) } private def safeIri(subject: String, property: String, content: String): Unit = { - rdfmodel.addTriple(subject, property, content) + rdfModel.addTriple(subject, property, content) } private def typedScalar(subject: String, property: String, content: String, dataType: String): Unit = { dataType match { case _ if dataType == DataType.Integer => - rdfmodel.addTriple(subject, property, content, Some(DataType.Long)) - case _ => rdfmodel.addTriple(subject, property, content, Some(dataType)) + rdfModel.addTriple(subject, property, content, Some(DataType.Long)) + case _ => rdfModel.addTriple(subject, property, content, Some(dataType)) } } private def createTypeNode(id: String, obj: Obj, maybeElement: Option[AmfObject] = None): Unit = { val allTypes = obj.`type`.map(_.iri()) allTypes.foreach { t => - //if (t != "http://a.ml/vocabularies/document#DomainElement" && t != "http://www.w3.org/ns/shacl#Shape" && t != "http://a.ml/vocabularies/shapes#Shape") - rdfmodel.addTriple(id, (Namespace.Rdf + "type").iri(), t) + // if (t != "http://a.ml/vocabularies/document#DomainElement" && t != "http://www.w3.org/ns/shacl#Shape" && t != "http://a.ml/vocabularies/shapes#Shape") + rdfModel.addTriple(id, (Namespace.Rdf + "type").iri(), t) } } private def createSourcesNode(id: String, sources: SourceMap, sourceMapId: String): Unit = { if (options.isWithSourceMaps && sources.nonEmpty) { - rdfmodel.addTriple(id, DomainElementModel.Sources.value.iri(), sourceMapId) + rdfModel.addTriple(id, DomainElementModel.Sources.value.iri(), sourceMapId) createTypeNode(sourceMapId, SourceMapModel, None) createAnnotationNodes(sourceMapId, sources) } @@ -310,15 +310,13 @@ class RdfModelEmitter(rdfmodel: RdfModel) extends MetaModelTypeMapping with Comm private def createAnnotationNodes(id: String, sources: SourceMap): Unit = { val allAnnotations = sources.annotations ++ sources.eternals - allAnnotations.zipWithIndex.foreach({ - case ((a, values), i) => - values.zipWithIndex.foreach { - case ((iri, v), j) => - val valueNodeId = s"${id}_${i}_$j" - rdfmodel.addTriple(id, ValueType(Namespace.SourceMaps, a).iri(), valueNodeId) - rdfmodel.addTriple(valueNodeId, SourceMapModel.Element.value.iri(), iri) - rdfmodel.addTriple(valueNodeId, SourceMapModel.Value.value.iri(), v, None) - } + allAnnotations.zipWithIndex.foreach({ case ((a, values), i) => + values.zipWithIndex.foreach { case ((iri, v), j) => + val valueNodeId = s"${id}_${i}_$j" + rdfModel.addTriple(id, ValueType(Namespace.SourceMaps, a).iri(), valueNodeId) + rdfModel.addTriple(valueNodeId, SourceMapModel.Element.value.iri(), iri) + rdfModel.addTriple(valueNodeId, SourceMapModel.Value.value.iri(), v, None) + } }) } } diff --git a/amf-rdf/shared/src/main/scala/amf/rdf/internal/RdfModelParser.scala b/amf-rdf/shared/src/main/scala/amf/rdf/internal/RdfModelParser.scala index 6041edc8..cc3f1c44 100644 --- a/amf-rdf/shared/src/main/scala/amf/rdf/internal/RdfModelParser.scala +++ b/amf-rdf/shared/src/main/scala/amf/rdf/internal/RdfModelParser.scala @@ -36,15 +36,16 @@ class RdfModelParser(config: ParseConfiguration, facade: EntitiesFacade) extends unit.set(BaseUnitModel.Location, location.split("#").head) unit case _ => - ctx.eh.violation(UnableToParseRdfDocument, - location, - s"Unable to parse RDF model for location root node: $location") + ctx.eh.violation( + UnableToParseRdfDocument, + location, + s"Unable to parse RDF model for location root node: $location" + ) Document() } case _ => - ctx.eh.violation(UnableToParseRdfDocument, - location, - s"Unable to parse RDF model for location root node: $location") + ctx.eh + .violation(UnableToParseRdfDocument, location, s"Unable to parse RDF model for location root node: $location") Document() } diff --git a/amf-rdf/shared/src/main/scala/amf/rdf/internal/RdfParserContext.scala b/amf-rdf/shared/src/main/scala/amf/rdf/internal/RdfParserContext.scala index 369f6560..98cdff42 100644 --- a/amf-rdf/shared/src/main/scala/amf/rdf/internal/RdfParserContext.scala +++ b/amf-rdf/shared/src/main/scala/amf/rdf/internal/RdfParserContext.scala @@ -9,10 +9,11 @@ import amf.core.internal.rdf.SerializableAnnotationsFacade import scala.collection.mutable import scala.collection.mutable.ListBuffer -class RdfParserContext(rootContextDocument: String = "", - futureDeclarations: FutureDeclarations = EmptyFutureDeclarations(), - config: ParseConfiguration) - extends ParserContext(rootContextDocument, Seq.empty, futureDeclarations, config) { +class RdfParserContext( + rootContextDocument: String = "", + futureDeclarations: FutureDeclarations = EmptyFutureDeclarations(), + config: ParseConfiguration +) extends ParserContext(rootContextDocument, Seq.empty, futureDeclarations, config) { val unresolvedReferences: mutable.Map[String, Seq[DomainElement]] = mutable.Map[String, Seq[DomainElement]]() val unresolvedExtReferencesMap: mutable.Map[String, ExternalSourceElement] = diff --git a/amf-rdf/shared/src/main/scala/amf/rdf/internal/converter/ScalarTypeConverter.scala b/amf-rdf/shared/src/main/scala/amf/rdf/internal/converter/ScalarTypeConverter.scala index 684533ed..7bf75ebc 100644 --- a/amf-rdf/shared/src/main/scala/amf/rdf/internal/converter/ScalarTypeConverter.scala +++ b/amf-rdf/shared/src/main/scala/amf/rdf/internal/converter/ScalarTypeConverter.scala @@ -13,16 +13,14 @@ object StringIriUriRegexParser { def parse(property: PropertyObject): AmfScalar = AmfScalar(s"${property.value}") } -/** - - * TODO this has very similar logic to AnyTypeConverter, we need to review why are we first match by type in tryConvert - - * and then we match by PropertyObject in the same way as we do in AnyTypeConverter. Maybe these logics can be merged or - +/** TODO this has very similar logic to AnyTypeConverter, we need to review why are we first match by type in tryConvert + * + * and then we match by PropertyObject in the same way as we do in AnyTypeConverter. Maybe these logics can be merged + * or + * * make one dependent on the other. Furthermore check why are we including the extra cases for Iri, Str, RegExp and - + * * LiteralUri here and not in AnyTypeConverter. - */ // Left as object to avoid creating instances of it due to AMF Service request. diff --git a/amf-rdf/shared/src/main/scala/amf/rdf/internal/parsers/CustomPropertiesParser.scala b/amf-rdf/shared/src/main/scala/amf/rdf/internal/parsers/CustomPropertiesParser.scala index a26ca300..60c7d956 100644 --- a/amf-rdf/shared/src/main/scala/amf/rdf/internal/parsers/CustomPropertiesParser.scala +++ b/amf-rdf/shared/src/main/scala/amf/rdf/internal/parsers/CustomPropertiesParser.scala @@ -10,9 +10,9 @@ import amf.rdf.client.scala.{Literal, Node, Uri} import amf.rdf.internal.graph.NodeFinder import amf.rdf.internal.{RdfParserCommon, RdfParserContext} -class CustomPropertiesParser(linkFinder: NodeFinder, sourcesRetriever: SourcesRetriever)( - implicit val ctx: RdfParserContext) - extends RdfParserCommon { +class CustomPropertiesParser(linkFinder: NodeFinder, sourcesRetriever: SourcesRetriever)(implicit + val ctx: RdfParserContext +) extends RdfParserCommon { def parse(node: Node, instance: DomainElement): Unit = { val properties: Seq[String] = node .getProperties(DomainElementModel.CustomDomainProperties.value.iri()) @@ -74,8 +74,8 @@ class CustomPropertiesParser(linkFinder: NodeFinder, sourcesRetriever: SourcesRe .fieldsMeta() .find(f => e.element.is(f.value.iri())) .foreach(f => { - instance.fields.entry(f).foreach { - case FieldEntry(_, value) => value.value.annotations += DomainExtensionAnnotation(e) + instance.fields.entry(f).foreach { case FieldEntry(_, value) => + value.value.annotations += DomainExtensionAnnotation(e) } }) } diff --git a/amf-rdf/shared/src/main/scala/amf/rdf/internal/parsers/DynamicArrayParser.scala b/amf-rdf/shared/src/main/scala/amf/rdf/internal/parsers/DynamicArrayParser.scala index 9e8f9bdc..e5fb126a 100644 --- a/amf-rdf/shared/src/main/scala/amf/rdf/internal/parsers/DynamicArrayParser.scala +++ b/amf-rdf/shared/src/main/scala/amf/rdf/internal/parsers/DynamicArrayParser.scala @@ -7,8 +7,7 @@ import amf.rdf.client.scala.{PropertyObject, Uri} import amf.rdf.internal.graph.NodeFinder import amf.rdf.internal.{RdfParserCommon, RdfParserContext} -class DynamicArrayParser(linkFinder: NodeFinder, sourcesRetriever: SourcesRetriever)( - implicit val ctx: RdfParserContext) +class DynamicArrayParser(linkFinder: NodeFinder, sourcesRetriever: SourcesRetriever)(implicit val ctx: RdfParserContext) extends RdfParserCommon { def parse(propertyObject: PropertyObject): ArrayNode = { val nodeAnnotations = linkFinder.findLink(propertyObject) match { diff --git a/amf-rdf/shared/src/main/scala/amf/rdf/internal/parsers/DynamicTypeParser.scala b/amf-rdf/shared/src/main/scala/amf/rdf/internal/parsers/DynamicTypeParser.scala index d815eeb7..441bc891 100644 --- a/amf-rdf/shared/src/main/scala/amf/rdf/internal/parsers/DynamicTypeParser.scala +++ b/amf-rdf/shared/src/main/scala/amf/rdf/internal/parsers/DynamicTypeParser.scala @@ -14,7 +14,8 @@ import scala.collection.mutable class DynamicTypeParser( linkFinder: NodeFinder, sourcesRetriever: SourcesRetriever, - sorter: DefaultNodeClassSorter = new DefaultNodeClassSorter())(implicit val ctx: RdfParserContext) + sorter: DefaultNodeClassSorter = new DefaultNodeClassSorter() +)(implicit val ctx: RdfParserContext) extends RdfParserCommon { def parse(property: PropertyObject): Option[DataNode] = { @@ -26,8 +27,10 @@ class DynamicTypeParser( case obj: ObjectNode => obj.withId(node.subject) node.getKeys().foreach { uri => - if (uri != "@type" && uri != "@id" && uri != DomainElementModel.Sources.value.iri() && - uri != (Namespace.Core + "name").iri()) { // we do this to prevent parsing name of annotations + if ( + uri != "@type" && uri != "@id" && uri != DomainElementModel.Sources.value.iri() && + uri != (Namespace.Core + "name").iri() + ) { // we do this to prevent parsing name of annotations val dataNode = node.getProperties(uri).get.head match { case literal @ Literal(_, _) => DynamicLiteralParser.parse(literal) @@ -95,7 +98,7 @@ class DynamicTypeParser( linkFinder.findLink(id) match { case Some(node) => node.getProperties((Namespace.Rdf + "first").iri()).isDefined || - node.getProperties((Namespace.Rdf + "rest").iri()).isDefined + node.getProperties((Namespace.Rdf + "rest").iri()).isDefined case _ => false } case _ => false @@ -114,9 +117,9 @@ class DynamicTypeParser( } private val dynamicBuilders: mutable.Map[String, Annotations => AmfObject] = mutable.Map( - LinkNode.builderType.iri() -> domain.LinkNode.apply, - ArrayNode.builderType.iri() -> domain.ArrayNode.apply, - ScalarNodeModel.`type`.head.iri() -> domain.ScalarNode.apply, - ObjectNode.builderType.iri() -> domain.ObjectNode.apply + LinkNode.builderType.iri() -> domain.LinkNode.apply, + ArrayNode.builderType.iri() -> domain.ArrayNode.apply, + ScalarNodeModel.`type`.head.iri() -> domain.ScalarNode.apply, + ObjectNode.builderType.iri() -> domain.ObjectNode.apply ) } diff --git a/amf-rdf/shared/src/main/scala/amf/rdf/internal/parsers/ObjectParser.scala b/amf-rdf/shared/src/main/scala/amf/rdf/internal/parsers/ObjectParser.scala index 8c5b5595..f9388231 100644 --- a/amf-rdf/shared/src/main/scala/amf/rdf/internal/parsers/ObjectParser.scala +++ b/amf-rdf/shared/src/main/scala/amf/rdf/internal/parsers/ObjectParser.scala @@ -2,10 +2,10 @@ package amf.rdf.internal.parsers import amf.core.client.scala.model.document.SourceMap import amf.core.client.scala.model.domain.{DataNode, _} -import amf.core.client.scala.vocabulary.Namespace +import amf.core.client.scala.vocabulary.{Namespace, ValueType} import amf.core.internal.metamodel.Type.{Any, Array, Iri, Scalar, SortedArray, Str} import amf.core.internal.metamodel.domain.{DataNodeModel, ExternalSourceElementModel, LinkableElementModel, ShapeModel} -import amf.core.internal.metamodel.{Field, Obj, Type} +import amf.core.internal.metamodel.{Field, ModelDefaultBuilder, Obj, Type} import amf.core.internal.parser.domain.Annotations import amf.core.internal.validation.CoreValidations.UnableToParseRdfDocument import amf.rdf.client.scala.{Literal, Node, PropertyObject, Uri} @@ -15,15 +15,28 @@ import amf.rdf.internal.{RdfParserCommon, RdfParserContext, _} import scala.collection.mutable.ListBuffer -class ObjectParser(val rootId: String, - val recursionControl: RecursionControl, - val plugins: EntitiesFacade, - val nodeFinder: NodeFinder, - val sourcesRetriever: SourcesRetriever)(implicit val ctx: RdfParserContext) +class ObjectParser( + val rootId: String, + val recursionControl: RecursionControl, + val plugins: EntitiesFacade, + val nodeFinder: NodeFinder, + val sourcesRetriever: SourcesRetriever +)(implicit val ctx: RdfParserContext) extends RdfParserCommon { private def isSelfEncoded(node: Node) = node.subject == rootId + private lazy val extensions = ctx.config.registryContext.getRegistry.getEntitiesRegistry.extensionTypes + private lazy val extensionFields = extensions.map { case (iriDomain, extensions) => + iriDomain -> extensions.map { case (iri, fieldType) => + Field(fieldType, ValueType(iri)) + } + } + + private def extensionsFor(model: ModelDefaultBuilder): Seq[Field] = { + model.`type`.flatMap(valueType => extensionFields.get(valueType.iri())).flatten + } + def parse(node: Node, findBaseUnit: Boolean = false, visitedSelfEncoded: Boolean = false): Option[AmfElement] = { if (recursionControl.hasVisited(node) && !isSelfEncoded(node)) ctx.nodes.get(node.subject) else { @@ -38,7 +51,7 @@ class ObjectParser(val rootId: String, checkLinkables(instance) // workaround for lazy values in shape - val modelFields = extractModelFields(model) + val modelFields = extractModelFields(model) ++ extensionsFor(model) modelFields.foreach(f => { val k = f.value.iri() @@ -73,8 +86,8 @@ class ObjectParser(val rootId: String, model match { case shapeModel: ShapeModel => shapeModel.fields ++ Seq( - ShapeModel.CustomShapePropertyDefinitions, - ShapeModel.CustomShapeProperties + ShapeModel.CustomShapePropertyDefinitions, + ShapeModel.CustomShapeProperties ) case _ => model.fields } @@ -116,11 +129,13 @@ class ObjectParser(val rootId: String, } } - private def traverse(instance: AmfObject, - f: Field, - properties: Seq[PropertyObject], - sources: SourceMap, - key: String): Unit = { + private def traverse( + instance: AmfObject, + f: Field, + properties: Seq[PropertyObject], + sources: SourceMap, + key: String + ): Unit = { val property = properties.head f.`type` match { case DataNodeModel => // dynamic nodes parsed here @@ -138,18 +153,20 @@ class ObjectParser(val rootId: String, } case _ => ctx.eh.violation( - UnableToParseRdfDocument, - instance.id, - s"Error parsing RDF graph node, unknown linked node for property $key in node ${instance.id}") + UnableToParseRdfDocument, + instance.id, + s"Error parsing RDF graph node, unknown linked node for property $key in node ${instance.id}" + ) } case array: SortedArray if properties.length == 1 => parseList(instance, array, f, properties, annots(sources, key)) case _: SortedArray => ctx.eh.violation( - UnableToParseRdfDocument, - instance.id, - s"Error, more than one sorted array values found in node for property $key in node ${instance.id}") + UnableToParseRdfDocument, + instance.id, + s"Error, more than one sorted array values found in node for property $key in node ${instance.id}" + ) case a: Array => val items = properties val values: Seq[AmfElement] = a.element match { @@ -160,8 +177,11 @@ class ObjectParser(val rootId: String, findLink(n) match { case Some(o) => parse(o, shouldParseUnit) case _ => None - }) + } + ) case Str | Iri => items.map(StringIriUriRegexParser.parse) + case Any => + items.flatMap(v => AnyTypeConverter.tryConvert(v)(ctx.eh)) } instance.setArrayWithoutId(f, values, annots(sources, key)) case _: Scalar => parseScalar(instance, f, property, annots(sources, key)) @@ -172,17 +192,16 @@ class ObjectParser(val rootId: String, def parseDynamicType(id: PropertyObject): Option[DataNode] = new DynamicTypeParser(nodeFinder, sourcesRetriever).parse(id) - private def parseList(instance: AmfObject, - l: SortedArray, - field: Field, - properties: Seq[PropertyObject], - annotations: Annotations): Unit = + private def parseList( + instance: AmfObject, + l: SortedArray, + field: Field, + properties: Seq[PropertyObject], + annotations: Annotations + ): Unit = instance.setArray(field, parseList(l.element, findLink(properties.head)), annotations) - private def parseScalar(instance: AmfObject, - field: Field, - property: PropertyObject, - annotations: Annotations): Unit = + private def parseScalar(instance: AmfObject, field: Field, property: PropertyObject, annotations: Annotations): Unit = ScalarTypeConverter.tryConvert(field.`type`, property)(ctx.eh).foreach(instance.set(field, _, annotations)) private def parseAny(instance: AmfObject, field: Field, property: PropertyObject, annotations: Annotations): Unit = diff --git a/amf-rdf/shared/src/main/scala/amf/rdf/client/scala/RdfSyntaxPlugin.scala b/amf-rdf/shared/src/main/scala/amf/rdf/internal/plugins/RdfSyntaxParsePlugin.scala similarity index 55% rename from amf-rdf/shared/src/main/scala/amf/rdf/client/scala/RdfSyntaxPlugin.scala rename to amf-rdf/shared/src/main/scala/amf/rdf/internal/plugins/RdfSyntaxParsePlugin.scala index 849897d2..30fbf1f2 100644 --- a/amf-rdf/shared/src/main/scala/amf/rdf/client/scala/RdfSyntaxPlugin.scala +++ b/amf-rdf/shared/src/main/scala/amf/rdf/internal/plugins/RdfSyntaxParsePlugin.scala @@ -1,22 +1,15 @@ -package amf.rdf.client.scala +package amf.rdf.internal.plugins import amf.core.client.common.{LowPriority, PluginPriority} import amf.core.client.scala.parse.AMFSyntaxParsePlugin import amf.core.client.scala.parse.document.{ParsedDocument, ParserContext} import amf.core.internal.remote.Mimes -import amf.core.internal.unsafe.PlatformSecrets import amf.rdf.internal.unsafe.RdfPlatformSecrets -import org.mulesoft.common.io.Output -object RdfSyntaxPlugin extends AMFSyntaxParsePlugin with RdfPlatformSecrets { +object RdfSyntaxParsePlugin extends AMFSyntaxParsePlugin with RdfPlatformSecrets { - override val id = "Rdf" + override val id = "rdf-syntax-parse-plugin" - def unparse[W: Output](mediaType: String, doc: ParsedDocument, writer: W): Option[W] = - (doc, framework) match { - case (input: RdfModelDocument, r) => r.rdfModelToSyntaxWriter(mediaType, input, writer) - case _ => None - } override def parse(text: CharSequence, mediaType: String, ctx: ParserContext): ParsedDocument = { if (!ctx.parsingOptions.isAmfJsonLdSerialization) { framework.syntaxToRdfModel(mediaType, text) @@ -25,10 +18,9 @@ object RdfSyntaxPlugin extends AMFSyntaxParsePlugin with RdfPlatformSecrets { override def mainMediaType: String = Mimes.`text/n3` - /** - * media types which specifies vendors that are parsed by this plugin. + /** media types which specifies vendors that are parsed by this plugin. */ - override def mediaTypes: Seq[String] = Nil + override def mediaTypes: Seq[String] = Seq(Mimes.`text/n3`) override def applies(element: CharSequence): Boolean = true override def priority: PluginPriority = LowPriority } diff --git a/amf-rdf/shared/src/main/scala/amf/rdf/internal/plugins/RdfSyntaxRenderPlugin.scala b/amf-rdf/shared/src/main/scala/amf/rdf/internal/plugins/RdfSyntaxRenderPlugin.scala new file mode 100644 index 00000000..270fcd83 --- /dev/null +++ b/amf-rdf/shared/src/main/scala/amf/rdf/internal/plugins/RdfSyntaxRenderPlugin.scala @@ -0,0 +1,30 @@ +package amf.rdf.internal.plugins + +import amf.core.client.common.{LowPriority, PluginPriority} +import amf.core.client.scala.parse.document.{ParsedDocument, StringParsedDocument} +import amf.core.client.scala.render.AMFSyntaxRenderPlugin +import amf.core.internal.remote.Mimes +import org.mulesoft.common.io.Output +import org.mulesoft.common.io.Output.OutputOps + +object RdfSyntaxRenderPlugin extends AMFSyntaxRenderPlugin { + + override def emit[W: Output](mediaType: String, ast: ParsedDocument, writer: W): Option[W] = { + ast match { + case str: StringParsedDocument => + writer.append(str.ast.builder.toString) + Some(writer) + case _ => None + } + } + + /** media types which specifies vendors that are parsed by this plugin. + */ + override def mediaTypes: Seq[String] = Seq(Mimes.`text/n3`) + + override val id: String = "rdf-syntax-render-plugin" + + override def applies(element: ParsedDocument): Boolean = element.isInstanceOf[StringParsedDocument] + + override def priority: PluginPriority = LowPriority +} diff --git a/amf-rdf/shared/src/test/scala/amf/rdf/PlatformRdfModelTests.scala b/amf-rdf/shared/src/test/scala/amf/rdf/PlatformRdfModelTests.scala index 0f802645..0741a585 100644 --- a/amf-rdf/shared/src/test/scala/amf/rdf/PlatformRdfModelTests.scala +++ b/amf-rdf/shared/src/test/scala/amf/rdf/PlatformRdfModelTests.scala @@ -3,9 +3,9 @@ package amf.rdf import amf.core.internal.convert.NativeOps import amf.rdf.client.platform.RdfModel import amf.rdf.internal.unsafe.RdfPlatformSecrets -import org.scalatest.FunSuite +import org.scalatest.funsuite.AnyFunSuite -trait PlatformRdfModelTests extends FunSuite with RdfPlatformSecrets with NativeOps { +trait PlatformRdfModelTests extends AnyFunSuite with RdfPlatformSecrets with NativeOps { test("Basic triple manipulation") { val model = RdfModel.empty() diff --git a/amf-rdf/shared/src/test/scala/amf/rdf/RdfModelTests.scala b/amf-rdf/shared/src/test/scala/amf/rdf/RdfModelTests.scala index 31884664..572221f1 100644 --- a/amf-rdf/shared/src/test/scala/amf/rdf/RdfModelTests.scala +++ b/amf-rdf/shared/src/test/scala/amf/rdf/RdfModelTests.scala @@ -1,9 +1,9 @@ package amf.rdf import amf.rdf.internal.unsafe.RdfPlatformSecrets -import org.scalatest.FunSuite +import org.scalatest.funsuite.AnyFunSuite -class RdfModelTests extends FunSuite with RdfPlatformSecrets { +class RdfModelTests extends AnyFunSuite with RdfPlatformSecrets { test("Manipulation of triples should invalidate cache") { val model = framework.emptyRdfModel() diff --git a/amf-validation/shared/src/main/scala/amf/validation/internal/emitters/ValidationReportJSONLDEmitter.scala b/amf-validation/shared/src/main/scala/amf/validation/internal/emitters/ValidationReportJSONLDEmitter.scala index de87ad5d..4a82d669 100644 --- a/amf-validation/shared/src/main/scala/amf/validation/internal/emitters/ValidationReportJSONLDEmitter.scala +++ b/amf-validation/shared/src/main/scala/amf/validation/internal/emitters/ValidationReportJSONLDEmitter.scala @@ -10,8 +10,7 @@ import org.yaml.model.YDocument.PartBuilder import org.yaml.model.{YDocument, YType} import org.yaml.render.JsonRender -/** - * Generates a JSON-LD graph with for an AMF validation report +/** Generates a JSON-LD graph with for an AMF validation report */ object ValidationReportJSONLDEmitter { @@ -29,8 +28,8 @@ object ValidationReportJSONLDEmitter { if (report.results.nonEmpty) { val sorted = report.results.sorted b.entry( - shacl("result"), - _.list(b => sorted.foreach(emitResult(b, _))) + shacl("result"), + _.list(b => sorted.foreach(emitResult(b, _))) ) } } @@ -42,21 +41,21 @@ object ValidationReportJSONLDEmitter { b.entry(JsonLdKeywords.Type, shacl("ValidationResult")) b.entry(shacl("resultSeverity"), emitViolation(_, result.severityLevel)) b.entry( - shacl("focusNode"), - _.obj(_.entry(JsonLdKeywords.Id, result.targetNode)) + shacl("focusNode"), + _.obj(_.entry(JsonLdKeywords.Id, result.targetNode)) ) result.targetProperty foreach { case path if path != "" => b.entry( - shacl("resultPath"), - _.obj(_.entry(JsonLdKeywords.Id, path)) + shacl("resultPath"), + _.obj(_.entry(JsonLdKeywords.Id, path)) ) case _ => // ignore } b.entry(shacl("resultMessage"), result.message) b.entry( - shacl("sourceShape"), - _.obj(_.entry(JsonLdKeywords.Id, result.validationId)) + shacl("sourceShape"), + _.obj(_.entry(JsonLdKeywords.Id, result.validationId)) ) result.position.foreach(pos => b.entry(amfParser("lexicalPosition"), emitPosition(_, pos))) } @@ -64,35 +63,36 @@ object ValidationReportJSONLDEmitter { private def emitViolation(b: PartBuilder, severity: String): Unit = { b.obj( - _.entry( - JsonLdKeywords.Id, - severity match { - case SeverityLevels.INFO => shacl("Info") - case SeverityLevels.WARNING => shacl("Warning") - case SeverityLevels.VIOLATION => shacl("Violation") - case _ => throw new Exception(s"Unknown severity level $severity") - } - )) + _.entry( + JsonLdKeywords.Id, + severity match { + case SeverityLevels.INFO => shacl("Info") + case SeverityLevels.WARNING => shacl("Warning") + case SeverityLevels.VIOLATION => shacl("Violation") + case _ => throw new Exception(s"Unknown severity level $severity") + } + ) + ) } def emitPosition(b: PartBuilder, pos: LexicalInformation): Unit = { b.obj { b => b.entry(JsonLdKeywords.Type, amfParser("Position")) b.entry( - amfParser("start"), - _.obj { b => - b.entry(JsonLdKeywords.Type, amfParser("Location")) - b.entry(amfParser("line"), raw(_, pos.range.start.line.toString, YType.Int)) - b.entry(amfParser("column"), raw(_, pos.range.start.column.toString, YType.Int)) - } + amfParser("start"), + _.obj { b => + b.entry(JsonLdKeywords.Type, amfParser("Location")) + b.entry(amfParser("line"), raw(_, pos.range.start.line.toString, YType.Int)) + b.entry(amfParser("column"), raw(_, pos.range.start.column.toString, YType.Int)) + } ) b.entry( - amfParser("end"), - _.obj { b => - b.entry(JsonLdKeywords.Type, amfParser("Location")) - b.entry(amfParser("line"), raw(_, pos.range.end.line.toString, YType.Int)) - b.entry(amfParser("column"), raw(_, pos.range.end.column.toString, YType.Int)) - } + amfParser("end"), + _.obj { b => + b.entry(JsonLdKeywords.Type, amfParser("Location")) + b.entry(amfParser("line"), raw(_, pos.range.end.line.toString, YType.Int)) + b.entry(amfParser("column"), raw(_, pos.range.end.column.toString, YType.Int)) + } ) } } diff --git a/amf-validation/shared/src/main/scala/amf/validation/internal/shacl/custom/CustomShaclValidator.scala b/amf-validation/shared/src/main/scala/amf/validation/internal/shacl/custom/CustomShaclValidator.scala index 0f072411..cbf66814 100644 --- a/amf-validation/shared/src/main/scala/amf/validation/internal/shacl/custom/CustomShaclValidator.scala +++ b/amf-validation/shared/src/main/scala/amf/validation/internal/shacl/custom/CustomShaclValidator.scala @@ -4,8 +4,9 @@ import amf.core.client.common.validation.MessageStyle import amf.core.client.scala.model.DataType import amf.core.client.scala.model.document.BaseUnit import amf.core.client.scala.model.domain._ +import amf.core.client.scala.traversal.iterator.{DomainElementStrategy, IteratorStrategy} import amf.core.client.scala.vocabulary.Namespace -import amf.core.internal.annotations.SourceAST +import amf.core.internal.annotations.LexicalInformation import amf.core.internal.metamodel.Field import amf.core.internal.parser.domain.Annotations import amf.core.internal.utils._ @@ -16,55 +17,97 @@ import amf.validation.internal.shacl.custom.CustomShaclValidator.{ ValidationInfo } import org.mulesoft.common.time.SimpleDateTime -import org.yaml.model.YScalar import java.net.URISyntaxException -import scala.concurrent.{ExecutionContext, Future} object CustomShaclValidator { case class ValidationInfo(field: Field, message: Option[String] = None, annotations: Option[Annotations] = None) + + object ValidationInfo { + def apply(field: Field, message: String, annotations: Annotations) = + new ValidationInfo(field, Some(message), Some(annotations)) + + def validationInfo(field: Field, message: String, annotations: Annotations): Option[ValidationInfo] = Some( + ValidationInfo(field, message, annotations) + ) + } + trait CustomShaclFunction { val name: String // When no validation info is provided, the validation is thrown in domain element level def run(element: AmfObject, validate: Option[ValidationInfo] => Unit): Unit } + type CustomShaclFunctions = Map[String, CustomShaclFunction] } -class CustomShaclValidator(customFunctions: CustomShaclFunctions, messageStyle: MessageStyle) { +class CustomShaclValidator( + customFunctions: CustomShaclFunctions, + messageStyle: MessageStyle, + extractor: ElementExtractor = DefaultElementExtractor, + strategy: IteratorStrategy = DomainElementStrategy +) { + + def validate(unit: BaseUnit, validations: Seq[ValidationSpecification]): ValidationReport = { + val reportBuilder: ReportBuilder = new ReportBuilder(messageStyle) + unit.iterator(strategy = strategy).foreach { + case element: DomainElement => validateIdentityTransformation(element, validations, reportBuilder) + case _ => + } + reportBuilder.build() + } + + def validate(element: DomainElement, validations: Seq[ValidationSpecification]): ValidationReport = { + val reportBuilder: ReportBuilder = new ReportBuilder(messageStyle) + validateIdentityTransformation(element, validations, reportBuilder) + reportBuilder.build() + } - private val reportBuilder: ReportBuilder = new ReportBuilder(messageStyle) + def validateProperties(element: DomainElement, validations: Seq[ValidationSpecification]): ValidationReport = { + val reportBuilder: ReportBuilder = new ReportBuilder(messageStyle) + validations.foreach(validateProperty(element, _, reportBuilder)) + reportBuilder.build() + } - def validate(unit: BaseUnit, validations: Seq[ValidationSpecification])( - implicit executionContext: ExecutionContext): Future[ValidationReport] = { - unit.iterator().foreach { - case e: DomainElement => validateIdentityTransformation(validations, e) - case _ => + private def validateProperty( + element: DomainElement, + validation: ValidationSpecification, + builder: ReportBuilder + ): Unit = { + validation.propertyConstraints.foreach { propertyConstraint => + validatePropertyConstraint(validation, propertyConstraint, element, builder) } - Future.successful(reportBuilder.build()) } - private def validateIdentityTransformation(validations: Seq[ValidationSpecification], element: DomainElement): Unit = { - val classes = element.meta.`type`.map(_.iri()) + private def validateIdentityTransformation( + element: DomainElement, + validations: Seq[ValidationSpecification], + reportBuilder: ReportBuilder + ): Unit = { + val classes = element.meta.typeIrisSet val isExternalLink = element.isExternalLink.value() validations.foreach { specification => if (!isExternalLink && (matchingClass(specification, classes) || matchingInstance(specification, element))) { - validate(specification, element) + validateElement(element, specification, reportBuilder) } - validateObjectsOf(specification, element) + validateObjectsOf(element, specification, reportBuilder) } } // this is always (?s sh:nodeKind sh:IRI), we still put the checking logic in place - private def validateObjectsOf(validationSpecification: ValidationSpecification, element: DomainElement): Unit = { + private def validateObjectsOf( + element: DomainElement, + validationSpecification: ValidationSpecification, + reportBuilder: ReportBuilder + ): Unit = { validationSpecification.targetObject.foreach { property => findFieldTarget(element, property) match { case Some((_: Annotations, objectsOf: AmfArray)) => objectsOf.foreach { case obj: DomainElement => validationSpecification.nodeConstraints.foreach { nodeConstraint => - validateNodeConstraint(validationSpecification, nodeConstraint, obj) + validateNodeConstraint(validationSpecification, nodeConstraint, obj, reportBuilder) } case _ => // ignore } @@ -73,8 +116,7 @@ class CustomShaclValidator(customFunctions: CustomShaclFunctions, messageStyle: } } - // TODO: could this made be faster by using Sets? -> We would have to propagate Sets to several places - private def matchingClass(specification: ValidationSpecification, classes: Seq[String]): Boolean = { + private def matchingClass(specification: ValidationSpecification, classes: Set[String]): Boolean = { specification.targetClass.exists(classes.contains) } @@ -94,40 +136,14 @@ class CustomShaclValidator(customFunctions: CustomShaclFunctions, messageStyle: } } - private case class ExtractedPropertyValue(value: AmfElement, nativeScalar: Option[Any]) - - private def toNativeScalar(element: AmfElement): Seq[ExtractedPropertyValue] = { - element match { - case s: AmfScalar => Seq(ExtractedPropertyValue(s, Some(amfScalarToScala(s)))) - case r: AmfArray => - r.values.flatMap(toNativeScalar) - case _ => Seq(ExtractedPropertyValue(element, None)) - } - } - - private def extractPlainPropertyValue(propertyConstraint: PropertyConstraint, - element: DomainElement): Seq[ExtractedPropertyValue] = - extractPlainPredicateValue(propertyConstraint.ramlPropertyId, element) - - private def extractPlainPredicateValue(predicate: String, element: DomainElement): Seq[ExtractedPropertyValue] = - extractElement(predicate, element).map(toNativeScalar).getOrElse(Nil) - - private def extractPropertyValue(propertyConstraint: PropertyConstraint, - element: DomainElement): Option[ExtractedPropertyValue] = { - extractElement(propertyConstraint.ramlPropertyId, element).map { - case s: AmfScalar => - ExtractedPropertyValue(s, Some(amfScalarToScala(s))) - case a: AmfArray => - ExtractedPropertyValue(a, None) - case other => - ExtractedPropertyValue(other, None) - } - } - private def extractElement(fieldUri: String, element: DomainElement): Option[AmfElement] = element.fields.getValueAsOption(fieldUri).map(_.value) - private def validate(validationSpecification: ValidationSpecification, element: DomainElement): Unit = { + private def validateElement( + element: DomainElement, + validationSpecification: ValidationSpecification, + reportBuilder: ReportBuilder + ): Unit = { validationSpecification.closed match { case Some(_) => validateClosed(validationSpecification) case _ => // ignore @@ -137,7 +153,7 @@ class CustomShaclValidator(customFunctions: CustomShaclFunctions, messageStyle: case _ => // ignore } validationSpecification.functionConstraint match { - case Some(_) => validateFunctionConstraint(validationSpecification, element) + case Some(_) => validateFunctionConstraint(validationSpecification, element, reportBuilder) case _ => // ignore } @@ -146,19 +162,19 @@ class CustomShaclValidator(customFunctions: CustomShaclFunctions, messageStyle: // The custom SHACL validator cannot execute them, it still relies on the custom Scala function case Some(functionConstraintName) => validateFunctionConstraint( - validationSpecification.copy( - functionConstraint = Some( - FunctionConstraint( - message = Some(validationSpecification.message), - internalFunction = Some(functionConstraintName) - ))), - element + validationSpecification.copy( + functionConstraint = Some( + FunctionConstraint( + message = Some(validationSpecification.message), + internalFunction = Some(functionConstraintName) + ) + ) + ), + element, + reportBuilder ) // Normal constraints here - case _ => - validationSpecification.propertyConstraints.foreach { propertyConstraint => - validatePropertyConstraint(validationSpecification, propertyConstraint, element) - } + case _ => validateProperty(element, validationSpecification, reportBuilder) } } @@ -169,34 +185,56 @@ class CustomShaclValidator(customFunctions: CustomShaclFunctions, messageStyle: private def validateCustom(validationSpecification: ValidationSpecification): Unit = { throw new Exception( - s"Arbitrary SHACL validations not supported in custom SHACL validator: ${validationSpecification.id}") + s"Arbitrary SHACL validations not supported in custom SHACL validator: ${validationSpecification.id}" + ) } - private def validateFunctionConstraint(validationSpecification: ValidationSpecification, - element: DomainElement): Unit = { + private def validateFunctionConstraint( + validationSpecification: ValidationSpecification, + element: DomainElement, + reportBuilder: ReportBuilder + ): Unit = { val functionConstraint = validationSpecification.functionConstraint.get functionConstraint.internalFunction.foreach(name => { val validationFunction = getFunctionForName(name) // depending if propertyInfo is provided, violation is thrown at a given property, or by default on element val onValidation = (validationInfo: Option[ValidationInfo]) => validationInfo match { - case Some(ValidationInfo(field, customMessage, _)) => // why annotations are never used? - reportFailure(validationSpecification, element.id, field.toString, customMessage) - case _ => reportFailure(validationSpecification, element.id, "") - } + case Some(ValidationInfo(field, customMessage, ann)) => + reportBuilder.reportFailure( + validationSpecification, + element.id, + field.toString, + customMessage, + getPosition(ann), + getLocation(ann) + ) + case _ => reportBuilder.reportFailure(validationSpecification, element.id, "") + } validationFunction.run(element, onValidation) }) } + private def getPosition(annotations: Option[Annotations]): Option[LexicalInformation] = { + annotations flatMap (_.find(classOf[LexicalInformation])) + } + + private def getLocation(annotations: Option[Annotations]): Option[String] = { + annotations flatMap (_.location()) + } + private def getFunctionForName(name: String): CustomShaclFunction = customFunctions.get(name) match { case Some(validationFunction) => validationFunction case None => throw new Exception(s"Custom function validations not supported in custom SHACL validator: $name") } - private def validateNodeConstraint(validationSpecification: ValidationSpecification, - nodeConstraint: NodeConstraint, - element: DomainElement): Unit = { + private def validateNodeConstraint( + validationSpecification: ValidationSpecification, + nodeConstraint: NodeConstraint, + element: DomainElement, + reportBuilder: ReportBuilder + ): Unit = { val nodeKindIri = (Namespace.Shacl + "nodeKind").iri() val shaclIri = (Namespace.Shacl + "IRI").iri() @@ -205,9 +243,9 @@ class CustomShaclValidator(customFunctions: CustomShaclFunctions, messageStyle: nodeConstraint.value match { case v if v == shaclIri => validationSpecification.targetObject.foreach { targetObject => - extractPlainPredicateValue(targetObject, element).foreach { + extractor.extractPlainPredicateValue(targetObject, element).foreach { case ExtractedPropertyValue(_: AmfScalar, Some(value: String)) if !value.contains("://") => - reportFailure(validationSpecification, element.id, "") + reportBuilder.reportFailure(validationSpecification, element.id, "", None) case _ => // ignore } } @@ -219,55 +257,98 @@ class CustomShaclValidator(customFunctions: CustomShaclFunctions, messageStyle: } } - private def validatePropertyConstraint(validationSpecification: ValidationSpecification, - propertyConstraint: PropertyConstraint, - element: DomainElement): Unit = { + private def validatePropertyConstraint( + validationSpecification: ValidationSpecification, + propertyConstraint: PropertyConstraint, + element: DomainElement, + reportBuilder: ReportBuilder + ): Unit = { propertyConstraint.node match { - case Some(_) => validatePropertyNode(validationSpecification, propertyConstraint, element) + case Some(_) => validatePropertyNode(validationSpecification, propertyConstraint, element, reportBuilder) case _ => } propertyConstraint.maxCount match { - case Some(_) => validateMaxCount(validationSpecification, propertyConstraint, element) + case Some(_) => validateMaxCount(validationSpecification, propertyConstraint, element, reportBuilder) case _ => } propertyConstraint.minCount match { - case Some(_) => validateMinCount(validationSpecification, propertyConstraint, element) - case _ => + case Some(minCountValue) => + val minCount = minCountValue.toInt + propertyConstraint.mandatory match { + case Some(mandatoryValue) => + // If I have minCount and mandatory, I know I am in an array + val mandatory = mandatoryValue == "true" + // If minCount is 0 and it is mandatory, this comes from minItems = 0 + mandatory = true + // I need to check only the presence of the property, empty arrays are valid + if (minCount == 0 && mandatory) + validateArrayPropertyLengthAndPresence( + validationSpecification, + propertyConstraint, + element, + reportBuilder, + mustBePresent = mandatory + ) + // If minCount is > 0 and it is not mandatory, this comes from minItems = n + // I need to check only the length of the array, but only if it is present + if (minCount > 0 && !mandatory) + validateArrayPropertyLengthAndPresence( + validationSpecification, + propertyConstraint, + element, + reportBuilder, + minItems = Some(minCount) + ) + // If minCount is > 0 and it is mandatory, this comes from minItems = n + mandatory = true + // I need to check the presence and length of the array, the original constraint will handle it + if (minCount > 0 && mandatory) + validateArrayPropertyLengthAndPresence( + validationSpecification, + propertyConstraint, + element, + reportBuilder, + mustBePresent = mandatory, + minItems = Some(minCount) + ) + case None => + // If there is no mandatory key, I run the original constraint + validateMinCount(validationSpecification, propertyConstraint, element, reportBuilder) + } + case _ => } propertyConstraint.maxLength match { - case Some(_) => validateMaxLength(validationSpecification, propertyConstraint, element) + case Some(_) => validateMaxLength(validationSpecification, propertyConstraint, element, reportBuilder) case _ => } propertyConstraint.minLength match { - case Some(_) => validateMinLength(validationSpecification, propertyConstraint, element) + case Some(_) => validateMinLength(validationSpecification, propertyConstraint, element, reportBuilder) case _ => } propertyConstraint.in.toList match { case Nil => // ignore - case l => validateIn(validationSpecification, propertyConstraint, element) + case _ => validateIn(validationSpecification, propertyConstraint, element, reportBuilder) } propertyConstraint.maxExclusive match { - case Some(_) => validateMaxExclusive(validationSpecification, propertyConstraint, element) + case Some(_) => validateMaxExclusive(validationSpecification, propertyConstraint, element, reportBuilder) case _ => // ignore } propertyConstraint.minExclusive match { - case Some(_) => validateMinExclusive(validationSpecification, propertyConstraint, element) + case Some(_) => validateMinExclusive(validationSpecification, propertyConstraint, element, reportBuilder) case _ => // ignore } propertyConstraint.maxInclusive match { - case Some(_) => validateMaxInclusive(validationSpecification, propertyConstraint, element) + case Some(_) => validateMaxInclusive(validationSpecification, propertyConstraint, element, reportBuilder) case _ => // ignore } propertyConstraint.minInclusive match { - case Some(_) => validateMinInclusive(validationSpecification, propertyConstraint, element) + case Some(_) => validateMinInclusive(validationSpecification, propertyConstraint, element, reportBuilder) case _ => // ignore } propertyConstraint.pattern match { - case Some(_) => validatePattern(validationSpecification, propertyConstraint, element) + case Some(_) => validatePattern(validationSpecification, propertyConstraint, element, reportBuilder) case _ => // ignore } propertyConstraint.datatype match { - case Some(_) => validateDataType(validationSpecification, propertyConstraint, element) + case Some(_) => validateDataType(validationSpecification, propertyConstraint, element, reportBuilder) case _ => // ignore } // @@ -275,7 +356,7 @@ class CustomShaclValidator(customFunctions: CustomShaclFunctions, messageStyle: // propertyConstraint.`class` match { case Nil => // ignore - case _ => validateClass(validationSpecification, propertyConstraint, element) + case _ => validateClass(validationSpecification, propertyConstraint, element, reportBuilder) } if (propertyConstraint.custom.isDefined) { throw new Exception(s"custom property constraint not supported yet ${validationSpecification.id}") @@ -288,26 +369,32 @@ class CustomShaclValidator(customFunctions: CustomShaclFunctions, messageStyle: } } - private def validateClass(validationSpecification: ValidationSpecification, - propertyConstraint: PropertyConstraint, - element: DomainElement): Unit = { - extractPropertyValue(propertyConstraint, element).foreach { + private def validateClass( + validationSpecification: ValidationSpecification, + propertyConstraint: PropertyConstraint, + element: DomainElement, + reportBuilder: ReportBuilder + ): Unit = { + extractor.extractPropertyValue(propertyConstraint, element).foreach { case ExtractedPropertyValue(obj: AmfObject, _) => val current = obj.meta.`type`.map(_.iri()) if (!propertyConstraint.`class`.exists(t => current.contains(t))) - reportBuilder.reportFailure(validationSpecification, propertyConstraint, element.id) + reportBuilder.reportFailure(validationSpecification, propertyConstraint, element.id, None, None) case _ => // ignore } } - private def validatePropertyNode(validationSpecification: ValidationSpecification, - propertyConstraint: PropertyConstraint, - parentElement: DomainElement): Unit = { + private def validatePropertyNode( + validationSpecification: ValidationSpecification, + propertyConstraint: PropertyConstraint, + parentElement: DomainElement, + reportBuilder: ReportBuilder + ): Unit = { if (propertyConstraint.node.get.endsWith("NonEmptyList")) { - extractPropertyValue(propertyConstraint, parentElement) match { + extractor.extractPropertyValue(propertyConstraint, parentElement) match { case Some(ExtractedPropertyValue(arr: AmfArray, _)) => if (arr.values.isEmpty) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } case _ => // ignore @@ -317,46 +404,89 @@ class CustomShaclValidator(customFunctions: CustomShaclFunctions, messageStyle: } } - private def validateMinCount(validationSpecification: ValidationSpecification, - propertyConstraint: PropertyConstraint, - parentElement: DomainElement): Unit = { - extractPropertyValue(propertyConstraint, parentElement) match { + private def validateArrayPropertyLengthAndPresence( + validationSpecification: ValidationSpecification, + propertyConstraint: PropertyConstraint, + parentElement: DomainElement, + reportBuilder: ReportBuilder, + mustBePresent: Boolean = false, + minItems: Option[Int] = None + ): Unit = { + extractor.extractPropertyValue(propertyConstraint, parentElement) match { + // The key is present and it is an array + case Some(ExtractedPropertyValue(arr: AmfArray, _)) => + minItems match { + case Some(minLength) => + // The key is present and I should check the array length + if (!(arr.values.length >= minLength)) { + reportFailure( + validationSpecification.copy(message = s"Array must have a minimum of $minLength items"), + propertyConstraint, + parentElement.id, + reportBuilder + ) + +// reportFailure(validationSpecification, +// parentElement.id, +// "", +// Some(s"Array must have a minimum of $minLength items"), +// reportBuilder) + } + + case None => // Only need to check that the key is present + } + case _ => + // The key is not present missing + if (mustBePresent) reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) + } + } + + private def validateMinCount( + validationSpecification: ValidationSpecification, + propertyConstraint: PropertyConstraint, + parentElement: DomainElement, + reportBuilder: ReportBuilder + ): Unit = { + extractor.extractPropertyValue(propertyConstraint, parentElement) match { case Some(ExtractedPropertyValue(arr: AmfArray, _)) => if (!(arr.values.length >= propertyConstraint.minCount.get.toInt)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } // cases scalar and object are equals, but we need to match by specific class because in api designer // qax environment the match does not work with the trait amfElement class case Some(ExtractedPropertyValue(_: AmfScalar, _)) => if (!(1 >= propertyConstraint.minCount.get.toInt)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } case Some(ExtractedPropertyValue(_: AmfObject, _)) => if (!(1 >= propertyConstraint.minCount.get.toInt)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } case _ => if (!propertyConstraint.minCount.contains("0")) - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } - private def validateMaxCount(validationSpecification: ValidationSpecification, - propertyConstraint: PropertyConstraint, - parentElement: DomainElement): Unit = { - extractPropertyValue(propertyConstraint, parentElement) match { + private def validateMaxCount( + validationSpecification: ValidationSpecification, + propertyConstraint: PropertyConstraint, + parentElement: DomainElement, + reportBuilder: ReportBuilder + ): Unit = { + extractor.extractPropertyValue(propertyConstraint, parentElement) match { case Some(ExtractedPropertyValue(arr: AmfArray, _)) => if (!(arr.values.length <= propertyConstraint.maxCount.get.toInt)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } case Some(ExtractedPropertyValue(_: AmfElement, _)) => if (!(1 <= propertyConstraint.maxCount.get.toInt)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } case _ => @@ -364,96 +494,108 @@ class CustomShaclValidator(customFunctions: CustomShaclFunctions, messageStyle: } } - private def validateMinLength(validationSpecification: ValidationSpecification, - propertyConstraint: PropertyConstraint, - parentElement: DomainElement): Unit = { - extractPlainPropertyValue(propertyConstraint, parentElement) match { + private def validateMinLength( + validationSpecification: ValidationSpecification, + propertyConstraint: PropertyConstraint, + parentElement: DomainElement, + reportBuilder: ReportBuilder + ): Unit = { + extractor.extractPlainPropertyValue(propertyConstraint, parentElement) match { case Seq(ExtractedPropertyValue(_: AmfScalar, Some(value: String))) => if (!(propertyConstraint.minLength.get.toInt <= value.length)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } case Seq(ExtractedPropertyValue(_: AmfScalar, Some(x))) if Option(x).isEmpty => // this happens in cases where the value of a key in YAML is the empty string if (!(propertyConstraint.minLength.get.toInt <= 0)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } case _ => // ignore } } - private def validateMaxLength(validationSpecification: ValidationSpecification, - propertyConstraint: PropertyConstraint, - parentElement: DomainElement): Unit = { - extractPlainPropertyValue(propertyConstraint, parentElement) match { + private def validateMaxLength( + validationSpecification: ValidationSpecification, + propertyConstraint: PropertyConstraint, + parentElement: DomainElement, + reportBuilder: ReportBuilder + ): Unit = { + extractor.extractPlainPropertyValue(propertyConstraint, parentElement) match { case Seq(ExtractedPropertyValue(_: AmfScalar, Some(value: String))) => if (!(propertyConstraint.maxLength.get.toInt > value.length)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } case _ => // ignore } } - private def validateIn(validationSpecification: ValidationSpecification, - propertyConstraint: PropertyConstraint, - parentElement: DomainElement): Unit = { - extractPlainPropertyValue(propertyConstraint, parentElement).foreach { - case ExtractedPropertyValue(_: AmfScalar, Some(value: String)) => + private def validateIn( + validationSpecification: ValidationSpecification, + propertyConstraint: PropertyConstraint, + parentElement: DomainElement, + reportBuilder: ReportBuilder + ): Unit = { + extractor.extractPlainPropertyValue(propertyConstraint, parentElement).foreach { + case ExtractedPropertyValue(_: AmfScalar, Some(value: Any)) => if (!propertyConstraint.in.contains(value)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } case _ => // ignore } } - private def validateMaxInclusive(validationSpecification: ValidationSpecification, - propertyConstraint: PropertyConstraint, - parentElement: DomainElement): Unit = { - extractPlainPropertyValue(propertyConstraint, parentElement).foreach { + private def validateMaxInclusive( + validationSpecification: ValidationSpecification, + propertyConstraint: PropertyConstraint, + parentElement: DomainElement, + reportBuilder: ReportBuilder + ): Unit = { + extractor.extractPlainPropertyValue(propertyConstraint, parentElement).foreach { case ExtractedPropertyValue(_: AmfScalar, Some(value: Long)) => if (propertyConstraint.maxInclusive.get.contains(".")) { if (!(propertyConstraint.maxInclusive.get.toDouble >= value.toDouble)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } else { if (!(propertyConstraint.maxInclusive.get.toLong >= value)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } case ExtractedPropertyValue(_: AmfScalar, Some(value: Integer)) => if (propertyConstraint.maxInclusive.get.contains(".")) { if (!(propertyConstraint.maxInclusive.get.toDouble >= value.toDouble)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } else { if (!(propertyConstraint.maxInclusive.get.toInt >= value)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } case ExtractedPropertyValue(_: AmfScalar, Some(value: Float)) => if (propertyConstraint.maxInclusive.get.contains(".")) { if (!(propertyConstraint.maxInclusive.get.toDouble >= value.toDouble)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } else { if (!(propertyConstraint.maxInclusive.get.toFloat >= value)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } case ExtractedPropertyValue(_: AmfScalar, Some(value: Double)) => if (propertyConstraint.maxInclusive.get.contains(".")) { if (!(propertyConstraint.maxInclusive.get.toDouble >= value)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } else { if (!(propertyConstraint.maxInclusive.get.toFloat >= value)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } @@ -461,51 +603,54 @@ class CustomShaclValidator(customFunctions: CustomShaclFunctions, messageStyle: } } - private def validateMaxExclusive(validationSpecification: ValidationSpecification, - propertyConstraint: PropertyConstraint, - parentElement: DomainElement): Unit = { - extractPlainPropertyValue(propertyConstraint, parentElement).foreach { + private def validateMaxExclusive( + validationSpecification: ValidationSpecification, + propertyConstraint: PropertyConstraint, + parentElement: DomainElement, + reportBuilder: ReportBuilder + ): Unit = { + extractor.extractPlainPropertyValue(propertyConstraint, parentElement).foreach { case ExtractedPropertyValue(_: AmfScalar, Some(value: Long)) => if (propertyConstraint.maxExclusive.get.contains(".")) { if (!(propertyConstraint.maxExclusive.get.toDouble > value.toDouble)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } else { if (!(propertyConstraint.maxExclusive.get.toLong > value)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } case ExtractedPropertyValue(_: AmfScalar, Some(value: Integer)) => if (propertyConstraint.maxExclusive.get.contains(".")) { if (!(propertyConstraint.maxExclusive.get.toDouble > value.toDouble)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } else { if (!(propertyConstraint.maxExclusive.get.toInt > value)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } case ExtractedPropertyValue(_: AmfScalar, Some(value: Float)) => if (propertyConstraint.maxExclusive.get.contains(".")) { if (!(propertyConstraint.maxExclusive.get.toDouble > value.toDouble)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } else { if (!(propertyConstraint.maxExclusive.get.toFloat > value)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } case ExtractedPropertyValue(_: AmfScalar, Some(value: Double)) => if (propertyConstraint.maxExclusive.get.contains(".")) { if (!(propertyConstraint.maxExclusive.get.toDouble > value)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } else { if (!(propertyConstraint.maxExclusive.get.toFloat > value)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } @@ -513,51 +658,54 @@ class CustomShaclValidator(customFunctions: CustomShaclFunctions, messageStyle: } } - private def validateMinInclusive(validationSpecification: ValidationSpecification, - propertyConstraint: PropertyConstraint, - parentElement: DomainElement): Unit = { - extractPlainPropertyValue(propertyConstraint, parentElement).foreach { + private def validateMinInclusive( + validationSpecification: ValidationSpecification, + propertyConstraint: PropertyConstraint, + parentElement: DomainElement, + reportBuilder: ReportBuilder + ): Unit = { + extractor.extractPlainPropertyValue(propertyConstraint, parentElement).foreach { case ExtractedPropertyValue(_: AmfScalar, Some(value: Long)) => if (propertyConstraint.minInclusive.get.contains(".")) { if (!(propertyConstraint.minInclusive.get.toDouble <= value.toDouble)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } else { if (!(propertyConstraint.minInclusive.get.toLong <= value)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } case ExtractedPropertyValue(_: AmfScalar, Some(value: Integer)) => if (propertyConstraint.minInclusive.get.contains(".")) { if (!(propertyConstraint.minInclusive.get.toDouble <= value.toDouble)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } else { if (!(propertyConstraint.minInclusive.get.toInt <= value)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } case ExtractedPropertyValue(_: AmfScalar, Some(value: Float)) => if (propertyConstraint.minInclusive.get.contains(".")) { if (!(propertyConstraint.minInclusive.get.toDouble <= value.toDouble)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } else { if (!(propertyConstraint.minInclusive.get.toFloat <= value)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } case ExtractedPropertyValue(_: AmfScalar, Some(value: Double)) => if (propertyConstraint.minInclusive.get.contains(".")) { if (!(propertyConstraint.minInclusive.get.toDouble <= value)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } else { if (!(propertyConstraint.minInclusive.get.toFloat <= value)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } @@ -565,51 +713,54 @@ class CustomShaclValidator(customFunctions: CustomShaclFunctions, messageStyle: } } - private def validateMinExclusive(validationSpecification: ValidationSpecification, - propertyConstraint: PropertyConstraint, - parentElement: DomainElement): Unit = { - extractPlainPropertyValue(propertyConstraint, parentElement).foreach { + private def validateMinExclusive( + validationSpecification: ValidationSpecification, + propertyConstraint: PropertyConstraint, + parentElement: DomainElement, + reportBuilder: ReportBuilder + ): Unit = { + extractor.extractPlainPropertyValue(propertyConstraint, parentElement).foreach { case ExtractedPropertyValue(_: AmfScalar, Some(value: Long)) => if (propertyConstraint.minExclusive.get.contains(".")) { if (!(propertyConstraint.minExclusive.get.toDouble < value.toDouble)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } else { if (!(propertyConstraint.minExclusive.get.toLong < value)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } case ExtractedPropertyValue(_: AmfScalar, Some(value: Integer)) => if (propertyConstraint.minExclusive.get.contains(".")) { if (!(propertyConstraint.minExclusive.get.toDouble < value.toDouble)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } else { if (!(propertyConstraint.minExclusive.get.toInt < value)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } case ExtractedPropertyValue(_: AmfScalar, Some(value: Float)) => if (propertyConstraint.minExclusive.get.contains(".")) { if (!(propertyConstraint.minExclusive.get.toDouble < value.toDouble)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } else { if (!(propertyConstraint.minExclusive.get.toFloat < value)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } case ExtractedPropertyValue(_: AmfScalar, Some(value: Double)) => if (propertyConstraint.minExclusive.get.contains(".")) { if (!(propertyConstraint.minExclusive.get.toDouble < value)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } else { if (!(propertyConstraint.minExclusive.get.toFloat < value)) { - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } } @@ -617,13 +768,16 @@ class CustomShaclValidator(customFunctions: CustomShaclFunctions, messageStyle: } } - private def validatePattern(validationSpecification: ValidationSpecification, - propertyConstraint: PropertyConstraint, - parentElement: DomainElement): Unit = { - extractPlainPropertyValue(propertyConstraint, parentElement).foreach { + private def validatePattern( + validationSpecification: ValidationSpecification, + propertyConstraint: PropertyConstraint, + parentElement: DomainElement, + reportBuilder: ReportBuilder + ): Unit = { + extractor.extractPlainPropertyValue(propertyConstraint, parentElement).foreach { case ExtractedPropertyValue(scalar: AmfScalar, _) => if (valueDoesntComplyWithPattern(propertyConstraint, scalar)) - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) case _ => // ignore } } @@ -632,12 +786,16 @@ class CustomShaclValidator(customFunctions: CustomShaclFunctions, messageStyle: Option(value).isDefined && propertyConstraint.pattern.get.r.findFirstIn(value.toString).isEmpty } - private def validateDataType(validationSpecification: ValidationSpecification, - propertyConstraint: PropertyConstraint, - parentElement: DomainElement): Unit = { + private def validateDataType( + validationSpecification: ValidationSpecification, + propertyConstraint: PropertyConstraint, + parentElement: DomainElement, + reportBuilder: ReportBuilder + ): Unit = { val xsdString = DataType.String val xsdBoolean = DataType.Boolean val xsdInteger = DataType.Integer + val xsdLong = DataType.Long val xsdDouble = DataType.Double val xsdDate = DataType.Date val xsdDateTime = DataType.DateTime @@ -645,23 +803,23 @@ class CustomShaclValidator(customFunctions: CustomShaclFunctions, messageStyle: val xsdTime = DataType.Time val xsdAnyURI = DataType.AnyUri - extractPlainPropertyValue(propertyConstraint, parentElement).foreach { + extractor.extractPlainPropertyValue(propertyConstraint, parentElement).foreach { case ExtractedPropertyValue(_: AmfScalar, maybeScalarValue) => propertyConstraint.datatype match { case Some(s) if s == xsdString => // ignore - case Some(s) if s == xsdBoolean => maybeScalarValue match { case Some(_: Boolean) => // ignore case _ => - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } - case Some(s) if s == xsdInteger => + + case Some(s) if s == xsdInteger | s == xsdLong => maybeScalarValue match { case Some(_: Integer) => // ignore case Some(_: Long) => // ignore case _ => - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } case Some(s) if s == xsdDouble => @@ -671,31 +829,35 @@ class CustomShaclValidator(customFunctions: CustomShaclFunctions, messageStyle: case Some(_: Double) => // ignore case Some(_: Float) => // ignore case _ => - reportFailure(validationSpecification, propertyConstraint, parentElement.id) + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) } case Some(s) if s == xsdDate => SimpleDateTime.parseDate(maybeScalarValue.map(_.toString).getOrElse("")) match { - case Left(_) => reportFailure(validationSpecification, propertyConstraint, parentElement.id) - case _ => + case Left(_) => + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) + case _ => } case Some(s) if s == xsdDateTime => SimpleDateTime.parse(maybeScalarValue.map(_.toString).getOrElse("")) match { - case Left(_) => reportFailure(validationSpecification, propertyConstraint, parentElement.id) - case _ => + case Left(_) => + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) + case _ => } case Some(s) if s == xsdDateTimeOnly => SimpleDateTime.parseFullTime(maybeScalarValue.map(_.toString).getOrElse("")) match { - case Left(_) => reportFailure(validationSpecification, propertyConstraint, parentElement.id) - case _ => + case Left(_) => + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) + case _ => } case Some(s) if s == xsdTime => SimpleDateTime.parsePartialTime(maybeScalarValue.map(_.toString).getOrElse("")) match { - case Left(_) => reportFailure(validationSpecification, propertyConstraint, parentElement.id) - case _ => + case Left(_) => + reportFailure(validationSpecification, propertyConstraint, parentElement.id, reportBuilder) + case _ => } case Some(s) if s == xsdAnyURI => - validateURI(validationSpecification, propertyConstraint, parentElement.id, maybeScalarValue) + validateURI(validationSpecification, propertyConstraint, parentElement.id, maybeScalarValue, reportBuilder) case Some(other) => throw new Exception(s"Data type '$other' for sh:datatype property constraint not supported yet") @@ -705,46 +867,31 @@ class CustomShaclValidator(customFunctions: CustomShaclFunctions, messageStyle: } } - /** - * Check if argument is a valid URI, URL or URN + /** Check if argument is a valid URI, URL or URN */ - def validateURI(validationSpecification: ValidationSpecification, - propertyConstraint: PropertyConstraint, - id: String, - value: Option[Any]): Unit = { + def validateURI( + validationSpecification: ValidationSpecification, + propertyConstraint: PropertyConstraint, + id: String, + value: Option[Any], + reportBuilder: ReportBuilder + ): Unit = { value.foreach { v => try { v.toString.normalizePath } catch { case _: URISyntaxException => - reportFailure(validationSpecification, propertyConstraint, id) + reportFailure(validationSpecification, propertyConstraint, id, reportBuilder) } } } - private def amfScalarToScala(scalar: AmfScalar): Any = { - scalar.annotations.find(classOf[SourceAST]) match { - case Some(ast: SourceAST) => - ast.ast match { - case yscalar: YScalar => yscalar.value - case _ => scalar.value - } - - case None => - scalar.value - } - } - - private def reportFailure(validationSpecification: ValidationSpecification, - propertyConstraint: PropertyConstraint, - id: String): Unit = { - reportBuilder.reportFailure(validationSpecification, propertyConstraint, id) - } - - private def reportFailure(validationSpec: ValidationSpecification, - id: String, - path: String, - customMessage: Option[String] = None): Unit = { - reportBuilder.reportFailure(validationSpec, id, path, customMessage) + private def reportFailure( + validationSpecification: ValidationSpecification, + propertyConstraint: PropertyConstraint, + id: String, + reportBuilder: ReportBuilder + ): Unit = { + reportBuilder.reportFailure(validationSpecification, propertyConstraint, id, None, None) } } diff --git a/amf-validation/shared/src/main/scala/amf/validation/internal/shacl/custom/CustomValidationReport.scala b/amf-validation/shared/src/main/scala/amf/validation/internal/shacl/custom/CustomValidationReport.scala index ccd8f996..6e1827e3 100644 --- a/amf-validation/shared/src/main/scala/amf/validation/internal/shacl/custom/CustomValidationReport.scala +++ b/amf-validation/shared/src/main/scala/amf/validation/internal/shacl/custom/CustomValidationReport.scala @@ -1,6 +1,7 @@ package amf.validation.internal.shacl.custom import amf.core.client.common.validation.{MessageStyle, OASStyle, RAMLStyle, SeverityLevels} +import amf.core.internal.annotations.LexicalInformation import amf.core.internal.validation.core._ import scala.collection.mutable @@ -17,29 +18,41 @@ class ReportBuilder(messageStyle: MessageStyle) { private val results: mutable.ListBuffer[ValidationResult] = mutable.ListBuffer.empty - def reportFailure(validationSpecification: ValidationSpecification, - propertyConstraint: PropertyConstraint, - id: String): Unit = { - reportFailure(validationSpecification, id, propertyConstraint.ramlPropertyId) + def reportFailure( + validationSpecification: ValidationSpecification, + propertyConstraint: PropertyConstraint, + id: String, + position: Option[LexicalInformation], + location: Option[String] + ): Unit = { + reportFailure(validationSpecification, id, propertyConstraint.ramlPropertyId, None, position, location) } - def reportFailure(validationSpec: ValidationSpecification, - id: String, - path: String, - customMessage: Option[String] = None): Unit = { + def reportFailure( + validationSpec: ValidationSpecification, + id: String, + path: String, + customMessage: Option[String] = None, + position: Option[LexicalInformation] = None, + location: Option[String] = None + ): Unit = { registerResult( - CustomValidationResult( - message = customMessage.orElse(getMessageOf(validationSpec, messageStyle)), - path = path, - sourceConstraintComponent = validationSpec.id, - focusNode = id, - severity = ShaclSeverityUris.amfSeverity(validationSpec.severity), - sourceShape = validationSpec.id - )) + CustomValidationResult( + message = customMessage.orElse(getMessageOf(validationSpec, messageStyle)), + path = path, + sourceConstraintComponent = validationSpec.id, + focusNode = id, + severity = ShaclSeverityUris.amfSeverity(validationSpec.severity), + sourceShape = validationSpec.id, + position = position, + location = location + ) + ) } private def registerResult(result: ValidationResult): Unit = { - val key = result.sourceShape + result.sourceConstraintComponent + result.focusNode + val key = + result.sourceShape + result.sourceConstraintComponent + result.focusNode + result.message + result.position + result.location if (!duplicates.contains(key)) { duplicates += key results.append(result) @@ -56,7 +69,7 @@ class ReportBuilder(messageStyle: MessageStyle) { case class CustomValidationReport(var rs: List[ValidationResult] = Nil) extends ValidationReport { - override def conforms: Boolean = results.exists(_.severity == SeverityLevels.VIOLATION) + override def conforms: Boolean = !results.exists(_.severity == SeverityLevels.VIOLATION) override def results: List[ValidationResult] = rs } diff --git a/amf-validation/shared/src/main/scala/amf/validation/internal/shacl/custom/CustomValidationResult.scala b/amf-validation/shared/src/main/scala/amf/validation/internal/shacl/custom/CustomValidationResult.scala index a0f09a10..24169a4f 100644 --- a/amf-validation/shared/src/main/scala/amf/validation/internal/shacl/custom/CustomValidationResult.scala +++ b/amf-validation/shared/src/main/scala/amf/validation/internal/shacl/custom/CustomValidationResult.scala @@ -1,11 +1,15 @@ package amf.validation.internal.shacl.custom +import amf.core.internal.annotations.LexicalInformation import amf.core.internal.validation.core.ValidationResult -case class CustomValidationResult(message: Option[String], - path: String, - sourceConstraintComponent: String, - focusNode: String, - severity: String, - sourceShape: String) - extends ValidationResult +case class CustomValidationResult( + message: Option[String], + path: String, + sourceConstraintComponent: String, + focusNode: String, + severity: String, + sourceShape: String, + position: Option[LexicalInformation], + location: Option[String] +) extends ValidationResult diff --git a/amf-validation/shared/src/main/scala/amf/validation/internal/shacl/custom/ElementExtractor.scala b/amf-validation/shared/src/main/scala/amf/validation/internal/shacl/custom/ElementExtractor.scala new file mode 100644 index 00000000..8946681d --- /dev/null +++ b/amf-validation/shared/src/main/scala/amf/validation/internal/shacl/custom/ElementExtractor.scala @@ -0,0 +1,89 @@ +package amf.validation.internal.shacl.custom + +import amf.core.client.scala.model.domain.{AmfArray, AmfElement, AmfScalar, DomainElement} +import amf.core.internal.annotations.{SourceAST, SourceYPart} +import amf.core.internal.validation.core.PropertyConstraint +import org.yaml.model.YScalar + +case class ExtractedPropertyValue(value: AmfElement, nativeScalar: Option[Any]) + +trait ElementExtractor { + def extractPlainPropertyValue( + propertyConstraint: PropertyConstraint, + element: DomainElement + ): Seq[ExtractedPropertyValue] + + def extractPlainPredicateValue(predicate: String, element: DomainElement): Seq[ExtractedPropertyValue] + + def extractPropertyValue( + propertyConstraint: PropertyConstraint, + element: DomainElement + ): Option[ExtractedPropertyValue] +} + +object DefaultElementExtractor extends ElementExtractor { + def extractPlainPropertyValue( + propertyConstraint: PropertyConstraint, + element: DomainElement + ): Seq[ExtractedPropertyValue] = + extractPlainPredicateValue(propertyConstraint.ramlPropertyId, element) + + def extractPlainPredicateValue(predicate: String, element: DomainElement): Seq[ExtractedPropertyValue] = + extractElement(predicate, element).map(toNativeScalar).getOrElse(Nil) + + def extractPropertyValue( + propertyConstraint: PropertyConstraint, + element: DomainElement + ): Option[ExtractedPropertyValue] = { + extractElement(propertyConstraint.ramlPropertyId, element).map { + case s: AmfScalar => + ExtractedPropertyValue(s, Some(amfScalarToScala(s))) + case other => + ExtractedPropertyValue(other, None) + } + } + + private def amfScalarToScala(scalar: AmfScalar): Any = { + scalar.annotations.find(classOf[SourceYPart]) match { + case Some(ast: SourceYPart) => + ast.ast match { + case yscalar: YScalar => yscalar.value + case _ => scalar.value + } + + case None => + scalar.value + } + } + + private def toNativeScalar(element: AmfElement): Seq[ExtractedPropertyValue] = { + element match { + case s: AmfScalar => Seq(ExtractedPropertyValue(s, Some(amfScalarToScala(s)))) + case r: AmfArray => + r.values.flatMap(toNativeScalar) + case _ => Seq(ExtractedPropertyValue(element, None)) + } + } + + private def extractElement(fieldUri: String, element: DomainElement): Option[AmfElement] = + element.fields.getValueAsOption(fieldUri).map(_.value) +} + +class ScalarElementExtractor(scalar: AmfScalar) extends ElementExtractor { + override def extractPlainPropertyValue( + propertyConstraint: PropertyConstraint, + element: DomainElement + ): Seq[ExtractedPropertyValue] = Seq(value()) + + override def extractPlainPredicateValue(predicate: String, element: DomainElement): Seq[ExtractedPropertyValue] = + Seq(value()) + + override def extractPropertyValue( + propertyConstraint: PropertyConstraint, + element: DomainElement + ): Option[ExtractedPropertyValue] = { + Some(value()) + } + + private def value() = ExtractedPropertyValue(scalar, Option(scalar.value)) +} diff --git a/amf-validation/shared/src/main/scala/amf/validation/internal/shacl/custom/PropertyConstraintValidator.scala b/amf-validation/shared/src/main/scala/amf/validation/internal/shacl/custom/PropertyConstraintValidator.scala index a52245c3..2606c9bd 100644 --- a/amf-validation/shared/src/main/scala/amf/validation/internal/shacl/custom/PropertyConstraintValidator.scala +++ b/amf-validation/shared/src/main/scala/amf/validation/internal/shacl/custom/PropertyConstraintValidator.scala @@ -1,14 +1,16 @@ package amf.validation.internal.shacl.custom import amf.core.client.scala.model.domain.{AmfElement, AmfObject, AmfScalar} -import amf.core.internal.annotations.SourceAST +import amf.core.internal.annotations.{SourceAST, SourceYPart} import amf.core.internal.parser.domain.Annotations import amf.core.internal.validation.core.{PropertyConstraint, ValidationSpecification} import org.yaml.model.YScalar object PropertyConstraintValidator { - def extractPropertyValue(propertyConstraint: PropertyConstraint, - element: AmfObject): Option[(Annotations, AmfElement, Option[Any])] = { + def extractPropertyValue( + propertyConstraint: PropertyConstraint, + element: AmfObject + ): Option[(Annotations, AmfElement, Option[Any])] = { extractPredicateValue(propertyConstraint.ramlPropertyId, element) } @@ -31,12 +33,12 @@ object PropertyConstraintValidator { def amfScalarToScala(scalar: AmfScalar): Any = { scalar.annotations.find(classOf[SourceAST]) match { - case Some(ast: SourceAST) => + case Some(ast: SourceYPart) => ast.ast match { case yscalar: YScalar => yscalar.value case _ => scalar.value } - + case Some(_) => scalar.value case None => scalar.value } @@ -51,8 +53,10 @@ trait ConstraintValidator { trait PropertyConstraintValidator { def canValidate(spec: PropertyConstraint): Boolean - def validate(spec: ValidationSpecification, - propertyConstraint: PropertyConstraint, - parent: AmfObject, - reportBuilder: ReportBuilder) + def validate( + spec: ValidationSpecification, + propertyConstraint: PropertyConstraint, + parent: AmfObject, + reportBuilder: ReportBuilder + ) } diff --git a/build.sbt b/build.sbt index 7f461089..abf6a741 100644 --- a/build.sbt +++ b/build.sbt @@ -1,4 +1,3 @@ -import org.scalajs.core.tools.linker.ModuleKind import sbt.Keys.{libraryDependencies, resolvers} import sbtcrossproject.CrossPlugin.autoImport.crossProject import sbtsonar.SonarPlugin.autoImport.sonarProperties @@ -7,141 +6,128 @@ val ivyLocal = Resolver.file("ivy", file(Path.userHome.absolutePath + "/.ivy2/lo name := "amf-aml" -ThisBuild / version := "6.0.1" -ThisBuild / scalaVersion := "2.12.11" +ThisBuild / scalaVersion := "2.12.20" +ThisBuild / version := "6.8.0-SNAPSHOT" + +val amfCoreVersion = "5.8.0-SNAPSHOT" +val scalaCommonTestVersion = "0.2.15" publish := {} jsEnv := new org.scalajs.jsenv.nodejs.NodeJSEnv() -lazy val sonarUrl = sys.env.getOrElse("SONAR_SERVER_URL", "Not found url.") -lazy val sonarToken = sys.env.getOrElse("SONAR_SERVER_TOKEN", "Not found token.") - -sonarProperties ++= Map( - "sonar.login" -> sonarToken, - "sonar.projectKey" -> "mulesoft.amf-aml", - "sonar.projectName" -> "AMF-AML", - "sonar.projectVersion" -> "4.0.0", - "sonar.sourceEncoding" -> "UTF-8", - "sonar.github.repository" -> "mulesoft/amf-aml", - "sonar.sources" -> "amf-aml/shared/src/main/scala", - "sonar.tests" -> "amf-aml/shared/src/test/scala", - "sonar.scala.coverage.reportPaths" -> "aml-aml/jvm/target/scala-2.12/scoverage-report/scoverage.xml" -) - lazy val workspaceDirectory: File = sys.props.get("sbt.mulesoft") match { case Some(x) => file(x) case _ => Path.userHome / "mulesoft" } -val amfCoreVersion = "5.0.1" - lazy val amfCoreJVMRef = ProjectRef(workspaceDirectory / "amf-core", "coreJVM") lazy val amfCoreJSRef = ProjectRef(workspaceDirectory / "amf-core", "coreJS") -lazy val amfCoreLibJVM = "com.github.amlorg" %% "amf-core" % amfCoreVersion -lazy val amfCoreLibJS = "com.github.amlorg" %% "amf-core_sjs0.6" % amfCoreVersion +lazy val amfCoreLibJVM = "com.github.amlorg" %% "amf-core" % amfCoreVersion +lazy val amfCoreLibJS = "com.github.amlorg" %% "amf-core_sjs1" % amfCoreVersion val commonSettings = Common.settings ++ Common.publish ++ Seq( organization := "com.github.amlorg", resolvers ++= List(ivyLocal, Common.releases, Common.snapshots, Resolver.mavenLocal, Resolver.mavenCentral), credentials ++= Common.credentials(), libraryDependencies ++= Seq( - "org.scalatest" %%% "scalatest" % "3.0.5" % Test, - "org.mule.common" %%% "scala-common-test" % "0.0.6" % Test, - "org.slf4j" % "slf4j-nop" % "1.7.30" % Test + "org.mule.common" %%% "scala-common-test" % scalaCommonTestVersion % Test, + "org.slf4j" % "slf4j-nop" % "1.7.32" % Test ), Test / logBuffered := false ) -/** ********************************************** - * AMF-Core - * ********************************************* */ +/** ********************************************** AMF-Core ********************************************* + */ lazy val defaultProfilesGenerationTask = TaskKey[Unit]( "defaultValidationProfilesGeneration", - "Generates the validation dialect documents for the standard profiles") + "Generates the validation dialect documents for the standard profiles" +) -/** ********************************************** - * AMF-AML - * ********************************************* */ +/** ********************************************** AMF-AML ********************************************* + */ lazy val aml = crossProject(JSPlatform, JVMPlatform) .settings( Seq( name := "amf-aml" - )) + ) + ) .in(file("./amf-aml")) .dependsOn(rdf % "test") .settings(commonSettings) .dependsOn(validation) .jvmSettings( - libraryDependencies += "org.scala-js" %% "scalajs-stubs" % scalaJSVersion % "provided", - Compile / packageDoc / artifactPath := baseDirectory.value / "target" / "artifact" / "amf-aml-javadoc.jar" + libraryDependencies += "org.scala-js" %% "scalajs-stubs" % "1.1.0" % "provided", + Compile / packageDoc / artifactPath := baseDirectory.value / "target" / "artifact" / "amf-aml-javadoc.jar" ) .jsSettings( - scalaJSModuleKind := ModuleKind.CommonJSModule, - Compile / fullOptJS / artifactPath := baseDirectory.value / "target" / "artifact" / "amf-aml-module.js", - scalacOptions += "-P:scalajs:suppressExportDeprecations" + scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }, + Compile / fullOptJS / artifactPath := baseDirectory.value / "target" / "artifact" / "amf-aml-module.js", + jsDependencies += ProvidedJS / "shacl.js" % "test" ) - .disablePlugins(SonarPlugin) lazy val amlJVM = aml.jvm.in(file("./amf-aml/jvm")) -lazy val amlJS = aml.js.in(file("./amf-aml/js")) +lazy val amlJS = aml.js + .in(file("./amf-aml/js")) + .disablePlugins(SonarPlugin, ScoverageSbtPlugin) + .enablePlugins(JSDependenciesPlugin) -/** ********************************************** - * AMF-Validation - * ********************************************* */ +/** ********************************************** AMF-Validation ********************************************* + */ lazy val validation = crossProject(JSPlatform, JVMPlatform) .settings( Seq( name := "amf-validation" - )) + ) + ) .in(file("./amf-validation")) .settings(commonSettings) .jvmSettings( - Compile / packageDoc / artifactPath := baseDirectory.value / "target" / "artifact" / "amf-validation-javadoc.jar" + Compile / packageDoc / artifactPath := baseDirectory.value / "target" / "artifact" / "amf-validation-javadoc.jar" ) .jsSettings( - scalaJSModuleKind := ModuleKind.CommonJSModule, - Compile / fullOptJS / artifactPath := baseDirectory.value / "target" / "artifact" / "amf-validation-module.js" + scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }, + Compile / fullOptJS / artifactPath := baseDirectory.value / "target" / "artifact" / "amf-validation-module.js" ) - .disablePlugins(SonarPlugin) -lazy val validationJVM = validation.jvm.in(file("./amf-validation/jvm")).sourceDependency(amfCoreJVMRef, amfCoreLibJVM) +lazy val validationJVM = validation.jvm + .in(file("./amf-validation/jvm")) + .sourceDependency(amfCoreJVMRef, amfCoreLibJVM) + .disablePlugins(SonarPlugin) lazy val validationJS = validation.js .in(file("./amf-validation/js")) .sourceDependency(amfCoreJSRef, amfCoreLibJS) - .disablePlugins(SonarPlugin) + .disablePlugins(SonarPlugin, ScoverageSbtPlugin) -/** ********************************************** - * AMF-RDF - * ********************************************* */ +/** ********************************************** AMF-RDF ********************************************* + */ lazy val rdf = crossProject(JSPlatform, JVMPlatform) .settings( Seq( name := "amf-rdf" - )) + ) + ) .in(file("./amf-rdf")) .settings(commonSettings) .jvmSettings( - libraryDependencies += "org.scala-js" %% "scalajs-stubs" % scalaJSVersion % "provided", - libraryDependencies += "org.json4s" %% "json4s-native" % "3.5.4", - libraryDependencies += "org.apache.jena" % "jena-arq" % "3.17.0", - libraryDependencies += "org.apache.thrift" % "libthrift" % "0.14.1", // CVE-2020-13949 + libraryDependencies += "org.scala-js" %% "scalajs-stubs" % "1.1.0" % "provided", + libraryDependencies += "org.json4s" %% "json4s-native" % "4.0.5", + libraryDependencies += "org.apache.jena" % "jena-arq" % "3.17.0", + libraryDependencies += "org.apache.thrift" % "libthrift" % "0.14.1", // CVE-2020-13949 excludeDependencies += "org.apache.tomcat.embed" % "tomcat-embed-core", - libraryDependencies += "commons-io" % "commons-io" % "2.6", - libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.9", - libraryDependencies += "org.apache.commons" % "commons-compress" % "1.21", // CVE-2021-35515 upto CVE-2021-35517 - libraryDependencies += "com.fasterxml.jackson.core" % "jackson-databind" % "2.11.0", - Compile / packageDoc / artifactPath := baseDirectory.value / "target" / "artifact" / "amf-rdf-javadoc.jar", + excludeDependencies += "com.fasterxml.jackson.core" % "jackson-databind", // transitive from jena-arq + libraryDependencies += "commons-io" % "commons-io" % "2.6", + libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.9", + libraryDependencies += "org.apache.commons" % "commons-compress" % "1.21", // CVE-2021-35515 upto CVE-2021-35517 + Compile / packageDoc / artifactPath := baseDirectory.value / "target" / "artifact" / "amf-rdf-javadoc.jar" ) .jsSettings( jsDependencies += ProvidedJS / "shacl.js", - scalaJSModuleKind := ModuleKind.CommonJSModule, - Compile / fullOptJS / artifactPath := baseDirectory.value / "target" / "artifact" / "amf-rdf-module.js", - scalacOptions += "-P:scalajs:suppressExportDeprecations" + scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }, + Compile / fullOptJS / artifactPath := baseDirectory.value / "target" / "artifact" / "amf-rdf-module.js" ) - .disablePlugins(SonarPlugin) lazy val rdfJVM = rdf.jvm.in(file("./amf-rdf/jvm")).sourceDependency(amfCoreJVMRef, amfCoreLibJVM) @@ -150,8 +136,30 @@ lazy val rdfJS = rdf.js .in(file("./amf-rdf/js")) .sourceDependency(amfCoreJSRef, amfCoreLibJS) + .disablePlugins(SonarPlugin, ScoverageSbtPlugin) + .enablePlugins(JSDependenciesPlugin) ThisBuild / libraryDependencies ++= Seq( - compilerPlugin("com.github.ghik" % "silencer-plugin" % "1.7.1" cross CrossVersion.constant("2.12.11")), - "com.github.ghik" % "silencer-lib" % "1.7.1" % Provided cross CrossVersion.constant("2.12.11") + compilerPlugin("com.github.ghik" % "silencer-plugin" % "1.7.19" cross CrossVersion.constant("2.12.20")), + "com.github.ghik" % "silencer-lib" % "1.7.19" % Provided cross CrossVersion.constant("2.12.20") +) + +lazy val sonarUrl = sys.env.getOrElse("SONAR_SERVER_URL", "Not found url.") +lazy val sonarToken = sys.env.getOrElse("SONAR_SERVER_TOKEN", "Not found token.") +lazy val branch = sys.env.getOrElse("BRANCH_NAME", "develop") + +sonarProperties ++= Map( + "sonar.login" -> sonarToken, + "sonar.projectKey" -> "mulesoft.amf-aml.gec", + "sonar.projectName" -> "AMF-AML", + "sonar.projectVersion" -> version.value, + "sonar.sourceEncoding" -> "UTF-8", + "sonar.github.repository" -> "mulesoft/amf-aml", + "sonar.branch.name" -> branch, + "sonar.sources" -> ("amf-aml/shared/src/main/scala, " + "amf-rdf/shared/src/main/scala, " + "amf-validation/shared/src/main/scala"), + "sonar.tests" -> ("amf-aml/shared/src/test/scala, " + "amf-rdf/shared/src/test/scala"), + "sonar.userHome" -> "${buildDir}/.sonar", + "sonar.scala.coverage.reportPaths" -> "target/scala-2.12/scoverage-report/scoverage.xml" ) + +Global / concurrentRestrictions += Tags.limit(Tags.Untagged, 1) diff --git a/project/Common.scala b/project/Common.scala index 6a3a8a4b..db40560f 100644 --- a/project/Common.scala +++ b/project/Common.scala @@ -9,40 +9,40 @@ object Common { val releases: MavenRepository = "MuleSoft releases" at s"$nexus/releases" val settings: Seq[Def.Setting[_]] = Seq( - Test / parallelExecution := false, - Test / fork := false, - scalacOptions ++= Seq("-unchecked", "-target:jvm-1.8", "-feature", "-deprecation", "-Xfatal-warnings"), - scalacOptions ++= Seq("-encoding", "utf-8"), - javacOptions ++= Seq("-source", "1.8", "-target", "1.8"), - Compile / doc / scalacOptions ++= Seq("-groups", "-implicits", "-no-link-warnings") + Test / parallelExecution := false, + Test / fork := false, + scalacOptions ++= Seq("-unchecked", "-target:jvm-1.8", "-feature", "-deprecation", "-Xfatal-warnings"), + scalacOptions ++= Seq("-encoding", "utf-8"), + javacOptions ++= Seq("-source", "1.8", "-target", "1.8"), + Compile / doc / scalacOptions ++= Seq("-groups", "-implicits", "-no-link-warnings") ) val publish: Seq[Def.Setting[_]] = Seq( - publishTo := Some(if (isSnapshot.value) snapshots else releases) + publishTo := Some(if (isSnapshot.value) snapshots else releases) ) def credentials(): Seq[Credentials] = { val cs = - Seq("mule_user" -> "mule_password", - "PUBLIC_NEXUS_USER" -> "PUBLIC_NEXUS_PASS", - "NEXUS_USER" -> "NEXUS_PASSWORD", - "NEXUS_USR" -> "NEXUS_PSW") - .flatMap({ - case (user, password) => - for { - u <- sys.env.get(user) - p <- sys.env.get(password) - } yield u -> p + Seq( + "mule_user" -> "mule_password", + "PUBLIC_NEXUS_USER" -> "PUBLIC_NEXUS_PASS", + "NEXUS_USER" -> "NEXUS_PASSWORD", + "NEXUS_USR" -> "NEXUS_PSW" + ) + .flatMap({ case (user, password) => + for { + u <- sys.env.get(user) + p <- sys.env.get(password) + } yield u -> p }) if (cs.nonEmpty) { println("Using System Custom credentials ") - cs.flatMap({ - case (user, password) => - Seq( - Credentials("Sonatype Nexus Repository Manager", "repository-master.mulesoft.org", user, password), - Credentials("Sonatype Nexus Repository Manager", "repository.mulesoft.org", user, password) - ) + cs.flatMap({ case (user, password) => + Seq( + Credentials("Sonatype Nexus Repository Manager", "repository-master.mulesoft.org", user, password), + Credentials("Sonatype Nexus Repository Manager", "repository.mulesoft.org", user, password) + ) }) } else { @@ -50,18 +50,23 @@ object Common { val ivyCredentials = Path.userHome / ".ivy2" / ".credentials" val mavenCredentials = Path.userHome / ".m2" / "settings.xml" - val servers = Map(("mule-ee-releases", "repository-master.mulesoft.org"), - ("mule-ee-customer-releases", "repository.mulesoft.org")) + val servers = Map( + ("mule-ee-releases", "repository-master.mulesoft.org"), + ("mule-ee-customer-releases", "repository.mulesoft.org") + ) def loadMavenCredentials(file: java.io.File): Seq[Credentials] = { xml.XML.loadFile(file) \ "servers" \ "server" flatMap (s => { val id = (s \ "id").text if (servers.contains(id)) { Some( - Credentials("Sonatype Nexus Repository Manager", - servers(id), - (s \ "username").text, - (s \ "password").text)) + Credentials( + "Sonatype Nexus Repository Manager", + servers(id), + (s \ "username").text, + (s \ "password").text + ) + ) } else { None } diff --git a/project/build.properties b/project/build.properties index 10fd9eee..e8a1e246 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.5.5 +sbt.version=1.9.7 diff --git a/project/plugins.sbt b/project/plugins.sbt index 1d1fd70c..0311f630 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,7 @@ -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.32") -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1") -addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0") -addSbtPlugin("com.github.mwz" % "sbt-sonar" % "2.1.0") -addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.10.0-RC1") -addSbtPlugin("com.eed3si9n" % "sbt-sriracha" % "0.1.0") \ No newline at end of file +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.17.0") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.2.2") +addSbtPlugin("com.sonar-scala" % "sbt-sonar" % "2.3.0") +addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.10.0-RC1") +addSbtPlugin("com.eed3si9n" % "sbt-sriracha" % "0.1.0") +addSbtPlugin("org.scala-js" % "sbt-jsdependencies" % "1.0.2")