Mailing list ARC-DEV: Archives

Re: [arc-dev] How to create a rdf data

From: Patrick Murray-John 
Subject: Re: [arc-dev] How to create a rdf data
Date: Wed, 02 Sep 2009 11:41:57 -0400


Hi Aldo,

If you are comfortable with SPARQL, the quickest way to do that, at 
least for smallish amounts of data, is to do it as a SPARQL INSERT 
statement into the database, then serialize what you want to an RDF file 
to save.  Or, depending on what you are working with, write a PHP script 
that either writes the SPARQL, or one that creates one of ARC's data 
structures (I often end up writing scripts that produce ARC's Index 
structure), and serialize that.  Roughly, it ends up looking something like:

function generateTriple( $subject, $predicate, $object, $objectType, 
$lang, $datatype ) {
  // usually called by generateIndex with the data needed for creating a 
triple in
  // ARC's Index structure, which is an array

  return $array;
}
//


function generateIndex($inputData) {

// do what you have to do to convert the $inputData into
// an Index structure with many triples, returned from generateTriple
//
//
return $index;
}

$index = generateIndex($inputData);

$ser = ARC2::getRDFXMLSerializer();

/* Serialize a resource index */
$doc = $ser->getSerializedIndex($index);




Structures documentation is here: http://arc.semsol.org/docs/v2/structures
Serializing documentation is: http://arc.semsol.org/docs/v2/serializing

Hope this helps,
Patrick


Aldo Campi wrote:
> Dear all,
>     it seams that ARC is mainly used for reading RDF data. However, I'm 
> trying to create a .rdf file using ARC but the documentation copes only 
> with parser, store and query capabilities. Is it possible to have some 
> documentation about the creation of rdf data? I mean, how to create an 
> element, a propriety, etc...
>
> Thanks,
>
>
> Aldo.
>
>