Using composite primary key

27 views
Skip to first unread message

Monica Rocha

unread,
Oct 22, 2023, 9:06:02 PM10/22/23
to ontop4obda
Hello !!!

Does anyone know how to map a table with a composite key using ontop?

In Ontop, to map a table to the ontology structure, can you provide the code for the following scenario:
:ERP/dbo.TPRODUTO{IDPRD} a :Product_Service ; :NomeProdutoServiço {NOMEFANTASIA} ; :CodigoProdutoServiço {CODIGOREDUZIDO}.
Using SQL as the data source with
SELECT * FROM [ERP].[dbo].[TPRODUTO].
In this case, IDPRD is the primary key for the TPRODUTO table.

How would the code look if the primary key were composite, consisting of both IDPRD and IDSEQ fields?  

Tks !

Benjamin Cogrel

unread,
Jan 5, 2024, 9:31:40 AM1/5/24
to Monica Rocha, ontop4obda
Hi Monica,

Sorry for the very late reply.

You can a composite IRI template as follows:

:myTemplate/{IDPRD}/{IDSEQ} a :Something .

As a good practice, please consider inserting a slash between the two parameters of the template. It helps optimize the SQL queries better.

Best,
Benjamin



--
Please follow our guidelines on how to report a bug https://ontop-vkg.org/community/contributing/bug-report
---
You received this message because you are subscribed to the Google Groups "ontop4obda" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ontop4obda+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ontop4obda/f19cb305-7c75-40ca-8671-396d22751223n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages