Click here to Skip to main content
11,484,402 members (66,007 online)
Click here to Skip to main content
Add your own
alternative version

Music and the Semantic Web

, 10 Aug 2006 CPOL 73.1K 2.9K 57
An article on the semantic Web and a simple music application
additional_files.zip
article_src.zip
webapplication
App_Data
Bin
SemWeb.dll
SemWeb.dll.refresh
foaf.rdf
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SemWeb;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //A place where the triples will be stored. 
        Store store = new MemoryStore();
        Store store2 = new MemoryStore();
     

        System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
        doc.Load("http://www.example.org/mp3/music.xml");
        store.Import(new RdfXmlReader(doc));

        System.Xml.XmlDocument doc3 = new System.Xml.XmlDocument();
        doc3.Load("http://itsp.science.anglia.ac.uk/portal/student/temp/tracks.xml");
        store.Import(new RdfXmlReader(doc3));


        //Define some representations (Entities)
        const string RDF = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
        const string GEN = "http://www.example.org/genre.xml";

        Entity rdftype = RDF + "type";
        Entity GENjazz = GEN + "#jazz";
        
        System.Xml.XmlDocument doc2 = new System.Xml.XmlDocument();
        doc2.Load("http://itsp.science.anglia.ac.uk/apum3/1.0/genre.xml");

        SemWeb.Inference.RDFS rdfs = new SemWeb.Inference.RDFS(new RdfXmlReader(doc2), store);
        rdfs.Select(new Statement(null, rdftype, GENjazz), store2);

        foreach (Statement s in store2.Select(new Statement(null, null, null)))
        {
            output1.Text += s.Subject.Uri + s.Predicate.Uri + s.Object.Uri + "\n";
        }
        output1.Text += "\n";

        foreach (Statement s in store.Select(new Statement(null, null, null)))
        {
            output2.Text += s.Subject.Uri + s.Predicate.Uri + s.Object.Uri + "\n";
        }
        output2.Text += "\n";
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

ChrisMitchell_
Web Developer
United Kingdom United Kingdom
Chris is a PhD research student working on machine learning in the area of music information systems. His current incarnation lecturers and researches at Anglia Ruskin University as part of the Audio music technology pathway. He has published in journals and has worked as a network consultant to finance his research. He entered the world of windows programming while writing a piece of software for music genre recognition. A passion for music technology has lead him to explore some of the fundamentals of audio programming.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150520.1 | Last Updated 10 Aug 2006
Article Copyright 2006 by ChrisMitchell_
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid