Skip to content

Commit

Permalink
add skos:prefLabel and schema:name properties to terms
Browse files Browse the repository at this point in the history
  • Loading branch information
guenthermi committed Sep 28, 2015
1 parent 97390ea commit a3f6e4c
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -447,6 +447,10 @@ void writeDocumentTerms(Resource subject, TermedDocument document)
if (hasTask(RdfSerializer.TASK_LABELS)) {
writeTermTriples(subject, RdfWriter.RDFS_LABEL, document
.getLabels().values());
writeTermTriples(subject, RdfWriter.SKOS_PREF_LABEL, document
.getLabels().values());
writeTermTriples(subject, RdfWriter.SCHEMA_NAME, document.getLabels().values());

}
if (hasTask(RdfSerializer.TASK_DESCRIPTIONS)) {
writeTermTriples(subject, RdfWriter.SCHEMA_DESCRIPTION, document
Expand Down
8 changes: 6 additions & 2 deletions wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/RdfWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -89,8 +89,12 @@ public class RdfWriter {
.createURI(Vocabulary.XSD_STRING);
public static final URI SKOS_ALT_LABEL = factory
.createURI(Vocabulary.SKOS_ALT_LABEL);
public static final URI SKOS_PREF_LABEL = factory
.createURI(Vocabulary.SKOS_PREF_LABEL);
public static final URI SCHEMA_ABOUT = factory
.createURI(Vocabulary.SCHEMA_ABOUT);
public static final URI SCHEMA_NAME = factory
.createURI(Vocabulary.SCHEMA_NAME);
public static final URI SCHEMA_DESCRIPTION = factory
.createURI(Vocabulary.SCHEMA_DESCRIPTION);
public static final URI SCHEMA_IN_LANGUAGE = factory
Expand Down
20 changes: 18 additions & 2 deletions wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/Vocabulary.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -118,6 +118,14 @@ public class Vocabulary {
VOCABULARY_TYPES.put(SKOS_ALT_LABEL, OWL_DATATYPE_PROPERTY);
}

/**
* Property "prefLabel" of SKOS.
*/
public static final String SKOS_PREF_LABEL = PREFIX_SKOS + "prefLabel";
static {
VOCABULARY_TYPES.put(SKOS_PREF_LABEL, OWL_DATATYPE_PROPERTY);
}

/**
* Property "about" of schema.org.
*/
Expand All @@ -126,6 +134,14 @@ public class Vocabulary {
VOCABULARY_TYPES.put(SCHEMA_ABOUT, OWL_OBJECT_PROPERTY);
}

/**
* Property "name" of schema.org.
*/
public static final String SCHEMA_NAME = PREFIX_SCHEMA + "name";
static {
VOCABULARY_TYPES.put(SCHEMA_NAME, OWL_OBJECT_PROPERTY);
}

/**
* Property "description" of schema.org.
*/
Expand Down
4 changes: 4 additions & 0 deletions wdtk-rdf/src/test/resources/BasicDeclarations.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

<http://www.w3.org/2004/02/skos/core#altLabel> a <http://www.w3.org/2002/07/owl#DatatypeProperty> .

<http://www.w3.org/2004/02/skos/core#prefLabel> a <http://www.w3.org/2002/07/owl#DatatypeProperty> .

<http://www.wikidata.org/ontology#globe> a <http://www.w3.org/2002/07/owl#ObjectProperty> .

<http://www.wikidata.org/ontology#preferredCalendar> a <http://www.w3.org/2002/07/owl#ObjectProperty> .
Expand All @@ -45,6 +47,8 @@

<http://schema.org/about> a <http://www.w3.org/2002/07/owl#ObjectProperty> .

<http://schema.org/name> a <http://www.w3.org/2002/07/owl#ObjectProperty> .

<http://www.wikidata.org/ontology#Item> a <http://www.w3.org/2002/07/owl#Class> .

<http://www.wikidata.org/ontology#Property> a <http://www.w3.org/2002/07/owl#Class> .
Expand Down
2 changes: 2 additions & 0 deletions wdtk-rdf/src/test/resources/ItemDocument.rdf
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

<http://www.wikidata.org/Q10> a <http://www.wikidata.org/ontology#Item> ;
<http://www.w3.org/2000/01/rdf-schema#label> "bar"@lc2 , "foo"@lc ;
<http://schema.org/name> "bar"@lc2 , "foo"@lc ;
<http://www.w3.org/2004/02/skos/core#prefLabel> "bar"@lc2 , "foo"@lc ;
<http://schema.org/description> "it's bar"@lc2 , "it's foo"@lc ;
<http://www.w3.org/2004/02/skos/core#altLabel> "foo"@lc , "bar"@lc ;
<http://www.wikidata.org/P10s> <http://www.wikidata.org/Q10Snone> ;
Expand Down
6 changes: 6 additions & 0 deletions wdtk-rdf/src/test/resources/completeRDFDocument.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ wo:latitude a owl:DatatypeProperty .

schema:about a owl:ObjectProperty .

schema:name a owl:ObjectProperty .

wo:longitude a owl:DatatypeProperty .

wo:QuantityValue a owl:Class .
Expand All @@ -58,6 +60,8 @@ schema:description a owl:DatatypeProperty .

skos:altLabel a owl:DatatypeProperty .

skos:prefLabel a owl:DatatypeProperty .

wo:globe a owl:ObjectProperty .

wo:Reference a owl:Class .
Expand All @@ -74,6 +78,8 @@ wo:Property a owl:Class .

<http://www.wikidata.org/Q10> a wo:Item ;
rdfs:label "bar"@lc2 , "foo"@lc ;
skos:prefLabel "bar"@lc2 , "foo"@lc ;
schema:name "bar"@lc2 , "foo"@lc ;
schema:description "it's bar"@lc2 , "it's foo"@lc ;
skos:altLabel "foo"@lc , "bar"@lc ;
<http://www.wikidata.org/P10s> <http://www.wikidata.org/Q10Snone> ;
Expand Down

0 comments on commit a3f6e4c

Please sign in to comment.