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

Use Prefixes in IRI Templates #141

Open
BenjaminHofstetter opened this issue Apr 14, 2022 · 3 comments
Open

Use Prefixes in IRI Templates #141

BenjaminHofstetter opened this issue Apr 14, 2022 · 3 comments

Comments

@BenjaminHofstetter
Copy link

It would be useful if we can use prefixes in IRI templates.

At the moment i do it like this.

subject template "https://data.mobi.ch/par/partner/{0}" with PARTNERNUMMER;

i can imagine something like this ... .. or something better

vocabulary pardata {
	prefix "pardata" "https://data.mobi.ch/par/"
}


map Partner from MobiDBSource {
   subject template "{0}{1}" with pardata PARTNERNUMMER;
  // or 
   subject template "{prefix}{1}" prefix pardata with PARTNERNUMMER;


Problem:
The IRI templates have a 'hard coded' prefix and i have to take care of it every time i uses it.
If i can use the prefix defined in vocabulary it's 'centralised', had IDE completion support and it can support refactoring.

@mchlrch
Copy link
Member

mchlrch commented Apr 20, 2022

Thank you for your feature request.

IRI templates can also be declared on the top-level, outside of a map. Doing so eliminates some (but not all) of the duplication and facilitates IRI template refactorings.

Here's an example:

template airportIri "http://airport.example.com/{0}"
template airlineIri "http://airline.example.com/{0}"

map AirportMapping from airport {
	subject template airportIri with id;

	properties
		wgs84_pos.lat from latitude;
		wgs84_pos.long from longitude;
}

map AirportOwnership from airportowners {
	subject template airportIri with id;

	properties
		ex.owner from ownership;
}

map AirlineAtAirport from airlineairport {
	subject template airlineIri with id;

	properties
		ex.airportServed template airportIri with airportId;
}

One can also consider using relative IRIs in the mapping and leaving resolution against a base IRI to the mapping processor (e.g. R2RML processor )

@ktk
Copy link
Member

ktk commented Apr 20, 2022

I use that a lot, in the previous release XRM did not autocomplete to those, I think you did explain me once why but I can't remember. What is the reason that autocomplete is not working on templates?

@mchlrch
Copy link
Member

mchlrch commented Apr 20, 2022

I use that a lot, in the previous release XRM did not autocomplete to those, I think you did explain me once why but I can't remember. What is the reason that autocomplete is not working on templates?

Yes that's correct. Up to now proposals for templates in code assist only included templates that were declared in the same file.

This changes with XRM version 1.2.0. Now all the templates from all files in the project are included in code assist proposals.

@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