/// <summary> /// /// </summary> /// <param name="strComunidade"></param> /// <param name="LearningObject"></param> /// <returns></returns> public static LearningObjectContextModel GetLearningObjectWithComunidade(String strComunidade, String LearningObjectID) { LearningObjectContextModel modelToReturn = new LearningObjectContextModel(); StardogConnector dog = new StardogConnector("http://*****:*****@"PREFIX onto: <http://www.owl-ontologies.com/OntoAdapt2.owl#> SELECT * WHERE { "); strb.AppendFormat(" onto:{0} onto:LOLink ?t", LearningObjectID); //strb.AppendFormat(" onto:{0} onto:hasLOMediaType ?Media.", LearningObjectID); //strb.AppendFormat(" onto:{0} onto:LearningObjectFormat ?ObjFormat", LearningObjectID); strb.Append(".}"); SparqlResultSet resultsNoReasoning = dog.Query(strb.ToString()) as SparqlResultSet; List<SparqlResult> lista = resultsNoReasoning.ToList(); List<String> toReturn = new List<string>(); foreach (SparqlResult rlt in lista) { //modelToReturn.LOLink = RemoveURLFromOntoloryResults(rlt[0].ToString()); } return modelToReturn; }
/// <summary> /// /// </summary> /// <param name="g"></param> /// <param name="LO"></param> public void insertLearningObject(ref Graph g, LearningObjectContextModel LO) { g.NamespaceMap.AddNamespace("onto", new Uri("http://www.owl-ontologies.com/OntoAdapt2.owl#")); IUriNode sujeito = g.CreateUriNode("onto:" + LO.LearningObject_ID); INode rdfType = g.CreateUriNode("rdf:type"); INode objeto = g.CreateUriNode("onto:LearningObject"); Triple triple = new Triple(sujeito, rdfType, objeto); g.Assert(triple); }
/// <summary> /// Insere LO a comunidade /// </summary> /// <param name="g"></param> /// <param name="LO"></param> public void insertLearningObjectComunidade(ref Graph g, LearningObjectContextModel LO) { g = new Graph(); g.NamespaceMap.AddNamespace("onto", new Uri("http://www.owl-ontologies.com/OntoAdapt2.owl#")); IUriNode sujeito = g.CreateUriNode("onto:" + LO.LearningObject_ID); INode rdfType = g.CreateUriNode("onto:LO_MoodleCommunity"); ILiteralNode objeto = g.CreateLiteralNode(LO.MoodleCommunity); Triple triple = new Triple(sujeito, rdfType, objeto); g.Assert(triple); }
private List<LearningObjectContextModel> LearningObjectsList(List<SparqlResult> lista) { List<LearningObjectContextModel> toReturn = new List<LearningObjectContextModel>(); foreach (SparqlResult rlt in lista) { StardogConnector dog = new StardogConnector("http://*****:*****@"PREFIX onto: <http://www.owl-ontologies.com/OntoAdapt2.owl#> "); strb.Append(@"SELECT ?x ?Idiom ?F { "); // tipo de conexão strb.Append(" OPTIONAL {"); strb.AppendFormat("onto:{0} onto:LOLink ?x ", RemoveURLFromOntoloryResults(rlt[0].ToString())); strb.Append(".}"); strb.Append(" OPTIONAL {"); strb.AppendFormat("onto:{0} onto:LO_Idiom ?Idiom ", RemoveURLFromOntoloryResults(rlt[0].ToString())); strb.Append(".}"); strb.Append(" OPTIONAL {"); strb.AppendFormat("onto:{0} onto:LearningObjectFormat ?F", RemoveURLFromOntoloryResults(rlt[0].ToString())); strb.Append(".}"); strb.Append(".}"); SparqlResultSet resultsNoReasoning = dog.Query(strb.ToString()) as SparqlResultSet; List<SparqlResult> listaObjs = resultsNoReasoning.ToList(); foreach (SparqlResult rltLO in listaObjs) { LearningObjectContextModel lo = new LearningObjectContextModel(); //lo.LOLink = rltLO[0].ToString(); toReturn.Add(lo); } } return toReturn; }
/// <summary> /// Insere um objeto de aprendizagem /// </summary> public void insertLO() { LearningObjectContextModel LO = new LearningObjectContextModel(); LO.LearningObject_ID = "LO_123"; //LO.LearningObjectFormat = "wmv"; dog.Begin(); Graph g = null; OntoLearningObject learningObject = new OntoLearningObject(); learningObject.insertLearningObject(ref g, LO); dog.SaveGraph(g); learningObject.insertLearningObjectFormat(ref g, LO); dog.SaveGraph(g); dog.Commit(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button4_Click(object sender, EventArgs e) { LearningObjectContextModel ctx = new LearningObjectContextModel(); OntoLearningObject obj = new OntoLearningObject(); ctx.LearningObject_ID = txtID.Text; ctx.MediaFormat = txtMediaFormat.Text; ctx.MediaType = cmbMediaType.SelectedItem.ToString(); ctx.Title = txtTitle.Text; ctx.MoodleCommunity = TxtLOComunidade.Text; ctx.Link = txtLink.Text; ctx.ObjectLearningStyle = cmbLearningStyle.SelectedItem.ToString(); ctx.Description = txtDescription.Text; ctx.Idiom = cmbIdiom.SelectedItem.ToString(); ctx.Size = txtSize.Text; ctx.KeywordsList = txtkeyword.Text; var json = new JavaScriptSerializer().Serialize(ctx); Console.WriteLine(json); //WebServiceSoapClient.Service1 webSevice = new WebServiceSoapClient.Service1(); //webSevice.SaveLearningObjectinOntology(json); this.Cursor = Cursors.WaitCursor; ServiceReference3.Service1SoapClient soa = new Service1SoapClient(); soa.SaveLearningObjectinOntology(json); this.Cursor = Cursors.Default; }