C# Class mergedServices.SPARQLQueryBuilder

显示文件 Open project: sherifkandeel/weet-it_WCF Class Usage Examples

Public Methods

Method Description
SPARQLQueryBuilder ( ) : System

The constructor of the class, initiates the vars

buildQueries ( string object1, string object2, int maxDistance, int limit, List ignoredObjects = null, List ignoredProperties = null, int avoidCycles ) : List

Builds and returns a set of queries to find relations between two object1 and object2.

Private Methods

Method Description
completeQuery ( string coreQuery, Dictionary options, Dictionary vars ) : string

is thefunction that takes the Sparql Query from Direct and ConnectViamiddleObject functions and complete it it takes the part after where {.... , and completes it depending on the options

connectedViaAMiddleObject ( string first, string second, int dist1, int dist2, bool toObject, Dictionary options ) : string

Return a set of queries to find relations between two objects which are connected via a middle objects $dist1 and $dist2 give the distance between the first and second object to the middle they have ti be greater that 1

direct ( string object1, string object2, int distance, Dictionary options ) : string

Returns a query for getting a direct connection from $object1 to $object2.

expandTerms ( List terms, string ooperator = "&&" ) : string

puts bracket around the (filterterms) and concatenates them with &&

generateFilter ( Dictionary options, Dictionary vars ) : string

generates the necessary Filters

getQueries ( string object1, string object2, int distance, int limit, List ignoredObjects = null, List ignoredProperties = null, int avoidCycles ) : List>.Dictionary

Return a set of queries to find relations between two objects.

listToString ( List inputList ) : string

takes a list and converts it to a string(list must be of count 1)

stringToLoist ( string input ) : List

takes a string and converts it to a list of strings of count1

toPattern ( string s, string p, string o, bool toObject ) : string

this function puts the query terms subject, predicate, object

uri ( string x ) : string

takes the object name and returns the URI link to easily use in Sparql Query

Method Details

SPARQLQueryBuilder() public method

The constructor of the class, initiates the vars
public SPARQLQueryBuilder ( ) : System
return System

buildQueries() public method

Builds and returns a set of queries to find relations between two object1 and object2.
public buildQueries ( string object1, string object2, int maxDistance, int limit, List ignoredObjects = null, List ignoredProperties = null, int avoidCycles ) : List
object1 string object1
object2 string object2
maxDistance int MaxiumDistance between the two objects
limit int Limit of results
ignoredObjects List List of strings of names of objects be ignored in the Queries for example : http://dbpedia.org/resource/thing
ignoredProperties List List of strings of names of properties to be ignored in the Queries
avoidCycles int Integer value which indicates whether we want to suppress cycles , 0 = no cycle avoidance , 1 = no intermediate object can be object1 or object2 , 2 = like 1 + an object can not occur more than once in a connection
return List