GeoPubby  Version 0.1.0.0
FilteredDataSource Class Referenceabstract

A DataSource that wraps another data source in such a way that the resulting data source is only capable of describing a subset of the IRI space. More...

Inheritance diagram for FilteredDataSource:
Collaboration diagram for FilteredDataSource:

Public Member Functions

 FilteredDataSource (DataSource wrapped)
 
abstract boolean canDescribe (String absoluteIRI)
 Determines whether a given IRI is considered to be described in the wrapped data source or not. More...
 
Model describeResource (String iri)
 Returns a subgraph of the data source describing one resource. More...
 
Map< Property, Integer > getHighIndegreeProperties (String resourceIRI)
 If describeResource(String) omits properties of high indegree, then those properties must be returned here with the count of arcs. More...
 
Map< Property, Integer > getHighOutdegreeProperties (String resourceIRI)
 If describeResource(String) omits properties of high outdegree, then those properties must be returned here with the count of arcs. More...
 
Model listPropertyValues (String resourceIRI, Property property, boolean isInverse)
 Returns a subgraph of the data source. More...
 
List< Resource > getIndex ()
 A list of IRI resources described in this data source. More...
 
AutocompleteEngine< SearchRecordgetLabelIndex ()
 
Model describeResource (String absoluteIRI, String language)
 Returns a subgraph of the data source describing one resource. More...
 

Static Public Attributes

static final int MAX_INDEX_SIZE = 1000000
 

Private Attributes

final DataSource wrapped
 

Detailed Description

A DataSource that wraps another data source in such a way that the resulting data source is only capable of describing a subset of the IRI space.

This is usually done for performance, to prevent the underlying data source from attempting to describe resources that we know it doesn't have anything of value about.

Constructor & Destructor Documentation

◆ FilteredDataSource()

25  {
26  this.wrapped = wrapped;
27  }
final DataSource wrapped
Definition: FilteredDataSource.java:23

References FilteredDataSource.wrapped.

Member Function Documentation

◆ canDescribe()

abstract boolean canDescribe ( String  absoluteIRI)
abstract

Determines whether a given IRI is considered to be described in the wrapped data source or not.

Parameters
absoluteIRIAny syntactically valid IRI
Returns
true if that IRI is described in the data source

Implements DataSource.

Referenced by FilteredDataSource.describeResource(), FilteredDataSource.getHighIndegreeProperties(), FilteredDataSource.getHighOutdegreeProperties(), FilteredDataSource.getIndex(), and FilteredDataSource.listPropertyValues().

◆ describeResource() [1/2]

Model describeResource ( String  absoluteIRI,
String  language 
)
inherited

Returns a subgraph of the data source describing one resource.

This should include both incoming and outgoing triples. However, it should exclude outgoing arcs where the property is a high-outdegree property, and it should exclude incoming arcs where the property is a high-indegree property. If labels for other resources are included in the result, then they will be used.

Parameters
absoluteIRIThe IRI of the resource to be described
Returns
A subgraph of the data source describing the resource.

Implemented in MergeDataSource, IndexDataSource, RewrittenDataSource, RemoteSPARQLDataSource, and ModelDataSource.

◆ describeResource() [2/2]

Model describeResource ( String  absoluteIRI)

Returns a subgraph of the data source describing one resource.

This should include both incoming and outgoing triples. However, it should exclude outgoing arcs where the property is a high-outdegree property, and it should exclude incoming arcs where the property is a high-indegree property. If labels for other resources are included in the result, then they will be used.

Parameters
absoluteIRIThe IRI of the resource to be described
Returns
A subgraph of the data source describing the resource.

Implements DataSource.

39  {
40  if (!canDescribe(iri)) return ModelUtil.EMPTY_MODEL;
41  return wrapped.describeResource(iri);
42  }
Model describeResource(String absoluteIRI)
Returns a subgraph of the data source describing one resource.
abstract boolean canDescribe(String absoluteIRI)
Determines whether a given IRI is considered to be described in the wrapped data source or not.

References FilteredDataSource.canDescribe(), DataSource.describeResource(), ModelUtil.EMPTY_MODEL, and FilteredDataSource.wrapped.

◆ getHighIndegreeProperties()

Map<Property, Integer> getHighIndegreeProperties ( String  resourceIRI)

If describeResource(String) omits properties of high indegree, then those properties must be returned here with the count of arcs.

If high-indegree properties are not omitted, or the resource doesn't have any, then an empty map or null may be returned. Entries with value 0 will be ignored.

Parameters
resourceIRIThe IRI of the resource to be described
Returns
A map containing high-indegree properties with number of arcs for the resource

Implements DataSource.

45  {
46  if (!canDescribe(resourceIRI)) return null;
47  return wrapped.getHighIndegreeProperties(resourceIRI);
48  }
Map< Property, Integer > getHighIndegreeProperties(String resourceIRI)
If describeResource(String) omits properties of high indegree, then those properties must be returned...

References FilteredDataSource.canDescribe(), DataSource.getHighIndegreeProperties(), and FilteredDataSource.wrapped.

◆ getHighOutdegreeProperties()

Map<Property, Integer> getHighOutdegreeProperties ( String  resourceIRI)

If describeResource(String) omits properties of high outdegree, then those properties must be returned here with the count of arcs.

If high-outdegree properties are not omitted, or the resource doesn't have any, then an empty map or null may be returned. Entries with value 0 will be ignored.

Parameters
resourceIRIThe IRI of the resource to be described
Returns
A map containing high-outdegree properties with number of arcs for the resource

Implements DataSource.

51  {
52  if (!canDescribe(resourceIRI)) return null;
53  return wrapped.getHighOutdegreeProperties(resourceIRI);
54  }
Map< Property, Integer > getHighOutdegreeProperties(String resourceIRI)
If describeResource(String) omits properties of high outdegree, then those properties must be returne...

References FilteredDataSource.canDescribe(), DataSource.getHighOutdegreeProperties(), and FilteredDataSource.wrapped.

◆ getIndex()

List<Resource> getIndex ( )

A list of IRI resources described in this data source.

Ordering is implementation-defined. Usually a reasonable limit should be applied to the number of resources returned.

Implements DataSource.

64  {
65  List<Resource> result = new ArrayList<Resource>();
66  for (Resource r: wrapped.getIndex()) {
67  if (canDescribe(r.getURI())) {
68  result.add(r);
69  }
70  }
71  return result;
72  }
List< Resource > getIndex()
A list of IRI resources described in this data source.

References FilteredDataSource.canDescribe(), DataSource.getIndex(), and FilteredDataSource.wrapped.

◆ getLabelIndex()

AutocompleteEngine<SearchRecord> getLabelIndex ( )

Implements DataSource.

75  {
76  return wrapped.getLabelIndex();
77  }
de.fuberlin.wiwiss.pubby.util.AutocompleteEngine< SearchRecord > getLabelIndex()

References DataSource.getLabelIndex(), and FilteredDataSource.wrapped.

◆ listPropertyValues()

Model listPropertyValues ( String  resourceIRI,
Property  property,
boolean  isInverse 
)

Returns a subgraph of the data source.

It lists the values of a particular property of a particular resource. Where values are blank nodes, a complete description of these anonymous resources must be included.

Parameters
resourceIRIThe resource to be examined
propertyThe property we're interested in
isInverseAre we interested in outgoing arcs (false) or incoming (true)?
Returns
A subgraph of the data source.

Implements DataSource.

58  {
59  if (!canDescribe(resourceIRI)) return ModelUtil.EMPTY_MODEL;
60  return wrapped.listPropertyValues(resourceIRI, property, isInverse);
61  }
Model listPropertyValues(String resourceIRI, Property property, boolean isInverse)
Returns a subgraph of the data source.

References FilteredDataSource.canDescribe(), ModelUtil.EMPTY_MODEL, DataSource.listPropertyValues(), and FilteredDataSource.wrapped.

Member Data Documentation

◆ MAX_INDEX_SIZE

◆ wrapped