Пример #1
0
        public void browseFunction(MyWpfRdfResultControl _RdfRes, String browse, bool isPopup)
        {
            if (browse == null)
            {
                return;
            }

            try
            {
                SparqlQueryParser sqp   = new SparqlQueryParser();
                string            query = null;
                int len = TypesComboBox.Text.Length;
                if (len != 0 && browse.Length != 0)
                {
                    query = "SELECT * WHERE { {<" + browse + "> <" + TypesComboBox.Text + "> ?object} UNION {?subject <" + TypesComboBox.Text + "> <" + browse + ">} } ORDER BY ?object";
                }
                else if (len == 0 && browse.Length != 0)
                {
                    query = "SELECT * WHERE { {?subject ?type <" + browse + ">} UNION {<" + browse + "> ?type ?object} } ORDER BY ?type";
                }
                else if (len != 0 && browse.Length == 0)
                {
                    query = "SELECT * WHERE {?subject <" + TypesComboBox.Text + "> ?object} ORDER BY ?subject ?object";
                }
                else if (len == 0 && browse.Length == 0)
                {
                    query = "SELECT * WHERE {?subject ?type ?object} ORDER BY ?subject ?type ?object LIMIT 20";
                }

                if (isPopup)
                {
                    query += " LIMIT " + POPUP_QUERY_LIMIT;
                }

                SparqlQuery     sparqlQuery = sqp.ParseFromString(query);
                SparqlResultSet results     = null;

                if (config.endpoint != null)
                {
                    results = config.endpoint.QueryWithResultSet(query);
                }
                else
                {
                    results = (SparqlResultSet)config.myGraph.ExecuteQuery(sparqlQuery);
                }

                _RdfRes.setResultSet(results);
                _RdfRes.Href_Click = Href_Click;
                _RdfRes._popUp     = popLink;

                if (config.types == BrowsingType.RdfBrowsing)
                {
                    _RdfRes.initForRdfTypeBrowing();
                }
                else      // BrowsingType.TriplesBrowsing
                {
                    _RdfRes.initForTripleBrowing();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "ERROR1", MessageBoxButton.OK, MessageBoxImage.Error);
                MessageBox.Show(ex.StackTrace, "ERROR1(StackTrace)", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #2
0
 // for runing and set an address of entity from outside of RdfBrowser class
 public void browseThisAddress(String address, MyWpfRdfResultControl _RdfRes, bool isPopup)
 {
     browseFunction(_RdfRes, address, isPopup);
 }