59 lines
1.8 KiB
Python
59 lines
1.8 KiB
Python
# This file is part of the Glowtables software
|
|
# Copyright (C) 2023 Valentin Lorentz
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify it under the
|
|
# terms of the GNU Affero General Public License version 3, as published by the
|
|
# Free Software Foundation.
|
|
#
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Affero General Public License along with
|
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
"""Example table of all Wikidata cats"""
|
|
|
|
import rdflib
|
|
|
|
from glowtables.table import LabeledField, Language, Table
|
|
|
|
cats = Table(
|
|
id="cats",
|
|
display_names={Language("en"): "Cats"},
|
|
fields=[
|
|
LabeledField(
|
|
"name",
|
|
{Language("en"): "Name property (not label)"},
|
|
str,
|
|
rdflib.URIRef("http://www.wikidata.org/prop/direct/P2561"),
|
|
default="",
|
|
),
|
|
LabeledField(
|
|
"breed",
|
|
{Language("en"): "Breed"},
|
|
str,
|
|
rdflib.URIRef("http://www.wikidata.org/prop/direct/P4743"),
|
|
),
|
|
LabeledField(
|
|
"instanceof",
|
|
{Language("en"): "Instance of"},
|
|
str,
|
|
rdflib.URIRef("http://www.wikidata.org/prop/direct/P31"),
|
|
),
|
|
LabeledField(
|
|
"haircolor",
|
|
{Language("en"): "Hair color"},
|
|
str,
|
|
rdflib.URIRef("http://www.wikidata.org/prop/direct/P1884"),
|
|
default="",
|
|
),
|
|
],
|
|
constraints="""
|
|
?subject
|
|
<http://www.wikidata.org/prop/direct/P31>
|
|
<http://www.wikidata.org/entity/Q146>
|
|
.
|
|
""", # instance of cat
|
|
)
|