RDF::T...Formula(3pm)

πŸ’– RDF::T...Formula πŸ’–

okay bestie, so this is RDF::Trine::Node::Formula β€” the RDF Node class for formulae / graph literals, straight outta the User Contributed Perl Documentation. it's giving ✨ niche N3 girlie ✨ and i'm obsessed.


🌸 NAME 🌸

RDF::Trine::Node::Formula β€” the RDF Node class for formulae / graph literals. no cap, that's literally it.


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea: formulae are implemented as a subclass of literals. that means parts of Trine that have zero special knowledge about formulae β€” hi, the Turtle serialiser, we love you β€” will just see them as literals with a particular datatype URI, which is http://open.vocab.org/terms/Formula. they literally cannot tell the difference. it's giving undercover πŸ’…

if your code needs to detect formulae nodes, try:

use Scalar::Util qw[blessed];
if (blessed($node) && $node->isa('RDF::Trine::Node::Formula'))
  { ... do stuff to formulae ... }

or perhaps:

use Scalar::Util qw[blessed];
if (blessed($node) && $node->can('pattern'))
  { ... do stuff to formulae ... }

two icons, two ways to vibe check a node. pick your fighter 🫢


πŸŽ€ Constructor πŸŽ€

  • new ( $pattern ) β€” returns a new Formula structure. this is a subclass of RDF::Trine::Node::Literal, so it's inheriting main character energy fr fr. $pattern is an RDF::Trine::Pattern, or a string capable of being parsed with RDF::Trine::Parser::Notation3->parse_formula. so like, either you hand it a whole pattern, or you hand it a string and let the Notation3 parser cook. πŸ”₯

πŸ’… Methods πŸ’…

  • pattern ( $node ) β€” returns the formula as an RDF::Trine::Pattern. hands you the actual pattern, slay.
  • forAll β€” returns the a list of nodes with the @forAll quantifier. (yes, the original really says "the a list" β€” i'm keeping that exactly as it is because i respect the source material 😭)

this is a fairly obscure bit of N3 semantics. iykyk.

  • forSome β€” returns the a list of nodes with the @forSome quantifier. (again: "the a list". iconic typo. preserved with love.)

this is a fairly obscure bit of N3 semantics. twin of the one above, but for @forSome 🧚

  • as_literal_notation β€” returns the formula in Notation-3-like syntax, excluding the wrapping {…}.

uses absolute URIs whenever possible, avoiding relative URI references, QNames and keywords. so it's not out here being lazy with shortcuts β€” full absolute URIs only, periodt.

  • from_literal_notation ( $string, $base ) β€” modifies the formula's value using Notation 3 syntax, excluding the wrapping {…}. note that it modifies, bestie β€” this one's out here changing things in place, so be aware. πŸ’€
  • equal ( $node ) β€” returns true if the two nodes are equal, false otherwise. simple, clean, no notes.

TODO - really need a "not equal, but equivalent" method. (the original author said it, not me, but honestly? valid. we're all waiting on that one πŸ™ˆ)


πŸ’€ BUGS πŸ’€

please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=RDF-TriN3 β€” don't be shy, they want the bug reports fr fr.


🌈 SEE ALSO 🌈

  • RDF::Trine::Node
  • RDF::Trine::Pattern

go read those too, bestie, the lore runs deep.


πŸ‘‘ AUTHOR πŸ‘‘

Toby Inkster <tobyink@cpan.org> β€” absolute legend.

based on RDF::Trine::Node::Literal by Gregory Todd Williams. standing on the shoulders of icons 🫢


Copyright (c) 2006-2010 Gregory Todd Williams.

Copyright (c) 2010-2012 Toby Inkster.

this library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. so go off, remix it, just keep it free and keep the terms. πŸ’–


🌸 DISCLAIMER OF WARRANTIES 🌸

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

translation: no promises, no guarantees, you get what you get and you don't get upset. it's literally "as is", bestie β€” no takebacksies. 😭


and that's the whole page, bestie! this beauty came from perl v5.34.0, dated 2022-06-17, courtesy of the User Contributed Perl Documentation. go forth and detect your formulae nodes βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from