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

Possibility to treat the returned value of a custom function as IRI and not as string #48

Open
FabianCretton opened this issue Oct 2, 2024 · 0 comments

Comments

@FabianCretton
Copy link

FabianCretton commented Oct 2, 2024

Hi,
Thank you for that nice tool.

I am trying out the custom function feature as described in the README.
My current problem is that even if the function returns a url, as:

    functions: {
            'http://example.com/grel.ttl#getSexUrl': function (data) {
			if (data[0] == 1) {
				return `http://publications.europa.eu/resource/authority/human-sex/MALE`;
			} else {
				return `http://publications.europa.eu/resource/authority/human-sex/FEMALE`;
			}
                }
            },

But the generated RDF is:
<http://example.com/9791234567890> <http://data.europa.eu/m8g/sex> "http://publications.europa.eu/resource/authority/human-sex/FEMALE" .

What I want is a URL (and not a string) as object, for instance:
<http://example.com/9791234567890> <http://data.europa.eu/m8g/sex> <http://publications.europa.eu/resource/authority/human-sex/FEMALE> .

I am using the mapping as proposed in the README,

<#FunctionMap>
	fnml:functionValue [
		rml:logicalSource <#LOGICALSOURCE> ;
		rr:predicateObjectMap [
			rr:predicate fno:executes ;
			rr:objectMap [ 
				rr:constant grel:getSexUrl;
                                rr:termType rr:IRI
				]
		 ] ;
		rr:predicateObjectMap [
			rr:predicate grel:inputString ;
			rr:objectMap [ rml:reference "sex" ]
		 ];
	 ] .

I did also add a rr:termType rr:IR in the rr:objectMap (see here above), but same result.

I am no RML expert, and tried out quite a few things with no good result (even worse with the "help" of chatGPT)
Thank you for any pointer.
Fabian

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

1 participant