使用SPARQL查找2个节点之间的所有关系

时间:2016-09-18 17:34:42

标签: sparql

我想编写一个SPARQL查询,它使用DBPedia返回荷兰和阿姆斯特丹之间的所有关系,但不知道"阿姆斯特丹"可能是首都而不知道"荷兰"实际上是一个国家。我只是想以任何可能的方式知道他们是如何联系的。

1 个答案:

答案 0 :(得分:0)

试试这个:

        #include <vector>
        #include <exception>
        #include <iostream>

        using namespace std;

       template<class T>
       class Matrix
       {
       private:

        unsigned int _rows;
        unsigned int _cols;
        vector <vector<T>> _matrix;

    public:

        const unsigned int INITIAL_ROW_SIZE = 1;
        const unsigned int INITIAL_COL_SIZE = 1;

        Matrix () : _rows(INITIAL_COL_SIZE), _cols(INITIAL_COL_SIZE),
                    _matrix(1,vector<T>(1))   {
            cout << "ctor" << endl;
        }

        Matrix (unsigned int rows, unsigned int cols) : _rows(rows), _cols(cols),_matrix(_rows,vector<T>(_cols)      { 
        }

  Matrix (const Matrix<T> &other) :Matrix(other._rows, other._cols)
    {
        for(int i = 0; i < _rows; i++)
        {
            copy(other._matrix[i].begin(), other._matrix[i].end(), _matrix[i]);
        }
        };
    }

on Wikidata Query Service