Пример #1
0
 public void QueryTest02()
 {
     string sparqlQ = "PREFIX mylo: <http://mylo.com/schema/> " +
                      "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> " +
                      "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " +
                      "PREFIX : <http://graph.facebook.com/schema/~/> " +
                      "SELECT  ?x ?y ?c  " +
                      "WHERE {" +
                      "      ?x rdf:type mylo:Address ." +
                      "      ?x mylo:HasAddressProps :y ." +
                      "      ?y :city ?c ." +
                      "}";
     try
     {
         BingMapsGPSlookup gps = new BingMapsGPSlookup();
         MyLoFacebookContextReader _fbContext = new MyLoFacebookContextReader(gps);
         _fbContext.InitializeContextFromFile();
         Debug.WriteLine(_fbContext.RunSPARQLQuery(sparqlQ));
     }
     catch (Exception ex)
     {
         Debug.WriteLine("QueryTest02 Error");
         Debug.WriteLine(ex.Message);
     }
 }
Пример #2
0
 private void btnRunQuery1_Click(object sender, EventArgs e)
 {
     if (this.query1result.Text != String.Empty)
     {
         MyLoFacebookContextReader _fbContext = new MyLoFacebookContextReader(_bingGpsLookup);
         _fbContext.InitializeContextFromFile();
         string results = _fbContext.RunSPARQLQuery(this.query1result.Text);
         this.queryOutBox.Text = results;
     }
 }
 public void AlignmentRun()
 {
     try
     {
         BingMapsGPSlookup gps = new BingMapsGPSlookup();
         MyLoFacebookContextReader _fbContext = new MyLoFacebookContextReader(gps);
         _fbContext.InitializeContextFromFile();
         _fbContext.MyLoFacebookAlignment01();
         _fbContext.MyLoSchemaReasoner();
         _fbContext.MyLoFacebookAlignment02();
         _fbContext.MyLoSchemaReasoner();
         _fbContext.SaveContextToFile();
     }
     catch (Exception ex)
     {
         Debug.WriteLine("AlignmentRun Error");
         Debug.WriteLine(ex.Message);
     }
 }
Пример #4
0
 public void QueryTest01()
 {
     string sparqlQ = "PREFIX mylo: <http://mylo.com/schema/> " +
                      "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> " +
                      "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " +
                      "SELECT DISTINCT ?activity ?time ?placename ?sourceId ?lat ?long ?state ?street ?city ?zip ?country " +
                      "WHERE {" +
                      "      ?activity rdf:type mylo:Activity ." +
                      "      ?activity rdf:type mylo:FacebookCheckin ." +
                      "      ?activity mylo:HasLocation ?loc ." +
                      "      ?activity mylo:HasSourceId ?sourceId ." +
                      "      ?loc mylo:HasLocationName ?placename ." +
                      "      ?loc mylo:HasGpsLatitude ?lat ." +
                      "      ?loc mylo:HasGpsLongitude ?long ." +
                      "      ?activity mylo:HasTimePeriod ?period ." +
                      "      ?period rdf:type mylo:Instant ." +
                      "      ?period mylo:HasTimeValue ?time ." +
                      "      OPTIONAL { ?loc mylo:HasAddress ?adr }" +
                      "      OPTIONAL { ?adr mylo:HasState ?state }" +
                      "      OPTIONAL { ?adr mylo:HasCity ?city }" +
                      "      OPTIONAL { ?adr mylo:HasZip ?zip }" +
                      "      OPTIONAL { ?adr mylo:HasCountry ?country }" +
                      "      OPTIONAL { ?adr mylo:HasStreet ?street }" +
                      "}";
     try
     {
         BingMapsGPSlookup gps = new BingMapsGPSlookup();
         MyLoFacebookContextReader _fbContext = new MyLoFacebookContextReader(gps);
         _fbContext.InitializeContextFromFile();
         Debug.WriteLine(_fbContext.RunSPARQLQuery(sparqlQ));
     }
     catch (Exception ex)
     {
         Debug.WriteLine("QueryTest01 Error");
         Debug.WriteLine(ex.Message);
     }
 }
        public void SimpleLoad01()
        {
            try
            {
                BingMapsGPSlookup gps = new BingMapsGPSlookup();
                MyLoFacebookContextReader _fbContext = new MyLoFacebookContextReader(gps);
                _fbContext.InitializeContextFromFile();

                _fbContext.MyLoFacebookAlignment02();
                _fbContext.MyLoSchemaReasoner();
                _fbContext.SaveContextToFile();

                // Not sure if this is a bug in the dotNetRDF library, but it seems to require a fresh store and read from file
                // to make the second inference rules work ... investigating ...
                MyLoFacebookContextReader _fbContext2 = new MyLoFacebookContextReader(gps);
                _fbContext2.InitializeContextFromFile();
                _fbContext2.SaveContextToDB("Keith");
            }
            catch (Exception ex)
            {
                Debug.WriteLine("SimpleLoad01 Error");
                Debug.WriteLine(ex.Message);
            }
        }
Пример #6
0
        private void btnSaveStore_Click(object sender, EventArgs e)
        {
            try
            {
                MyLoFacebookContextReader _fbContext = new MyLoFacebookContextReader(_bingGpsLookup);
                _fbContext.InitializeContextFromFile();

                _fbContext.MyLoFacebookAlignment02();
                _fbContext.MyLoSchemaReasoner();
                _fbContext.SaveContextToFile();

                // Not sure if this is a bug in the dotNetRDF library, but it seems to require a fresh store and read from file
                // to make the second inference rules work ... investigating ...
                MyLoFacebookContextReader _fbContext2 = new MyLoFacebookContextReader(_bingGpsLookup);
                _fbContext2.InitializeContextFromFile();
                _fbContext2.SaveContextToDB("Keith");
                this.queryOutBox.Text = "Context saved to database";
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Store Error");
                Debug.WriteLine(ex.Message);
            }
        }
Пример #7
0
 private void MyLOForm1_Load(object sender, EventArgs e)
 {
     try
     {
         _bingGpsLookup = new BingMapsGPSlookup();
         _fbContext = new MyLoFacebookContextReader(_bingGpsLookup);
     }
     catch (Exception ex)
     {
         Console.WriteLine("RDFTest Error");
         Console.WriteLine(ex.Message);
     }
 }