Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URI as a constant value #142

Open
oschihin opened this issue May 11, 2022 · 8 comments
Open

URI as a constant value #142

oschihin opened this issue May 11, 2022 · 8 comments

Comments

@oschihin
Copy link

oschihin commented May 11, 2022

If the property value is a constant, but a URI, not a literal, can I use the prefixes defined in vocabularies.xrm?

My point illustrated. I have a mapping:

map level_fonds from MVK_OGD.VE_FONDS {
	subject template rrURI with ID_NR;

	types
		rico.RecordSet

	properties
		rico.isOrWasIncludedIn template rrURI with PARENT_ID_NR;
		rico.hasRecordSetType constant "https://ld.staatsarchiv.bs.ch/vocabularies/RecordSetTypes#Fonds";
}

The URI used as constant value is defined like this:

prefix "stabs-rst" "https://ld.staatsarchiv.bs.ch/vocabularies/recordSetTypes#"`

I want to use the prefix.
Is there a way or another idea?

@BenjaminHofstetter
Copy link

For me that looks very related to #141. You need it for "constant" and #141 in templates. But it's basically the same idea behind it.

@oschihin
Copy link
Author

@BenjaminHofstetter Yes, it is related, but not the same. I declare URI templates outside the mappings, in a dedicated templates file. But templates ask for a value, typically from a referenced field or column. So I cannot do what I want to do with a template. My property value is a constant URI.

@mchlrch
Copy link
Member

mchlrch commented May 11, 2022

can I use the prefixes defined in vocabularies.xrm?

No, the IRI value of the prefix itself cannot be used as constant.

But with XRM version 1.2.0 comes support for using a class, property or datatype from a vocabulary as a constant value.

Because stabslevels.Fonds is declared as a class, this should work for the case you described.

properties
    ...
    rico.hasRecordSetType constant stabslevels.Fonds;

XRM version 1.2.0 is not officially released yet, but there is a preview build. I can give you the installation instructions, in case you are interested in using the preview build. What are you using: Eclipse of vscode?

Another workaround is to use a template with fake (unused) parameter and ignore the warnings that are shown:

template const_RecordSetTypes_Fonds "https://ld.staatsarchiv.bs.ch/vocabularies/RecordSetTypes#Fonds"
....
properties
    ...
    rico.hasRecordSetType template const_RecordSetTypes_Fonds with ID_NR;  // ID_NR is a fake template parameter

@oschihin
Copy link
Author

@mchlrch Version 1.2.0 sounds promising. I'd rather do that than ignore the warnings. I am using vscode, so could test the preview (or wait a bit).

@mchlrch

This comment was marked as outdated.

@oschihin
Copy link
Author

@mchlrch Thanks for the extension preview. Will test it, but have only Java 8 at the moment.

@oschihin
Copy link
Author

oschihin commented Aug 23, 2023

@mchlrch a little bit later ... I am on XRM version 1.3, and your example above should work. It doesn't, because using that class declaration does not update declarations in the mapping file:

I do (in mapping.xrm):

map level_archive from stabs_ogd.rr_archive {
  subject template rrURI with ID_NR;

  types
    rico.RecordSet

  properties
    rico.history from ARCHIVGESCHICHTE with language-tag ger; // @todo: use rico.Event class later
    rico.hasRecordSetType constant stabslevels.Archiv;
}

stabslevels.Archiv is declared as a class in vocabs.xrm. In the newly generated mapping.carml.ttl, the prefix stabs-rstis not declared. Carml throws the error:

error: Undefined prefix "stabs-rst:" on line 131

If I use it in types, and not as a constant, the declaration is done.

@mchlrch
Copy link
Member

mchlrch commented Aug 28, 2023

@mchlrch a little bit later ... I am on XRM version 1.3, and your example above should work. It doesn't, because using that class declaration does not update declarations in the mapping file:

I do (in mapping.xrm):

map level_archive from stabs_ogd.rr_archive {
  subject template rrURI with ID_NR;

  types
    rico.RecordSet

  properties
    rico.history from ARCHIVGESCHICHTE with language-tag ger; // @todo: use rico.Event class later
    rico.hasRecordSetType constant stabslevels.Archiv;
}

stabslevels.Archiv is declared as a class in vocabs.xrm. In the newly generated mapping.carml.ttl, the prefix stabs-rstis not declared. Carml throws the error:

error: Undefined prefix "stabs-rst:" on line 131

If I use it in types, and not as a constant, the declaration is done.

@oschihin That sounds like a bug. Thanks for reporting it

@mchlrch mchlrch transferred this issue from zazuko/expressive-rdf-mapper Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants