SemanticSearchImplementation
Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SemanticSearchImplementation.RdfClient Class Reference

Provides all necessary queries to the RDF database to create a mapping of metadata graphs into a document. More...

Public Types

enum  ApplicationProfileType {
  ApplicationProfileType.CLASS, ApplicationProfileType.INTEGER, ApplicationProfileType.DATE, ApplicationProfileType.STRING,
  ApplicationProfileType.BOOLEAN
}
 Represents the data types used in the application profiles. More...
 

Public Member Functions

 RdfClient (IRdfConnector client, string language)
 
string GetLanguage ()
 
string GetApplicationProfileOfMetadata (string graphName)
 Returns the corresponding application profile of a metadata graph. More...
 
void MarkGraphAsDeleted (string graphName)
 Marks the metadata graph as deleted. More...
 
IEnumerable< string > GetDirectClasses (string instance)
 Queries the direct classes (without inference and hierarchy) of an instance. More...
 
IList< string > GetParentClasses (IEnumerable< string > classes)
 Queries the parent classes of the given classes. More...
 
IEnumerable< string > GetProperties ()
 Queries all properties (metadata fields) used in the available application profiles. More...
 
IEnumerable< IEnumerable< string > > GetAllMetadataIds ()
 Queries the IDs of all available metadata graphs in the knowledge graph. More...
 
string GetRdfsLabel (string uri)
 Queries the rdfs:label of an URI. More...
 
IEnumerable< string > GetProjectsOfUser (string user)
 Queries the project IDs a user belongs to. More...
 
IEnumerable< string > GetApplicationProfilesNamesOfProperty (string property)
 Queries the sh:names of a property in all available application profiles. More...
 
ApplicationProfileType GetTypeOfProperty (string property)
 Queries the application profile data type of a property. More...
 
ApplicationProfileType GetDataType (string type)
 Maps the XSD data types to the corresponding application profile type. More...
 
int GetCurrentIndexVersion ()
 Queries the current index version. More...
 
void SetCurrentIndexVersion (int newVersion)
 Updates the current index version. More...
 
Dictionary< string, LiteralRuleConstructLiteralRules (string graphName)
 Queries all literal rules of a specific named graph. More...
 
IEnumerable< AdditionalRuleConstructAdditionalRules (string graphName)
 QUeries all additional rules of a specific named graph. More...
 
string GuessLabel (string element)
 Help function to guess label based on the URI. More...
 
IEnumerable< Triple > GetTriplesFromGraph (string graphName)
 Returns triples of a graph. More...
 
IDictionary< string, JObject > CreateFieldsFromAdditionalRule (string graphName, SpecificApplicationProfile profile, ElasticsearchIndexMapper indexMapper, bool changeOtherDocs=false)
 Creates additional key value pairs for a metadata graph resulting through execution of the additional rules. More...
 
JObject CreateFields (IEnumerable< Triple > triples, SpecificApplicationProfile profile, ElasticsearchIndexMapper indexMapper)
 Creates key value pairs from the given triples. More...
 

Static Public Attributes

const string LABEL_LITERAL_RULE = "instance"
 
const string LABEL_ADDITIONAL_RULE = "graph"
 

Private Member Functions

IDictionary< string, string > GetPrefixesOfGraph (string graphName, string prefixName)
 Queries all prefix definitions in a specific graph and of a specific prefix rule. More...
 

Private Attributes

readonly IRdfConnector _connector
 
readonly DataTypeParser _dataTypeParser
 
readonly string _language
 
readonly SparqlParameterizedString _queryString
 

Static Private Attributes

const int QUERY_LIMIT = 1000
 
const string PLACEHOLDER = "$this"
 

Detailed Description

Provides all necessary queries to the RDF database to create a mapping of metadata graphs into a document.

Member Enumeration Documentation

◆ ApplicationProfileType

Represents the data types used in the application profiles.

Enumerator
CLASS 
INTEGER 
DATE 
STRING 
BOOLEAN 

Constructor & Destructor Documentation

◆ RdfClient()

SemanticSearchImplementation.RdfClient.RdfClient ( IRdfConnector  client,
string  language 
)
inline

Member Function Documentation

◆ ConstructAdditionalRules()

IEnumerable<AdditionalRule> SemanticSearchImplementation.RdfClient.ConstructAdditionalRules ( string  graphName)
inline

QUeries all additional rules of a specific named graph.

Parameters
graphNameName of the graph.
Returns
An enumerator of additional rules.

◆ ConstructLiteralRules()

Dictionary<string, LiteralRule> SemanticSearchImplementation.RdfClient.ConstructLiteralRules ( string  graphName)
inline

Queries all literal rules of a specific named graph.

Parameters
graphNameName of the graph.
Returns
A dictionary containing the classes (key) and corresponding literal rules (value) of the graph.

◆ CreateFields()

JObject SemanticSearchImplementation.RdfClient.CreateFields ( IEnumerable< Triple >  triples,
SpecificApplicationProfile  profile,
ElasticsearchIndexMapper  indexMapper 
)
inline

Creates key value pairs from the given triples.

Parameters
triplesAn enumerator of triples which needs to be parsed.
profileThe application profile which the triples belong to.
indexMapperThe ElasticsearchIndexMapper.
Returns

◆ CreateFieldsFromAdditionalRule()

IDictionary<string, JObject> SemanticSearchImplementation.RdfClient.CreateFieldsFromAdditionalRule ( string  graphName,
SpecificApplicationProfile  profile,
ElasticsearchIndexMapper  indexMapper,
bool  changeOtherDocs = false 
)
inline

Creates additional key value pairs for a metadata graph resulting through execution of the additional rules.

Additional rules can influcence other existing metadata graphs.

Parameters
graphNameID of metadata graph.
profileApplication profile of metadata graph.
indexMapperThe ElasticsearchIndexMapper.
changeOtherDocsFlag which indicates if fields for influcenced documents should be created.
Returns
An dictionary containing the IDs of the metadata graphs (key) and the corresponding JSON objects (value).

◆ GetAllMetadataIds()

IEnumerable<IEnumerable<string> > SemanticSearchImplementation.RdfClient.GetAllMetadataIds ( )
inline

Queries the IDs of all available metadata graphs in the knowledge graph.

Returns
An iterator of an enumerator of the IDs of the metadata graphs.

◆ GetApplicationProfileOfMetadata()

string SemanticSearchImplementation.RdfClient.GetApplicationProfileOfMetadata ( string  graphName)
inline

Returns the corresponding application profile of a metadata graph.

Parameters
graphNameID of the metadata graph.
Returns
String representation of the application profile URI.

◆ GetApplicationProfilesNamesOfProperty()

IEnumerable<string> SemanticSearchImplementation.RdfClient.GetApplicationProfilesNamesOfProperty ( string  property)
inline

Queries the sh:names of a property in all available application profiles.

Parameters
propertyA string representation of a property URI.
Returns
An enumerator of names.

◆ GetCurrentIndexVersion()

int SemanticSearchImplementation.RdfClient.GetCurrentIndexVersion ( )
inline

Queries the current index version.

Returns
Number of the current index version.

◆ GetDataType()

ApplicationProfileType SemanticSearchImplementation.RdfClient.GetDataType ( string  type)
inline

Maps the XSD data types to the corresponding application profile type.

Parameters
typeXSD data type.
Returns
An application profile type.

◆ GetDirectClasses()

IEnumerable<string> SemanticSearchImplementation.RdfClient.GetDirectClasses ( string  instance)
inline

Queries the direct classes (without inference and hierarchy) of an instance.

Parameters
instanceString representation of an instance URI.
Returns

◆ GetLanguage()

string SemanticSearchImplementation.RdfClient.GetLanguage ( )

◆ GetParentClasses()

IList<string> SemanticSearchImplementation.RdfClient.GetParentClasses ( IEnumerable< string >  classes)
inline

Queries the parent classes of the given classes.

Parameters
classesA list of classes (string representation of the URIs).
Returns
A list of the parent classes.

◆ GetPrefixesOfGraph()

IDictionary<string, string> SemanticSearchImplementation.RdfClient.GetPrefixesOfGraph ( string  graphName,
string  prefixName 
)
inlineprivate

Queries all prefix definitions in a specific graph and of a specific prefix rule.

Parameters
graphNameName of the graph.
prefixNameName of the prefix rule.
Returns
A dictionary containing the prefixes (keys) and namespaces (value) of a prefix rule.

◆ GetProjectsOfUser()

IEnumerable<string> SemanticSearchImplementation.RdfClient.GetProjectsOfUser ( string  user)
inline

Queries the project IDs a user belongs to.

Parameters
userA user.
Returns
An enumerator of project IDs.

◆ GetProperties()

IEnumerable<string> SemanticSearchImplementation.RdfClient.GetProperties ( )
inline

Queries all properties (metadata fields) used in the available application profiles.

Returns
An enumerator of the properties (string representation of the URI).

◆ GetRdfsLabel()

string SemanticSearchImplementation.RdfClient.GetRdfsLabel ( string  uri)
inline

Queries the rdfs:label of an URI.

Parameters
uriA string representation of an URI.
Returns

◆ GetTriplesFromGraph()

IEnumerable<Triple> SemanticSearchImplementation.RdfClient.GetTriplesFromGraph ( string  graphName)
inline

Returns triples of a graph.

Parameters
graphNameID of the graph.
Returns
An enumerator of triples.

◆ GetTypeOfProperty()

ApplicationProfileType SemanticSearchImplementation.RdfClient.GetTypeOfProperty ( string  property)
inline

Queries the application profile data type of a property.

Properties that have different data types (due to different profiles) are first defined as a class that maps to text.

Parameters
propertyString representatrion og a properties URI.
Returns

◆ GuessLabel()

string SemanticSearchImplementation.RdfClient.GuessLabel ( string  element)
inline

Help function to guess label based on the URI.

Parameters
elementString representation of an URI.
Returns
Guessed label.

◆ MarkGraphAsDeleted()

void SemanticSearchImplementation.RdfClient.MarkGraphAsDeleted ( string  graphName)
inline

Marks the metadata graph as deleted.

Parameters
graphNameID of the metadata graph.

◆ SetCurrentIndexVersion()

void SemanticSearchImplementation.RdfClient.SetCurrentIndexVersion ( int  newVersion)
inline

Updates the current index version.

Parameters
newVersionNew index version.

Member Data Documentation

◆ _connector

readonly IRdfConnector SemanticSearchImplementation.RdfClient._connector
private

◆ _dataTypeParser

readonly DataTypeParser SemanticSearchImplementation.RdfClient._dataTypeParser
private

◆ _language

readonly string SemanticSearchImplementation.RdfClient._language
private

◆ _queryString

readonly SparqlParameterizedString SemanticSearchImplementation.RdfClient._queryString
private

◆ LABEL_ADDITIONAL_RULE

const string SemanticSearchImplementation.RdfClient.LABEL_ADDITIONAL_RULE = "graph"
static

◆ LABEL_LITERAL_RULE

const string SemanticSearchImplementation.RdfClient.LABEL_LITERAL_RULE = "instance"
static

◆ PLACEHOLDER

const string SemanticSearchImplementation.RdfClient.PLACEHOLDER = "$this"
staticprivate

◆ QUERY_LIMIT

const int SemanticSearchImplementation.RdfClient.QUERY_LIMIT = 1000
staticprivate

The documentation for this class was generated from the following file: