Comments (4)
@arenas-guerrero-julian Thank you so much for your great response and pointing us in the right direction. Really appreciate it :)
We fixed prefixes and replaced properties as you suggested and that helped us in resolving the issue. We will keep in mind to use YARRML as you advised. Regarding use of SELECT query for lowercasing, it completely makes sense. We actually were experimenting with UDFs and thought of starting with very basic operation like transforming text to lowercase as we have our data all in uppercase. But our ultimate goal is to implement much complex functionality in the Python-based UDFs for pre-processing our enterprise data before converting it into KG :)
Thank you once again and have a great start for the week!
from morph-kgc.
Hi @IshanDindorkar,
The UDFs should work with any data source. Do you get any specific error?
Regarding your sencond question, the reason for which there is no UDF example in that location is that it only contains the R2RML test cases which do not include UDFs.
from morph-kgc.
Thank you very much for your prompt response.
I am not getting an error as such. But the function does not get executed on the column of database table. For e.g. I am trying to fetch two columns in table A - col 1 & col 2. With the help of UDF I am trying to convert values of col 2 as lower case. When I save the KG, I do not see value of col2 converted to lower case. For this I am using a mapping file like shown below
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix rml: <http://semweb.mmlab.be/ns/rml#> .
@prefix ql: <http://semweb.mmlab.be/ns/ql#> .
@prefix ex: <http://example.com/> .
@prefix grel: <http://users.ugent.be/~bjdmeest/function/grel.ttl#> .
@base <http://example.com/base/> .
<#TM1>
rml:logicalSource [
rml:query "SELECT col1, col2 FROM A WHERE ROWNUM < 10" ;
] ;
rr:subjectMap [
rr:template "http://example.com/{col1}" ;
rr:class ex:col1 ;
] ;
rr:predicateObjectMap [
rr:predicate ex:col1;
rr:objectMap [
rr:column "col1" ;
] ;
] ;
rr:predicateObjectMap [
rr:predicate ex:col2 ;
rr:objectMap [
rr:column "col2" ;
rr:functionExecution <#Execution> ;
] ;
] .
<#Execution>
rml:function ex:toLowerCase ;
rml:input [
rml:parameter grel:valueParam ;
rml:inputValueMap [
rml:reference "col2" ;
]
] .
The UDF looks like this
@udf(
fun_id='http://example.com/toLowerCase',
text='http://users.ugent.be/~bjdmeest/function/grel.ttl#valueParam')
def to_lower_case(text):
return text.lower()
Could you please advise what I am missing here and help me in fixing the issue.
Thank you very much for your support. Appreciate it.
from morph-kgc.
I think that the problem is that you are mixing R2RML and RML. For instance, you seem to be using RML but you employ rr:column
, which is R2RML. The correct property is rml:reference
. Similarly with RML-FNML, you are using rr:functionExecution
but the correct property is rml:functionExecution
.
Also, use the latest prefixes in the mapping:
@prefix rml: <http://w3id.org/rml/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix fno: <https://w3id.org/function/ontology#> .
@prefix morph-kgc: <https://github.com/morph-kgc/morph-kgc/function/built-in.ttl#> .
@prefix grel: <http://users.ugent.be/~bjdmeest/function/grel.ttl#> .
@prefix idlab-fn: <http://example.com/idlab/function/> .
Some additional advice:
- Instead of the turtle-based syntax of RML, I recommend you to use the YARRRML syntax, which is supported out-of-the-box in Morph-KGC. It is easier and it will also avoid you the aforementioned issue with prefixes.
- Given that you are using Oracle, for simple data transformation functions you may use RML views. For instance, for lowercase you can do
SELECT col1, LOWER(col2) AS col2 FROM A WHERE ROWNUM < 10
.
from morph-kgc.
Related Issues (20)
- Missing triples in output (mapping file with self-join) HOT 1
- rdf-star generation failed HOT 5
- JSON Files Format HOT 1
- Question: Why is using RML file slower than YARRRML HOT 1
- Maintain documentation in a separate repository HOT 1
- Update duckdb dependency to latest stable version (v.0.10.0)
- Mandatory dependency sqlalchemy HOT 3
- ENH: Specify relational database through YARRRML data source HOT 1
- NULL value not ignored for Parquet file format HOT 4
- Output to Kafka topic doesn't seem to work HOT 4
- AttributeError: 'DataFrame' object has no attribute 'map' in version 2.7.0 HOT 2
- Problem Input Database HOT 1
- Applying rml:reference to each RML-F result HOT 2
- YARRRML conditions on objects are not correctly processed HOT 3
- YARRRML external references HOT 1
- Issue with use of functions in YARRRML configuration HOT 2
- Two logical sources with rr:sqlQuery for the same table HOT 2
- Use of YARRRML with a Pandas dataframe as source HOT 5
- Impala connector HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from morph-kgc.