/// <summary> /// Builds and returns a set of queries to find relations between two object1 and object2. /// </summary> /// <param name="object1">object1</param> /// <param name="object2">object2</param> /// <param name="maxDistance">MaxiumDistance between the two objects</param> /// <param name="limit">Limit of results</param> /// <param name="ignoredObjects">List of strings of names of objects be ignored in the Queries</param> /// <param name="ignoredProperties">List of strings of names of properties to be ignored in the Queries</param> /// <param name="avoidCycles">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</param> /// <returns>false means an error happened, true means it's ok</returns> public bool generateQueries(string object1, string object2, int maxDistance=5, int limit=50, List<string> ignoredObjects = null, List<string> ignoredProperties = null, int avoidCycles = 1) { //here we reset everything because this method is only used upon new comparison //resetting the bool isEndOfResults = false; //resetting the list of queries generatedQueriesList = new List<SPARQLQueryBuilder.InnerQuery>(); //resetting the resultlist curResultSet2 = new List<string>(); //to make other methods see the two objects obj1 = object1; obj2 = object2; SPARQLQueryBuilder builder = new SPARQLQueryBuilder(); //hardcoded objects to ignore (For testing purposes) ignoredObjects = new List<string>(); ignoredObjects.Add("http://dbpedia.org/ontology/wikiPageWikiLink"); ignoredObjects.Add("http://dbpedia.org/ontology/wikiPageRedirects"); ignoredObjects.Add("http://www.w3.org/2002/07/owl#Thing"); ignoredObjects.Add("http://www.opengis.net/gml/_Feature"); generatedQueriesList = builder.buildQueries(object1, object2, maxDistance, limit, ignoredObjects, ignoredObjects, avoidCycles); //generatedQueriesList=builder.buildQueries(object1, object2, maxDistance, limit, ignoredObjects, ignoredProperties, avoidCycles); //if an error happened if (generatedQueriesList.Count < 1) return false; return true; }
/// <summary> /// Builds and returns a set of queries to find relations between two object1 and object2. /// </summary> /// <param name="object1">object1</param> /// <param name="object2">object2</param> /// <param name="maxDistance">MaxiumDistance between the two objects</param> /// <param name="limit">Limit of results</param> /// <param name="ignoredObjects">List of strings of names of objects be ignored in the Queries</param> /// <param name="ignoredProperties">List of strings of names of properties to be ignored in the Queries</param> /// <param name="avoidCycles">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</param> /// <returns>false means an error happened, true means it's ok</returns> public bool generateQueries(string object1, string object2, int maxDistance=7, int limit=5, List<string> ignoredObjects = null, List<string> ignoredProperties = null, int avoidCycles = 0) { //resetting the bool isEndOfResults = false; //to make other methods see the two objects obj1 = object1; obj2 = object2; SPARQLQueryBuilder builder = new SPARQLQueryBuilder(); generatedQueriesList=builder.buildQueries(object1, object2, maxDistance, limit, ignoredObjects, ignoredProperties, avoidCycles); //if an error happened if (generatedQueriesList.Count < 1) return false; return true; }