GeoPubby  Version 0.1.0.0
ResourceDescription.ResourceProperty Class Reference
Inheritance diagram for ResourceDescription.ResourceProperty:
Collaboration diagram for ResourceDescription.ResourceProperty:

Public Member Functions

 ResourceProperty (Property predicate, boolean isInverse, List< Value > simpleValues, List< ResourceDescription > complexVaues, int omittedValues, VocabularyStore vocabularyStore)
 
boolean isInverse ()
 
String getURI ()
 
String getBrowsableURL ()
 
boolean hasPrefix ()
 
String getPrefix ()
 
String getLocalName ()
 
String getLabel ()
 
String getLabel (boolean preferPlural)
 
String getInverseLabel ()
 
String getInverseLabel (boolean preferPlural)
 
String getCompleteLabel ()
 Note: This bypasses conf:showLabels, always assuming true More...
 
String getDescription ()
 
List< ValuegetSimpleValues ()
 
List< ResourceDescriptiongetComplexValues ()
 
boolean hasOnlySimpleValues ()
 
int getValueCount ()
 
boolean isMultiValued ()
 
String getValuesPageURL ()
 
int compareTo (ResourceProperty other)
 

Private Attributes

final Property predicate
 
final URIPrefixer predicatePrefixer
 
final boolean isInverse
 
final List< ValuesimpleValues
 
final List< ResourceDescriptioncomplexValues
 
final int omittedValues
 
final VocabularyStore vocabularyStore
 

Constructor & Destructor Documentation

◆ ResourceProperty()

ResourceProperty ( Property  predicate,
boolean  isInverse,
List< Value simpleValues,
List< ResourceDescription complexVaues,
int  omittedValues,
VocabularyStore  vocabularyStore 
)
472  {
473  this.predicate = predicate;
474  this.predicatePrefixer = new URIPrefixer(predicate, getPrefixes());
475  this.isInverse = isInverse;
476  this.simpleValues = simpleValues;
477  this.complexValues = complexVaues;
480  }
PrefixMapping getPrefixes()
Returns a prefix mapping containing all prefixes from the input model and from the configuration,...
Definition: ResourceDescription.java:419
final int omittedValues
Definition: ResourceDescription.java:468
final boolean isInverse
Definition: ResourceDescription.java:465
final List< ResourceDescription > complexValues
Definition: ResourceDescription.java:467
final URIPrefixer predicatePrefixer
Definition: ResourceDescription.java:464
final VocabularyStore vocabularyStore
Definition: ResourceDescription.java:469
final List< Value > simpleValues
Definition: ResourceDescription.java:466
final Property predicate
Definition: ResourceDescription.java:463

References ResourceDescription.getPrefixes(), ResourceDescription.ResourceProperty.isInverse, ResourceDescription.ResourceProperty.omittedValues, ResourceDescription.ResourceProperty.predicate, ResourceDescription.ResourceProperty.simpleValues, and ResourceDescription.ResourceProperty.vocabularyStore.

Referenced by ResourceDescription.ResourceProperty.compareTo().

Member Function Documentation

◆ compareTo()

int compareTo ( ResourceProperty  other)
573  {
574  if (!(other instanceof ResourceProperty)) {
575  return 0;
576  }
577  ResourceProperty otherProperty = (ResourceProperty) other;
578  int myWeight = config.getVocabularyStore().getWeight(
580  int otherWeight = config.getVocabularyStore().getWeight(
581  otherProperty.predicate, other.isInverse);
582  if (myWeight < otherWeight) return -1;
583  if (myWeight > otherWeight) return 1;
584  String propertyLocalName = getLocalName();
585  String otherLocalName = otherProperty.getLocalName();
586  if (propertyLocalName.compareTo(otherLocalName) != 0) {
587  return propertyLocalName.compareTo(otherLocalName);
588  }
589  if (this.isInverse() != otherProperty.isInverse()) {
590  return (this.isInverse()) ? 1 : -1;
591  }
592  return 0;
593  }
VocabularyStore getVocabularyStore()
Definition: Configuration.java:281
final Configuration config
Definition: ResourceDescription.java:55
ResourceProperty(Property predicate, boolean isInverse, List< Value > simpleValues, List< ResourceDescription > complexVaues, int omittedValues, VocabularyStore vocabularyStore)
Definition: ResourceDescription.java:470
String getLocalName()
Definition: ResourceDescription.java:499
int getWeight(Property property, boolean forInverse)
Returns the conf:weight of the property.
Definition: VocabularyStore.java:113

References ResourceDescription.config, ResourceDescription.ResourceProperty.getLocalName(), Configuration.getVocabularyStore(), VocabularyStore.getWeight(), ResourceDescription.ResourceProperty.isInverse, ResourceDescription.ResourceProperty.predicate, and ResourceDescription.ResourceProperty.ResourceProperty().

◆ getBrowsableURL()

String getBrowsableURL ( )
487  {
488  HypermediaControls controls = HypermediaControls.createFromIRI(
489  predicate.getURI(), config);
490  if (controls == null) return predicate.getURI();
491  return controls.getBrowsableURL();
492  }

References ResourceDescription.config, HypermediaControls.createFromIRI(), HypermediaControls.getBrowsableURL(), and ResourceDescription.ResourceProperty.predicate.

◆ getCompleteLabel()

String getCompleteLabel ( )

Note: This bypasses conf:showLabels, always assuming true

Returns
"Is Widget Of", "Widgets", "ex:widget", whatever is most appropriate
533  {
534  if (isInverse && getInverseLabel() != null) {
535  return getInverseLabel();
536  }
537  String result;
538  if (getLabel() != null) {
539  result = getLabel();
540  } else if (hasPrefix()) {
541  result = getPrefix() + ":" + getLocalName();
542  } else {
543  result = "?:" + getLocalName();
544  }
545  return isInverse ? "Is " + result + " of" : result;
546  }
String getInverseLabel()
Definition: ResourceDescription.java:521
String getPrefix()
Definition: ResourceDescription.java:496
String getLabel()
Definition: ResourceDescription.java:502
boolean hasPrefix()
Definition: ResourceDescription.java:493

References ResourceDescription.ResourceProperty.getInverseLabel(), ResourceDescription.ResourceProperty.getLabel(), ResourceDescription.ResourceProperty.getLocalName(), ResourceDescription.ResourceProperty.getPrefix(), ResourceDescription.ResourceProperty.hasPrefix(), and ResourceDescription.ResourceProperty.isInverse.

◆ getComplexValues()

List<ResourceDescription> getComplexValues ( )
553  {
554  return complexValues;
555  }

References ResourceDescription.ResourceProperty.complexValues.

◆ getDescription()

String getDescription ( )
547  {
548  return vocabularyStore.getDescription(predicate.getURI()).getLexicalForm();
549  }
Literal getDescription(String iri)
Definition: VocabularyStore.java:96

References VocabularyStore.getDescription(), ResourceDescription.ResourceProperty.predicate, and ResourceDescription.ResourceProperty.vocabularyStore.

◆ getInverseLabel() [1/2]

String getInverseLabel ( )

◆ getInverseLabel() [2/2]

String getInverseLabel ( boolean  preferPlural)
524  {
525  Literal label = vocabularyStore.getInverseLabel(predicate.getURI(), preferPlural);
526  if (label == null) return null;
527  return toTitleCase(label.getLexicalForm(), label.getLanguage());
528  }
String toTitleCase(String s, String lang)
Converts a string to Title Case.
Definition: ResourceDescription.java:762
Literal getInverseLabel(String iri, boolean preferPlural)
Definition: VocabularyStore.java:84

References VocabularyStore.getInverseLabel(), ResourceDescription.ResourceProperty.predicate, ResourceDescription.toTitleCase(), and ResourceDescription.ResourceProperty.vocabularyStore.

◆ getLabel() [1/2]

◆ getLabel() [2/2]

String getLabel ( boolean  preferPlural)
505  {
506  System.out.println("Getting label (plural)? "+predicate.getURI());
507  Literal label = vocabularyStore.getLabel(predicate.getURI(), preferPlural);
508  System.out.println("Found label: "+label);
509  if (label == null) {
510  StmtIterator iter=predicate.listProperties(RDFS.label);
511  if(iter.hasNext()) {
512  String labelprop=iter.next().getObject().asLiteral().getString();
513  System.out.println("Got Label for Prop: "+labelprop);
514  return labelprop;
515  }else {
516  return null;
517  }
518  }
519  return toTitleCase(label.getLexicalForm(), label.getLanguage());
520  }
Literal getLabel(String iri, boolean preferPlural)
Definition: VocabularyStore.java:57

References VocabularyStore.getLabel(), ResourceDescription.ResourceProperty.predicate, ResourceDescription.toTitleCase(), and ResourceDescription.ResourceProperty.vocabularyStore.

◆ getLocalName()

◆ getPrefix()

String getPrefix ( )

◆ getSimpleValues()

List<Value> getSimpleValues ( )
550  {
551  return simpleValues;
552  }

References ResourceDescription.ResourceProperty.simpleValues.

◆ getURI()

String getURI ( )
484  {
485  return predicate.getURI();
486  }

References ResourceDescription.ResourceProperty.predicate.

◆ getValueCount()

◆ getValuesPageURL()

String getValuesPageURL ( )
565  {
566  if (hypermediaResource == null) {
567  return null;
568  }
569  return isInverse
572  }
String getValuesPageURL(Property property)
Definition: HypermediaControls.java:137
String getInverseValuesPageURL(Property property)
Definition: HypermediaControls.java:141
final HypermediaControls hypermediaResource
Definition: ResourceDescription.java:52

References HypermediaControls.getInverseValuesPageURL(), HypermediaControls.getValuesPageURL(), ResourceDescription.hypermediaResource, ResourceDescription.ResourceProperty.isInverse, and ResourceDescription.ResourceProperty.predicate.

◆ hasOnlySimpleValues()

boolean hasOnlySimpleValues ( )

◆ hasPrefix()

boolean hasPrefix ( )

◆ isInverse()

boolean isInverse ( )
481  {
482  return isInverse;
483  }

References ResourceDescription.ResourceProperty.isInverse.

◆ isMultiValued()

Member Data Documentation

◆ complexValues

◆ isInverse

◆ omittedValues

◆ predicate

◆ predicatePrefixer

◆ simpleValues

◆ vocabularyStore