Last active
December 17, 2015 22:19
-
-
Save dantman/5680577 to your computer and use it in GitHub Desktop.
Testing nested RDFa foaf and foaf in <head> using bnodes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "require": { | |
| "easyrdf/easyrdf": "@beta" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| require 'vendor/autoload.php'; | |
| $graph = new EasyRdf_Graph(); | |
| $html = <<<HTML | |
| <!DOCTYPE html> | |
| <html lang="en" dir="ltr"> | |
| <head prefix="foaf: http://xmlns.com/foaf/0.1/"> | |
| <title>...</title> | |
| <base href="http://www.example.org/"> | |
| <link about="_:alice" rel="rdf:type" href="foaf:Person"> | |
| <meta about="_:alice" property="foaf:name" content="Alice Birpemswick"> | |
| <link about="_:alice" rel="foaf:mbox" href="mailto:[email protected]"> | |
| <link about="_:alice" rel="foaf:phone" href="tel:+1-617-555-7332"> | |
| </head> | |
| <body> | |
| </body> | |
| </html> | |
| HTML; | |
| $graph->parse( $html ); | |
| echo $graph->dump( false ); | |
| $graph = new EasyRdf_Graph(); | |
| $html = <<<HTML | |
| <!DOCTYPE html> | |
| <html lang="en" dir="ltr"> | |
| <head> | |
| <title>...</title> | |
| <base href="http://www.example.org/"> | |
| </head> | |
| <body> | |
| <div vocab="http://xmlns.com/foaf/0.1/" typeof="Person"> | |
| <p> | |
| <span property="name">Alice Birpemswick</span>, | |
| Email: <a property="mbox" href="mailto:[email protected]">[email protected]</a>, | |
| Phone: <a property="phone" href="tel:+1-617-555-7332">+1 617.555.7332</a> | |
| </p> | |
| </div> | |
| </body> | |
| </html> | |
| HTML; | |
| $graph->parse( $html ); | |
| echo $graph->dump( false ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Graph: | |
| _:genid1 (EasyRdf_Resource) | |
| -> rdf:type -> foaf:Person | |
| -> foaf:name -> "Alice Birpemswick"@en | |
| -> foaf:mbox -> mailto:[email protected] | |
| -> foaf:phone -> tel:+1-617-555-7332 | |
| Graph: | |
| http://www.example.org/ (EasyRdf_Resource) | |
| -> rdfa:usesVocabulary -> foaf: | |
| _:genid1 (EasyRdf_Resource) | |
| -> rdf:type -> foaf:Person | |
| -> foaf:name -> "Alice Birpemswick"@en | |
| -> foaf:mbox -> mailto:[email protected] | |
| -> foaf:phone -> tel:+1-617-555-7332 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment