Channel #semsol: Logs

This is a public chat log generated from the #semsol IRC channel.

07:35:28 tonysan: anyone here?
08:40:21 tonysan: anyone here?
08:42:50 bengee: tonysan, you're asking the wrong question ;) just describe your problem and someone will pick it up as soon as time permits
08:43:08 tonysan: ok thanks
08:43:51 tonysan: the tags in my predicates are ns0, ns1... so on
08:44:21 tonysan: how do I change it? I am using toRDFXML()
08:45:24 bengee: you can define custom namespace prefixes in the configuration array
08:45:31 bengee: there is an example in http://arc.semsol.org/docs/v2/serializing
08:45:44 bengee: $ns = array(
08:45:46 bengee: 'foaf' => 'http://xmlns.com/foaf/0.1/',
08:45:48 bengee: 'dc' => 'http://purl.org/dc/elements/1.1/'
08:45:50 bengee: );
08:45:51 bengee: $conf = array('ns' => $ns);
08:46:36 tonysan: $config = array( /* db */ 'db_host' => 'localhost', /* default: localhost */ 'db_name' => 'arc', 'db_user' => 'arc', 'db_pwd' => 'arc', /* store */ 'store_name' => 'arc_test', /* parsers */ 'bnode_prefix' => 'bn', /* sem html extraction */ 'sem_html_formats' => 'rdfa microformats',
08:46:49 tonysan: put it in here?
08:46:53 bengee: yep
08:47:26 tonysan: but how do I assign the predicates to the namespaces?
08:48:28 bengee: not sure I understand..
08:48:59 bengee: the serializer will replace your ns0/ns1 with the predefined prefixes if available
08:50:18 tonysan: <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
08:50:20 tonysan: xmlns:ns0="http://localhost/arc/">
08:50:21 tonysan: <rdf:Description rdf:about="http://localhost/arc/#BOB">
08:50:23 tonysan: <ns0:eats>Pizza</ns0:eats>
08:50:25 tonysan: </rdf:Description>
08:51:30 bengee: $config['ns'] = array('my_prefix' => 'http://localhost/arc/')
08:51:55 bengee: will then generate <my_prefix:eats>...
08:53:43 bengee: if you need a different namespace URI, then you have to use a different predicate URI in the source document/data
08:54:27 tonysan: oh I got it!
08:54:32 bengee: the serializer just uses the URIs it got as input
08:54:41 tonysan: awesome!
08:55:25 tonysan: I have another question, I am stuck with my SPARQL
08:55:39 tonysan: I have 2 triples
08:56:11 tonysan: BOB eats pizza, BOB eats cake
08:56:42 tonysan: what is the SPARQL if I only want to select pizza?
08:58:41 bengee: SELECT ?food WHERE { ?someone ex:eats ?food . FILTER(?food = "pizza") }
09:00:36 bengee: all pizza-eaters: SELECT ?who WHERE { ?who ex:eats "pizza"}
09:01:16 bengee: (you have to replace ex:eats with the URI/qname of your "eats" predicate)
09:01:25 tonysan: isn't the ?who ?food be ?s ?p ?o...?
09:02:05 bengee: you have free choice with regard to variable names
09:03:00 tonysan: I have questions about ex:eats
09:03:18 tonysan: I don't have other entries about eats...
09:04:35 tonysan: what URI do I need to put? <http://localhost/arc/> ?
09:05:42 bengee: if you didn't specify a namespace in your source data, then probably yes
09:06:23 bengee: i.e. SELECT ?who ?what WHERE { ?who <http://localhost/arc/eats> ?what }
09:09:19 tonysan: I got it.
09:10:16 tonysan: SPARQL is complex, but pretty easy to understand if used right...
09:10:31 bengee: yeah, true
09:11:00 tonysan: During INSERTs, my URI will automatically be my current directory
09:11:16 bengee: unless you provide a full URI
09:11:53 tonysan: If the URI is not the Storepoint, just for referencing?
09:12:22 bengee: you can do INSERT INTO <graph> { <http://bobshome.com/bob> <http://myvocab.org/eats> "pizza"}
09:12:24 tonysan: Will that be a problem?
09:13:01 tonysan: thanks :)
09:13:40 bengee: it makes sense to use URIs that you can later access via the Web
09:14:40 bengee: e.g. <http://myserver.com/mysite/data/bob>
09:15:15 bengee: then you could have a script or modrewrite script that server RDF at that location
09:15:25 bengee: s/server/serves/
09:15:58 tonysan: I might prefer letting arc serve the RDFs
09:16:42 tonysan: so my URIs will be URI/arc?....some GET variables
09:17:54 tonysan: thanks for your generous help, really.
09:18:25 bengee: you're welcome
09:18:54 bengee: unfortunately, there isn't much "getting started with RDF" material out there
09:22:00 tonysan: Add the user contributions under each section?
09:22:17 tonysan: like php.net (I learn php myself on php.net)
09:22:19 bengee: yeah, that would be a nice addition
09:22:43 tonysan: and users around the world will help to enrich :)
09:33:02 tonysan: if the values are numeric, can I replace = in the FILTER with > < ?
09:33:21 bengee: yes
09:33:58 bengee: < and > work for non-numerics, too (alphanumeric sort)
09:34:07 tonysan: is INSERT numeric values different from insert a literal ?
09:34:18 tonysan: or they are the same?
09:35:11 bengee: I think the processor will generate a datatype, e.g. 10 may end up as integer, i.e. a "typed literal"
09:35:39 tonysan: the numbers are +00008000.0000 in the db
09:35:50 tonysan: I insert 8000
09:36:01 bengee: that's just an internal representation
09:36:05 tonysan: oh
09:36:27 tonysan: I get it
09:38:16 tonysan: Is non-latin character supported in the s,p,o ?
09:38:33 bengee: yes
09:39:26 bengee: (depending on your mysql server)
09:42:40 tonysan: there is <ns0:>literal</ns0:>
09:42:53 tonysan: can I supress these output?
09:43:28 tonysan: /s/supress/suppress
09:43:30 bengee: this looks like broken data
09:44:09 bengee: sorry, gotta continue with other stuff here
09:44:16 tonysan: <ns0:>1948</ns0:>
09:44:18 tonysan: <ns0:>literal</ns0:>
09:44:21 tonysan: <ns0: rdf:resource="http://localhost/wct_3/#台北-左營871"/>
09:44:23 tonysan: <ns0:>uri</ns0:>
09:44:36 tonysan: there is some UTF-8 stuff in line 3
09:47:28 tonysan: I want to suppress the output of <ns0:>literal</ns0:>, <ns0:>uri</ns0:>
09:48:40 bengee: they shouldn't appear at all, something is broken with your input data
09:48:45 tonysan: oh
09:50:28 tonysan: the resource provided is not match with the ex:
09:50:41 tonysan: That might be the problem, thanks
11:43:07 tonysan: I still get the error...
11:45:00 tonysan: the problem is the variable
11:45:19 tonysan: How can I disable the variables in SELECT ?
12:09:42 bengee: if you pass the query result to a serializer, you have to use ?s ?p ?o as variable names, otherwise, you can use or omit any variable
12:41:27 tonysan: how do I pass store query results to a serializer (and convert to rdf/xml)
12:46:30 bengee: $triples = $store->query('SELECT ?s ?p ?o WHERE { ?s ?p ?o }', 'rows');
12:46:47 bengee: $rdfxml = $serializer->toRDFXML($triples);
12:50:32 tonysan: the $serializer cannot be initiated
12:51:29 tonysan: oh
12:51:38 tonysan: I got it...
13:03:14 tonysan: how to add more filters to different ?p
13:08:47 tonysan: ok I tried it out
13:09:08 ^Jenny^_: SELECT ?s ?p ?o WHERE { ?s ?p ?o . ?s ?p1 ?o } . FILTER ( ?p1 >0 ) . FILTER ( ?p < 0 ) etc. ;)
13:09:26 ^Jenny^_: hope this got what you wanted
14:51:25 kwijibo: bengee: is it possible to get sparql json from the RemoteEndpoint object?
14:54:57 bengee: hmm..
14:55:43 bengee: I'm knee-deep in other stuff right now, not sure..
14:57:08 bengee: but I think the response is auto-parsed into php structures
14:59:07 bengee: and the application/sparql-results+xml request header will be auto-set