aldonline / fbrs Goto Github PK
View Code? Open in Web Editor NEWFacebook RDF Sync
Facebook RDF Sync
For some reason the Graph API may return blank IDs for some properties
For example:
"hometown": {
"id": "", <----- LIKE THIS ONE
"name": null
},
curl -H "Accept: text/turtle" -X GET "https://graph.facebook.com/555010177?access_token=AAAAAAITEghMBAEYd3iIfZCejGIA23hJeOMeQvvxBvkbMV9T0IxVCedWa1YCauWh90i6gmkcWmjnKQYLMZBatZC1JoPM7ZCBBfogkXXs9hAZDZD"
In Turtle, this results in the following triples
</555010177#> user:hometown </#> ;
And then:
</#> :id "" ; :name "" .
Therefore, it is safe to assume that all triples that contain the following
URI on any poisition are invalid:
<http://graph.facebook.com/#>
The following SPARQL query takes care of this issue
delete from <urn:divetouch:graph:facebook:friends>
{ ?s ?p ?o }
where
{ graph <urn:divetouch:graph:facebook:friends>
{ ?s ?p ?o .
filter ( ?s = <http://graph.facebook.com/#> || ?o = <http://graph.facebook.com/#> )
}
}
or, when you don't know the graph:
delete from ?g
{ ?s ?p ?o }
where
{ graph ?g
{ ?s ?p ?o .
filter ( ?s = <http://graph.facebook.com/#> || ?o = <http://graph.facebook.com/#> )
}
}
query IDs in bulk
Note that the memory usage will increase dramatically as we will receive several TTL documents in one response.
Idea: We could try to use a streaming json lib to parse the result
https://github.com/vibornoff/node-yajl
see if we can get more fields per ObjectDocument ( with the fields=... parameter )
having too many triples is rarely an issue for the size of subgraphs we are downloading.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.