Skip to main content

onto.URL

Definition

The onto.URL ontology type in Veezoo allows you to add hyperlinks to classes when displayed in tables. This makes the respective fields clickable, redirecting you to the URL when they are clicked.

Usage

Suppose you have a product catalog where each product has a corresponding URL to its page on your website. You can make the product name itself clickable in Veezoo, leading to its respective webpage:

kb {
class Product {
name.en: "Product"

from_table: product
sql: "${product.product_id}"
name_sql.en: "${product.product_name}"

extends: onto.Product

display_with: [
Product_Url
]

// We need a string attribute with the URL
string Product_Url {
name.en: "Product URL"

sql: "${product.url}"

extends: onto.URL
}
}
}

In this example, the Product class has a Product_Url string attribute that extends onto.URL, meaning its values are interpreted as URLs. By defining Product_Url in display_with, the product name in Veezoo will appear as a clickable hyperlink that leads to the corresponding product page on your website. The URL itself does not appear as a separate column.

Sometimes you may not have the full URL in the database, but you can derive it from an id. In this case, use sql to generate the right URL.

string Product_Url {
name.en: "Product URL"

// We concatenate a base URL with an ID argument to generate the URL
sql: "'https://example.com/catalog?product_id=' || ${product.id}"

extends: onto.URL
}

Usage

To use onto.URL, you need to define a string attribute in your class that extends onto.URL and use it in display_with. This attribute's values will then be interpreted as URLs and displayed as clickable hyperlinks in Veezoo.

Limitations

The URL must be valid and should start with http://, https:// or mailto: to work correctly. If the URL is not valid or improperly formatted, the hyperlink functionality may not work as expected.