public class PropertyRegister extends Object
Modifier and Type | Field and Description |
---|---|
protected Map<String,String> |
datatypes
Map that stores the datatype of properties.
|
protected Map<String,String> |
uriPatterns
Map that stores the URI patterns of properties.
|
Constructor and Description |
---|
PropertyRegister(String uriPatternPropertyId,
ApiConnection apiConnection,
String siteUri)
Constructs a new property register.
|
Modifier and Type | Method and Description |
---|---|
protected void |
fetchPropertyInformation(PropertyIdValue property)
Fetches the information of the given property from the Web API.
|
void |
fetchUsingSPARQL(URI endpoint)
Fetches type information for all known properties from the given SPARQL endpoint, and adds it to the register.
|
String |
getPropertyType(PropertyIdValue propertyIdValue)
Returns the IRI of the primitive type of an
PropertyIdValue . |
String |
getPropertyUriPattern(PropertyIdValue propertyIdValue)
Returns the URI Pattern of a
PropertyIdValue that should be used
to create URIs of external resources from statement values for the
property. |
String |
getUriPrefix()
Returns the URI prefix that is used on the site considered by this
object.
|
static PropertyRegister |
getWikidataPropertyRegister()
Returns a singleton object that serves as a property register for
Wikidata.
|
void |
setPropertyType(PropertyIdValue propertyIdValue,
String datatypeIri)
Sets datatypeIri an IRI of the primitive type of an Property for
PropertyIdValue . |
String |
setPropertyTypeFromEntityIdValue(PropertyIdValue propertyIdValue,
EntityIdValue value)
Returns the IRI of the primitive Type of an Property for
EntityIdValue objects. |
String |
setPropertyTypeFromGlobeCoordinatesValue(PropertyIdValue propertyIdValue,
GlobeCoordinatesValue value)
Returns the IRI of the primitive Type of an Property for
GlobeCoordinatesValue objects. |
String |
setPropertyTypeFromMonolingualTextValue(PropertyIdValue propertyIdValue,
MonolingualTextValue value)
Returns the IRI of the primitive Type of an Property for
MonolingualTextValue objects. |
String |
setPropertyTypeFromQuantityValue(PropertyIdValue propertyIdValue,
QuantityValue value)
Returns the IRI of the primitive Type of an Property for
QuantityValue objects. |
String |
setPropertyTypeFromStringValue(PropertyIdValue propertyIdValue,
StringValue value)
Returns the IRI of the primitive Type of an Property for
StringValue objects. |
String |
setPropertyTypeFromTimeValue(PropertyIdValue propertyIdValue,
TimeValue value)
Returns the IRI of the primitive Type of an Property for
TimeValue objects. |
protected final Map<String,String> datatypes
public PropertyRegister(String uriPatternPropertyId, ApiConnection apiConnection, String siteUri)
uriPatternPropertyId
- property id used for a URI Pattern property, e.g., P1921 on
Wikidata; can be null if no such property should be usedapiConnection
- API connection object that defines how to connect to the
online APIsiteUri
- the URI identifying the site that is accessed (usually the
prefix of entity URIs), e.g.,
"http://www.wikidata.org/entity/"public static PropertyRegister getWikidataPropertyRegister()
public String getUriPrefix()
public String getPropertyType(PropertyIdValue propertyIdValue)
PropertyIdValue
.propertyIdValue
- property whose datatype should be fetchedpublic void setPropertyType(PropertyIdValue propertyIdValue, String datatypeIri)
PropertyIdValue
.propertyIdValue
- datatypeIri
- public String getPropertyUriPattern(PropertyIdValue propertyIdValue)
PropertyIdValue
that should be used
to create URIs of external resources from statement values for the
property.propertyIdValue
- property to fetch URI pattern forpublic String setPropertyTypeFromEntityIdValue(PropertyIdValue propertyIdValue, EntityIdValue value)
EntityIdValue
objects.
TODO: this really ought to be exposed by the wdtk-datamodel
module and reused here. The same heuristic is implemented in EntityIdValueImpl
.propertyIdValue
- value
- public String setPropertyTypeFromGlobeCoordinatesValue(PropertyIdValue propertyIdValue, GlobeCoordinatesValue value)
GlobeCoordinatesValue
objects.propertyIdValue
- value
- public String setPropertyTypeFromQuantityValue(PropertyIdValue propertyIdValue, QuantityValue value)
QuantityValue
objects.propertyIdValue
- value
- public String setPropertyTypeFromStringValue(PropertyIdValue propertyIdValue, StringValue value)
StringValue
objects.propertyIdValue
- value
- public String setPropertyTypeFromTimeValue(PropertyIdValue propertyIdValue, TimeValue value)
TimeValue
objects.propertyIdValue
- value
- public String setPropertyTypeFromMonolingualTextValue(PropertyIdValue propertyIdValue, MonolingualTextValue value)
MonolingualTextValue
objects.propertyIdValue
- value
- protected void fetchPropertyInformation(PropertyIdValue property)
property
- public void fetchUsingSPARQL(URI endpoint)
endpoint
- URI of the SPARQL service to use, for example "https://query.wikidata.org/sparql"Copyright © 2014–2024 Wikidata Toolkit Developers. Generated from source code published under the Apache License 2.0. For more information, see the Wikidata Toolkit homepage