Search code examples
phpsemantic-web

insert into data as RDF in ARC2


I'm working on a semantic web application with php and ARC2. I couldn't find any good tutorial with practical examples.What I want to do is save some articles as RDF document in database with ARC and then run SPARQL on them. I've read the ARC documentation but I can not find good and practical examples, specially for insert.Could any one help me???


Solution

  • This is a sample from my master's project:

    if($variableName){
    
    prefix PREFIX: <http://yourprefix.owl#>
    INSERT INTO <http://localhost/yourontologyfilename.owl>{
     <http://yourprefix.owl#some-identifier> rdf:Type PREFIX:Category;
             PREFIX:Title $variableName; 
    }
    

    It worked fine for me, this should do the trick! Of course you have to add sanity and security checks :-)

    In my case, protege' you'd run the query this way:

    prefix SEMKNOW: <http://sk.owl#>
    INSERT INTO <http://localhost/SEMKNOW.owl>{
     <http://sk.owl#C-21> rdf:Type SEMKNOW:ConferencePapers;
             SEMKNOW:Title "A semantic knowledge management system for scholarly repositories"; 
    }
    

    You should read the sparql 1.1 and 1.0 official docs and use protege to test your queries, it definitely speeds up your dev process. Also check out here the site in general is more specific to your line, so checking it out wouldn't hurt.